Distillation

Distillation turns a teacher model’s answers into training data for a smaller model. Use it to learn from a larger model on your agents' conversations.

A decision is one assistant message in a source row. The teacher answers from that message’s history and offered tools. Each accepted answer becomes a chat row, ready for SFT.

Start a distillation

Name the teacher, source dataset and target dataset:

akka optimize training distillations create --project triage \
  --teacher google/gemma-4-31b-it:v1 --from triage/agent-traffic --to triage/distilled \
  --replicas 4

Use a text chat dataset and a selected teacher from Gemma 4, Llama 3.2, Qwen2.5 or Ministral. Only Gemma 4 supports --thinking on. References without a namespace use the training project’s namespace.

The command asks for confirmation. It first checks a small set of decisions on one GPU. If that succeeds, each replica claims one GPU for the full dataset. Choose a replica count within your project’s quota and always-available capacity; a temporary capacity window does not qualify.

Change these options when your data needs it:

Option Default Purpose

--replicas

1

Teacher replicas, one GPU each.

--max-tokens

4096

Maximum answer tokens, including reasoning.

--max-model-length

65536

Combined prompt and answer limit.

--temperature

1.0

Sampling temperature.

--thinking

off

Ask a Gemma 4 teacher to reason; training rows exclude its reasoning.

--instructions

None

Additional system instructions for the teacher.

If prompts leave too little room for --max-tokens, increase --max-model-length or shorten the source conversations. Use create --help for all options, including selecting the initial decisions with --smoke.

A strict catalog refuses a teacher with serving measurements alone where no serving envelope names the device, or where its context is shorter than --max-model-length.

Follow progress

Read the phase, completed decisions, accepted and rejected counts, and registered dataset:

akka optimize training distillations list --project triage
akka optimize training distillations get DISTILLATION_ID
akka optimize training distillations wait DISTILLATION_ID
akka optimize training distillations get cab53a6a5f79
Distillation     cab53a6a5f79158204e18eae52ff32c967ae50cf7f299bd9ea1fd393382758c9
Project          triage
Teacher          google/gemma-4-31b-it:v1 (over google/gemma-4-31B-it)
Source           triage/agent-traffic:v3
Target           triage/distilled
Dataset          triage/distilled:v1
Phase            Completed
Attempt          2
Decisions        1200/1200 decisions (100%), 1164 accepted, 36 rejected
Chunks           2/2 committed
Replicas         0/4 running

Rejections       truncated 21, arguments_invalid 9, call_unframed 6
Smoke            passed, 15 of 16 accepted, 15 needed, attempt 1; truncated 1
GPU time         52380.0 seconds; attempt 1 smoke on 1 GPU 540.0 seconds, attempt 2 on 4 GPUs 51840.0 seconds
Settings         4 replicas, max tokens 4096, max model length 65536, temperature 1, top-p 1, seed 0, thinking off
Smoke decisions  the first 16 decisions in the source
Duration         4h10m, ended 100m ago
Runtime          0.11.0

training distillations list lists the distillations, newest first. akka optimize training distillations list --help names the filters it takes.

When complete, use the registered dataset version, such as triage/distilled:v1, in config.dataset. A distillation with no accepted answer fails.

Pause, resume or cancel

Use the corresponding command:

akka optimize training distillations pause DISTILLATION_ID
akka optimize training distillations resume DISTILLATION_ID
akka optimize training distillations cancel DISTILLATION_ID

Pausing releases the GPUs; resuming claims them again and continues from saved work. Cancelled distillations cannot resume. During ASSEMBLING, the GPUs are already released and pausing is unavailable.

Inspect rejected answers

Read rejected answers and their reasons:

akka optimize training distillations rejections DISTILLATION_ID --limit 20

Use -o json for the full answer, reasoning and calls. A truncated answer needs more answer tokens; a prompt_too_long decision needs more context or a shorter history. For invalid tool calls, inspect the offered tools and arguments before changing the teacher or instructions. For a Gemma 4 teacher, rejection reasons include call_unparsed when a closed tool call is not in the model’s call format. Rejected answers do not become training rows.

Distill in a pipeline

Use a distill stage before a student training stage. To train again without generating more answers, reuse the completed distillation’s dataset version and omit that stage.