Loops docs | Training Jobs docs | Inference docs
Ready-to-use recipes for training models on Baseten. The cookbook covers Baseten's two ways to train:
| Loops | Training Jobs | |
|---|---|---|
| What it is | An SDK for online training: you write the training loop in plain Python and Baseten runs the trainer and a paired sampler | Batch jobs: you package a training script and config.py, then truss train push runs it on GPUs to completion |
| Best for | RL (GRPO, async and multi-turn), agent training, and SFT you want to drive step by step | SFT, DPO, full fine-tunes, and multi-node runs on the framework you choose (Axolotl, TRL, MS-Swift, VeRL, Megatron, TorchTitan, ...) |
| You manage | The loop: data, rewards, when to step and sample | The script and the GPU config |
| Start here | loops/README.md |
training-jobs/README.md |
loops/ # Loops recipes: SFT, GRPO (sync + async), multi-turn RL, rollout dashboard
training-jobs/
examples/ # runnable model/framework projects, launch with `truss train push`
recipes/ # implementation guides and patterns (RL, SFT, robotics, experiment dashboard, ...)
.examples-index.json # where each example lives; read by `truss train init --examples`
Loops is Baseten's SDK for online training. You write the training loop in plain Python: forward-backward passes, optimizer steps, and weight sync to a live sampler. Baseten provisions and runs the trainer and sampler. The recipes cover SFT, GRPO (sync, and async with bounded off-policy sampling), and multi-turn RL.
cd loops
export BASETEN_API_KEY="your-api-key"
uv sync
uv run rl/train_grpo.pySee loops/README.md for every recipe and the Loops docs for concepts.
Training jobs run a training script you package with a config.py on Baseten GPUs, through truss train. Pull any example into a fresh directory and launch it:
pip install -U truss
truss train init --examples qwen3-8b-lora-dpo-trl && cd qwen3-8b-lora-dpo-trl
truss train push config.pyOr clone this repo and push from the example's directory:
git clone https://github.com/basetenlabs/ml-cookbook.git
cd ml-cookbook/training-jobs/examples/qwen3-8b-lora-dpo-trl/training
truss train push config.pySee training-jobs/README.md for the full list of examples and recipes, and the Training Jobs docs for concepts.
training-jobs/recipes/experiment-dashboard is a local, self-hosted dashboard over an S3 experiment store. It syncs runs down and serves loss-curve overlays, hyperparameter filtering, and cross-run comparison, using only the Python standard library. It works with any training source that writes its three-file run contract, including Loops and Training Jobs. For a live view of a single Loops run's rollouts, use loops/rollout-dashboard.
- A Baseten account. Sign up here if you don't have one.
- API keys and tokens your runs need (for example, a Hugging Face access token for gated models), saved as Baseten secrets.
- Python 3.12+ for Training Jobs tooling, and Python 3.13+ with uv for Loops.
Contributions are welcome. Please open issues or submit pull requests. When you add, rename, or move a Training Jobs example, update .examples-index.json so truss train init --examples can find it; bin/check_examples_index.py checks it in CI.
MIT License, except loops/, which is adapted from tinker-cookbook and licensed under Apache 2.0 (see loops/LICENSE).