LocalBackend and ServerlessBackend.
Data format
SFT training data is a JSONL file where each line is a JSON object withmessages and optionally tools. Hereβs a simple example:
tools array and tool_calls in the assistant message:
messages(required) β a non-empty list of chat messages. Each message has arole(system,user,assistant, ortool) andcontent. The last message must be from theassistantrole.tools(optional) β a list of tool/function definitions, following the OpenAI tool format.
tool_calls in assistant messages.
Only the assistantβs response tokens contribute to the training loss.
Instruction and user tokens are automatically masked so the model learns to
produce better responses without memorizing prompts.
Training from a JSONL file
For large datasets, usetrain_sft_from_file. It handles batching and applies a learning rate schedule automatically.
Distillation
Distillation trains a smaller model on completions from a larger teacher model. Generate responses from the teacher, wrap them as trajectories, and fine-tune:SFT as warmup before RL
A common pattern is to run SFT first to give the model a head start, then switch to RL for further improvement. ART supports switching between SFT and RL training seamlessly within the same run:Local vs Serverless
Both backends support SFT with the same API. The key differences are in how training executes:
The
ServerlessBackend requires a W&B API key. See the backend docs for setup instructions.