Supervised fine-tuning
Supervised fine-tuning (SFT) trains a model on examples of the answers you want. If you can rank answers but cannot write an ideal answer for each prompt, use DPO instead.
When to use it
Use SFT for tasks such as:
-
Classifying support messages into known categories.
-
Extracting fields into a fixed JSON format.
-
Following domain instructions or choosing tools from examples.
If you can verify an answer but cannot demonstrate it, consider reinforcement learning.
Prepare your data
Write one chat example per line of a JSONL file. Each row has a messages array with the prompt and the expected assistant answer:
{"messages":[{"role":"system","content":"Classify the support message. Answer with JSON."},{"role":"user","content":"My card still has not arrived."},{"role":"assistant","content":"{\"intent\":\"card_arrival\"}"}]}
For a first classification run, the support triage example starts with 500 training rows and 100 evaluation rows.
Keep evaluation rows separate from training rows. Register the training file before starting a run:
akka optimize registry datasets register triage/train -f train.jsonl
For multi-turn conversations, tools and images, see Conversations and tools. To supply your own tokens and masks, see Prepared token rows.
Start a run
Create a training project and select an allowed base model as described in Training runs. Save this plan as run.yaml:
kind: run
project: triage
baseModel: unsloth/Llama-3.2-1B-Instruct
config:
dataset: triage/train
method: sft
Validate the plan, then start training:
akka optimize training runs start -f run.yaml --dry-run
akka optimize training runs start -f run.yaml --wait --exit-status
The completed run registers a model version, shown under Results.
Key parameters
Start with the defaults and change one setting at a time. These fields are under config:
| Field | Default | Purpose |
|---|---|---|
|
|
Peak learning rate. |
|
|
Passes over the training dataset. |
|
|
Adapter rank; higher ranks need more memory. |
|
|
Maximum row length in tokens. |
|
None |
Separate dataset for validation during training. |
For batch sizes, loss masks and all other settings, see Run plan reference.
What to watch
Read training and validation loss together. If training loss falls while validation loss rises, reduce training or improve the data. Check the held-out evaluation score before choosing a model; a lower training loss alone does not establish task quality.
Use akka optimize training runs metrics RUN_ID for the readings and akka optimize training projects scores triage to compare evaluated models.
Next steps
-
Evaluate the model on held-out examples.
-
Continue with DPO when you have preference pairs.