Supervised fine-tuning Your first SFT run

Your first SFT run

Teach an open-weight model your task from examples. Supervised fine-tuning is the fastest way to a specialist model, and the usual starting point before reinforcement learning.

Prepare your examples

Write each example as a chat conversation in JSONL, one per line, ending with the assistant reply you want the model to learn. Start with a few hundred high-quality examples from real traffic.

train.jsonl
{
  "messages": [
    { "role": "user", "content": "Where is my order?" },
    { "role": "assistant", "content": "Let me check that for you." }
  ]
}

Choose an adapter

OptionWhen to use it
LoRA, rank 8 to 32Most tasks. Fast, cheap, and many adapters can share one base model when served.
LoRA with unembeddingNew output formats or vocabulary-heavy tasks.
Full-weightLarge datasets and deep behavior changes. Slower and served as a dedicated model.

Train

Open a session, create the model and loop over batches of examples. Group examples into batches of similar length for efficiency.

train.py
import os
import rsi

client = rsi.Client(api_key=os.environ["RSI_API_KEY"])

with client.session() as session:
    model = session.create_model(
        base_model="Qwen3.6-35B",
        lora=rsi.LoraConfig(rank=16),
    )
    for step, batch in enumerate(batches):
        result = model.train_step(batch, lr=1e-4, loss_fn="cross_entropy")
        model.log({"loss": result.loss})
    checkpoint = model.save_weights("support-v1", mode="inference")

Track metrics

Values passed to model.log() appear as charts in the Console. Watch training loss alongside a held-out set, and stop when the held-out loss stops improving.

Save and deploy

Save with mode="inference" and follow Deploy and serve to put the model behind an endpoint.

Next steps