Requirements
Before you begin, make sure you have:- Python 3.11 or later and uv.
- The Together CLI, version 3.0.0 or later, to download the trained model. Install or upgrade it with
uv tool install "together[cli]" --upgrade. - A Together AI account with enough credit to run your model resource for four hours, the minimum for creating one.
- Your API key exported as
TOGETHER_API_KEY. Get one from API keys in the Together AI console. - A Weights & Biases API key exported as
WANDB_API_KEY. Most cookbook recipes log to Weights & Biases, including the one in this quickstart. To run without an account, exportWANDB_MODE=offlineinstead. - Optionally, a Hugging Face token exported as
HF_TOKENfor gated models or datasets.
Step 1: Clone the cookbook
Clone the cookbook and install its dependencies, including the Together Python SDK:Step 2: Review the recipe
Openrecipes/sft/no_robots.py. The recipe defines a config object and passes it to the cookbook’s SFT training loop:
recipes/sft/no_robots.py
train function provisions a trainer-only model resource and attaches a session to it. For each batch, it runs forward_backward with the cross-entropy loss, then optim_step.
These settings shape the run:
Step 3: Run training
Run the recipe:loss is the mean cross-entropy per trained token, so it stays comparable across steps even as the batch’s token count changes. Each batch holds different examples, so loss varies from step to step. Watch its trend rather than single steps. lr decays linearly toward zero over the run.
The recipe also logs each step to Weights & Biases and to metrics.jsonl in the run directory shown on the Run artifacts line.
Step 4: Retrieve the trained model
The final inference checkpoint is registered in your project’s model registry. To find its registry ID, look up the session that produced it. TheSession ready line of the recipe’s output shows the session ID, and the run’s manifest records it too:
tg training ls-checkpoints to list its inference checkpoints:
ml_...@rv_.... Download the adapter with it:
inference checkpoint line to the SDK’s download_checkpoint function.
You trained a LoRA on No Robots and downloaded its weights.
Stop the model resource
The run stops the session and the model resource when it exits, so billing has already ended. To confirm, list the model resources you created most recently:stopped. If the run was interrupted, its resource can still be active. A ready resource is billing, and a pending or creating one starts billing once it’s ready. Stop the resource with its ID from the list:
force=True also stops any session that’s still attached. Without it, the API refuses to stop a resource while a session is active.
You can also stop the resource from the Model resources tab under Post-Training in the console. Manage model resources covers stopping, idle timers, and what a resource costs while it runs.
Continue with GRPO
A common pattern is to teach the model a format with SFT, then optimize it for task accuracy with GRPO. The GRPO run continues the same adapter from the training checkpoint your SFT run saved in Step 3.Next steps
GRPO quickstart
Train a model with GRPO and an exact-match reward on grade-school math.
SFT recipes
Prepare your own data, set loss masks, and chain SFT into GRPO.
Concepts
See how work splits between your code and Together AI GPUs, and what model resources, sessions, and checkpoints do.
Deploy a checkpoint
Deploy the trained model on dedicated model inference.