Training

Fine-tune a model on
your agent's conversations.

An open-source recipe that turns your agent's labelled conversations into a dataset and tunes the model it runs with SFT, DPO or GRPO reinforcement learning, on Fireworks, Baseten or Tinker.

Why it matters

Your agent's conversations already hold the examples a model needs.

A label is a dataset

Reviewers label replies in the annotations queue, or you import a labelled file. Either one becomes the examples to train on.

Held-out cases

Cases the training never sees score the base and the tuned model side by side, field by field.

Rewards in a sandbox

The code that scores each reply for GRPO runs in our secure sandboxes, next to the data it reads.

Your provider account

Training and serving are billed by the provider to your own account, with a budget that switches an endpoint off.

How it works

The Operator's training phase works through these steps with you, and asks before anything is trained or deployed.

1. Connect

Pick the provider and the model to tune, and check the project holds the provider's key.

2. Prepare

Find the labels that hold examples, or import a file, and check no held-out case is among them.

3. Train

Run a short trial, then the full training. Its page draws the train and test loss as each step lands.

4. Serve

See the hardware and its hourly price, set a budget, deploy, then compare base and tuned on the held-out cases.

prompt-router
Fireworks · completed
Chat with modelOpen in Fireworks
Base model
glm-5p3-flash
Duration
2m 33s
Steps
5 / 5
Examples (train / test)
598 / 66
Tokens (trained / total)
21,248 / 194,719
Loss
00.20.412345
Train 0.049Test 0.065

A five-step trial on Fireworks. The page draws the train and test loss as each step lands.

.introspection
prompt-router.yaml
agents
agent.yaml
judges
routing-answer.yaml
evals
cases
vitest
training
prompt-router-sft.yaml
prompt-router-dpo.yaml
router.py
pairs.py
prompts
route-a-prompt.md
package.json
1agent: agent
2select:
3 include: [router-correct, router-wrong, router-corrected]
4 exclude: [router-needs-review]
5 holdout: evals/vitest/route-held-out.eval.jsonl
6target:
7 script: training/router.py
8train:
9 method: sft
10 provider: fireworks
11 base_model: accounts/fireworks/models/glm-5p3-flash
12 lora_rank: 8
13 epochs: 1
14 batch_size: 16
15 learning_rate: 1.0e-4
16 max_seq_len: 2048
17 validation_fraction: 0.1
18 eval_every: 5
19evaluate:
20 max_tokens: 256
21 temperature: 0

Open source, Apache 2.0 ↗

Your data stays on the Platform

Data preparation happens on the Platform, and reward functions run in our secure sandboxes. Only the examples to train on reach the provider, on your own key.

  • Create a runtime from a template, with your agent through the Operator, or from your terminal with our CLI
  • Keep the recipe's repository on Introspection or in your own GitHub
  • Label, import and build examples on a data plane that can sit entirely inside your own VPC on AWS, Azure or GCP
  • GRPO reward functions run in our secure sandboxes, beside the data they score
  • The provider's key is stored write-only in the project, and one key trains and serves

Fine-tune your first model →

Methods and providers

Train on Fireworks, Baseten or Tinker with SFT, DPO or GRPO. Start with SFT.

SFT

Trains on labelled replies: the reply to give. A target script builds it from field labels when the reply is not written out.

DPO

Trains on pairs, a better and a worse reply to the same prompt. Suits a model that answers in the right shape but sometimes picks wrong.

GRPO

Reinforcement learning on prompts and a reward. The reward function runs in our secure sandboxes and scores each reply the model tries.

Fireworks, Baseten, Tinker

Fireworks and Baseten serve the tuned model on a dedicated deployment, per GPU-hour. On Tinker it answers as soon as training ends.

Methods, providers and settings ↗

Tune a model on your own conversations.