Skip to main content
Supervised fine-tuning (SFT) trains a model to imitate example responses. Each example pairs a prompt with the response you want, and training makes the model more likely to produce that response. In this tutorial, you use a ready-made recipe from the post-training cookbook to train a low-rank adapter (LoRA) for Qwen3.8 27B on the No Robots instruction-following dataset, then download the trained weights. Training takes about 10 minutes on a trainer-only model resource. The resource bills per GPU-minute from when it’s ready until it stops, at about $48 per hour.
For more control over the training loop, write it yourself with the Python SDK.

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, export WANDB_MODE=offline instead.
  • Optionally, a Hugging Face token exported as HF_TOKEN for 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

Open recipes/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
Each No Robots example is a conversation with a user message and a human-written assistant response. The recipe trains the model to produce the assistant response from the conversation that precedes it. The 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:
The recipe prints status lines while it waits for the model resource and the session to become ready. That usually takes a few minutes, or longer when GPUs are scarce. While the resource is queued, the status lines show its queue position, and the recipe keeps waiting until it gets GPUs. If you interrupt the recipe with Ctrl+C, the SDK stops the resource before exiting. Once the session is ready, the recipe prints one line per step. The first step takes longer than the rest, and saving the inference checkpoint at the end can take several minutes. You should see output like this:
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. The Session ready line of the recipe’s output shows the session ID, and the run’s manifest records it too:
Pass the session ID to tg training ls-checkpoints to list its inference checkpoints:
The Registry artifact column holds the trained adapter’s registry ID and revision ID, as ml_...@rv_.... Download the adapter with it:
The CLI downloads only the adapter weights, in SGLang’s multi-LoRA layout, which PEFT and Hugging Face Transformers can’t load. For the base model with the adapter merged in, ready for any inference framework, pass the ID on the recipe’s 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:
You should see this run’s resource first, with the status 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.