train models that rival the frontier, at open source cost

post-train, evaluate, and ship task-specific models

import data

castform auto-generates training data from the data you already have - existing corpuses, agent traces, and more.

from benchmax.rag.qa_generation.pipeline import Pipeline
from benchmax.rag.qa_generation.pipeline_config import PipelineConfig, PlatformConfig
from benchmax.rag.corpus.postgres.source import PostgresChunkSource

# supports turbopuffer, pinecone, chroma, postgres
source = PostgresChunkSource(corpus_name="GitLab Handbook")
source.populate_from_existing_corpus_name("GitLab Handbook")

cfg = PipelineConfig(
    platform=PlatformConfig(api_key="sk_..."),
)

rag_dataset = Pipeline(cfg, source_factory=lambda _: source).run()
from benchmax.traces import TracesPipeline

# supports braintrust, langfuse, langsmith
pipeline = TracesPipeline(
    traces=traces,
    min_completion_chars=40,
    tool_relay=0.8,
    dedup=0.9,
    target_examples=1000,
    output_dir="outputs/agentic",
)

result = pipeline.run()
generate training examples
source
Uploaded GitLab Handbook 34,607 chunks
corpus summary
GitLab's company handbook covering team processes, people policies, IT and security, finance, and engineering workflows.
example prompts question mix
41%
59%
lookup
multi-hop
prompt ground truth
Which internal Slack channel is for questions and requests for the CEO?
#ceo — a public channel for questions and requests for the CEO [Source: Communicating with the Field].
When must a company-issued laptop be wiped before it's handed off or after a security incident?
Whenever it's lost or compromised during a security incident, and before it's donated, returned, or transferred to another team member [Source: Laptop Remote Management and Monitoring].
What should I use to capture meeting notes and keep absent teammates informed?
Google Docs — a real-time collaborative tool to take notes, share decisions, and keep all stakeholders informed [Source: How do you collaborate and whiteboard remotely?].
When scheduling a recurring leadership call, what sign-in path and calendar availability setting avoid blocking customer meetings?
Sign in to Zoom via SSO (Okta), then set the calendar event's availability to Free so it won't reserve the time [Source: Support Leadership Sync].
build training dataset
source
Braintrust korea-law-agent-prod 584 traces
filters
drop tool-echo turns threshold 0.8
dedup near-duplicate completions threshold 0.9
pivot filter (llm counterfactual) threshold 0.6
response mix
52%
26%
22%
read-only tool call
mutating tool call
text response
prompt trajectory
How can I run the individual steps of a CI job on my own machine, using the pipeline definition stored locally?
search_corpus("run CI job steps locally pipeline definition") → read_doc("Step Runner for executing GitLab Steps") → respond("use Step Runner to execute a job's steps locally…") [Source: Step Runner for executing GitLab Steps]
After a performance test run, how do I remove all the sample data it created, and are the two cleanup methods treated differently?
search_corpus("performance test cleanup delete generated data") → read_doc("GitLab Performance Tool (GPT) Quick Start") → respond("run the GPT cleanup step; Method 1 and Method 2 differ…") [Source: GitLab Performance Tool (GPT) Quick Start]
How should I request help from the team that produces technical promotional materials and product demos?
search_corpus("technical marketing request demos promotional materials") → read_doc("Technical Marketing") → respond("follow the Technical Marketing content request process…") [Source: Technical Marketing]
What should I review to get better at uncovering a prospect's needs and clearly explaining our differentiation in customer conversations?
search_corpus("discovery methodology prospect needs differentiation") → read_doc("Effective Discovery") → respond("leverage the listed discovery resources and GitLab-tailored methodology…") [Source: Effective Discovery]

define tools & rewards

plug in the same tools your agent uses in production, and define quality with composable reward functions

from benchmax.envs.base_env import BaseEnv

class SearchEnv(BaseEnv):
    system_prompt = """you are a retrieval agent..."""

    async def run_tool(self, name, **args):
        if name == "search_corpus":
            return self.corpus.search(args)

    async def compute_reward(
        self, rollout_id, completion, ground_truth
    ):
        return {
            "correctness": await compute_correctness(),
            "conciseness": await compute_conciseness(),
            "citation": await compute_citation(),
            "tool_call_efficiency": await compute_tool_call_efficiency(),
        }
environment
🛠️ tools
search_corpus
🏆 rewards
correctness
conciseness
citation
tc_efficiency
agent
system_prompt: you are a retrieval agent.
👤 task
When does GitLab's fiscal year start and end — and is it just the calendar year?
🤖
🛠️ executing tool GitLab's fiscal year runs February 1 to January 31 — FY names track the ending month, so FY27 ends Jan 31, 2027 · Finance
1 tool call
💬 answer
🧠 learning from feedback
📊 score
correctness 0.80
conciseness 0.40
citation 0.20
tc_efficiency 0.65
computing rewards

monitor training

watch reward curves climb in real time and inspect qualitative model outputs. catch reward hacking and regressions early.

rag-gitlab-handbook
pending
step 0/120
average reward
0.800.600.400.200.00
0 120
response lengths
36003150270022501800
0 120
max reward
1.000.750.500.250.00
0 120
solve rate
1.000.750.500.250.00
0 120
prompt preview step
prompt
A support manager on a company-issued Mac is creating a standing leadership call and wants to avoid a scheduling mistake that could interfere with customer-facing meetings. What sign-in path should they use, and what availability setting keeps the recurring event from reserving their time…
0
10
20
30
40
50
60
70
80
90
100
110
120
rollout 1
rollout 2
rollout 3
rollout 4
reward: 0.40 (correctness) + 0.30 (conciseness) + 0.25 (citation) + 0.05 (tc_efficiency) = 1.00
assistant
<tool_call>
{"name": "search", "arguments": {"query": "Zoom schedule recurring meeting SSO Okta availability Free calendar customer calls"}}
</tool_call>
user
… When adding the event to the calendar, set the availability to `Free`. This is **vital** to ensure it does not block customer calls.
1. — [Source: Support Leadership Sync] (score: 61.40)
assistant
… Sign in to Zoom via SSO and authenticate with Okta in the browser, then when you add the recurring event to the calendar set its availability to Free so the standing call does not reserve your time or block customer meetings

beat the frontier

achieve frontier model performance at a fraction of the cost with a model you own and control.

finetuned 4b
🏎️
0.00¢ 0.0s
user
Which leadership book shaped GitLab's management approach, and can I expense a copy if I buy one?
2 tool calls
assistant
tool
assistant
tool
assistant
reward: 1.0 (correct) + 0.9 (concise) + 1.0 (cite) + 0.5 (efficient) = 3.4
1.0x cheaper
1.0x faster
gpt-5.4
🚜
0.00¢ 0.0s
user
Which leadership book shaped GitLab's management approach, and can I expense a copy if I buy one?
2 tool calls
assistant
tool
assistant
tool
assistant
reward: 0.2 (correct) + 0.4 (concise) + 0.1 (cite) + 0.3 (efficient) = 1.0
ready
set
GO!

questions?

do i need ml or rl expertise?

no. castform is designed for engineers and researchers alike: it works out of the box with no ml expertise, and exposes advanced controls for those who want it. you bring your data and define what success looks like, and we handle the rl algorithms, environment scaffolding, distributed training, and infrastructure.

what use cases do you support?

virtually anything rl fine-tuning. if you can define verifiable success metrics for your task, we provide the algorithms and infrastructure to fine-tune a model to optimize for those.

you just need to set up the two things the trainer needs: an environment (what the model has access to, and the reward signals that define how the model is scored) and a dataset (the examples it trains on).

to make it easier, we provide automated dataset generation and environments for training rag agents and fine-tuning on production agent traces.

how do i get access?

you can start training right away by signing up at app.castform.dev. it is fully self-service and pay-as-you-go, with enough free credits for new users to trial their first training run.

who owns my data and the trained model?

you do. we train readily available open-source models on your data, and you can export the trained weights at any time. apply them and deploy the new model wherever you like. any data you upload for training is stored securely and used only for your training runs, and can be deleted at any time.

how does pricing work?

castform is pay-as-you-go: you only pay for the compute you use during training runs. there are no seats, no monthly minimums, and no lock-in. new users receive free credits to trial their first run.

see the full breakdown on our pricing page.

how can i learn more?

check out our docs for guides, examples, and the python sdk reference.

prefer to talk it through? reach out at castie@castform.com and we'll help you figure out whether rl fine-tuning is a fit for your use case.

ready to train your first custom model