Pipelines
A pipeline runs ordered curate, distill, train and evaluate stages in one submission. Refer to an earlier stage’s dataset or model as @STAGE_NAME. Resume an interrupted pipeline from its unfinished stage.
To validate and start a pipeline, follow these steps:
-
Validate the plan:
akka optimize training pipelines start -f pipeline.yaml --dry-run -
Start the pipeline:
akka optimize training pipelines start -f pipeline.yaml --wait --exit-status
To read, resume, or cancel a pipeline, use the corresponding command:
akka optimize training pipelines get PIPELINE_ID
akka optimize training pipelines resume PIPELINE_ID
akka optimize training pipelines cancel PIPELINE_ID
To list pipelines, newest first, run akka optimize training pipelines list. akka optimize training pipelines list --help names the filters it takes.
The --dry-run option runs the submission checks and prints the resolved value of each stage without starting the pipeline. Optimize refuses a stage that specifies an unknown base model or dataset. Add --show-resolved to print the resolved configuration and execution settings, including every default, for a train stage whose dataset is already registered:
akka optimize training pipelines start -f pipeline.yaml --dry-run --show-resolved
A pipeline that trains its own judge
The following pipeline trains a judge, gates it on its own score, and then uses it to grade a supervised run and a reinforcement run:
kind: pipeline
stages:
- type: train
name: judge
project: commit-judge
baseModel: Qwen/Qwen3-0.6B
config:
dataset: commit-messages/judge-train
hyperparams:
lora:
rank: 8
optimizer:
learningRate: 0.0001
training:
epochs: 3
- type: evaluate
name: judge-scored
model: "@judge"
dataset: commit-messages/judge-eval
minMeanScore: 0.7
- type: train
name: sft
project: commit-messages
baseModel: Qwen/Qwen3-0.6B
grader: model:@judge
config:
dataset: commit-messages/train
hyperparams:
lora:
rank: 8
optimizer:
learningRate: 0.0001
training:
epochs: 3
- type: train
name: rl
project: commit-messages
baseModel: Qwen/Qwen3-0.6B
source:
model: "@sft"
grader: model:@judge
config:
dataset: commit-messages/train
method: grpo
rlHyperparams:
groupSize: 4
maxCompletionLength: 64
- type: evaluate
name: rl-scored
model: "@rl"
dataset: commit-messages/eval
grader: model:@judge
The pipeline trains the judge first and checks its score before using it to grade anything. The reinforcement stage starts from the supervised adapter, which source.model names as @sft, and uses the judge for its reward. A stage of any method can start from an earlier stage’s model this way.
A pipeline that distills a teacher into a student
The following pipeline has a teacher answer your agents' conversations, trains a student on the accepted answers, and scores the student and the teacher on the same held-out dataset with the same grader:
kind: pipeline
submissionId: triage-distill-1
stages:
- type: distill
name: distill
project: triage
teacher: google/gemma-4-31b-it:v1
source: triage/agent-traffic:v3
target: triage/distilled
replicas: 4
- type: train
name: sft
project: triage
baseModel: google/gemma-4-E4B-it
config:
method: sft
dataset: "@distill"
- type: evaluate
name: student
model: "@sft"
dataset: triage/held-out
grader: json-label-match
- type: evaluate
name: teacher
model: google/gemma-4-31b-it:v1
project: triage
dataset: triage/held-out
grader: json-label-match
The train stage trains on the dataset version the distill stage registered. The teacher is a base model, which belongs to no training project, so its evaluate stage names the project its score belongs to. Compare the two scores with akka optimize training pipelines get PIPELINE_ID.
The following example shows training pipelines get output. Your IDs and scores differ. An evaluate stage names the model it scored, the exact dataset version it scored against, and the grader. An evaluate stage that finished before 0.10.0 shows grader not recorded.
akka optimize training pipelines get b9595381c434
Pipeline b9595381c4343c6fa0a6f8b196c8afae0ad682bb002245fdd32874ef28671fc6
Phase Completed
Stages 4 of 4
GPU 55080.0 seconds over 2 stage(s)
distill distill COMPLETED 1200/1200 decisions (100%) triage/distilled:v1
run cab53a6a5f79158204e18eae52ff32c967ae50cf7f299bd9ea1fd393382758c9
duration 4h10m
gpu 52380.0 seconds
sft train COMPLETED 146/146 steps (100%), loss 0.2310 triage/gemma-4-e4b-it:v1
run ee17a3e34bb8c6878d6b8597e40350ce7cd4b177215929997695652ac46dcbe5
duration 45m
gpu 2700.0 seconds
Training peak 21.4 GiB per device, held by the training pass
student evaluate COMPLETED 200/200 examples (100%) triage/gemma-4-e4b-it:v1 on triage/eval:v1 score 0.8800 by json-label-match
run fc782a4ad7bd5f5a3fff82d3610d12f398f420c6dbfef22d5d2ad0680d0d5581
duration 9m
teacher evaluate COMPLETED 200/200 examples (100%) google/gemma-4-31b-it:v1 on triage/eval:v1 score 0.9100 by json-label-match
run 4242d6bc6e793d6137c3e921c58bf9ad8c8bc8fedda7081fa1b24075c91a390e
duration 21m
The pipeline plan
A pipeline plan has the following top-level fields:
| Field | Description |
|---|---|
|
|
|
The stages, in the order they run. Required. See Stages. |
|
Reuse this ID to retry a submission after a dropped connection. To start another pipeline, use a new ID. The CLI generates one if omitted. |
|
An annotation. It is not part of the pipeline’s identity. |
Stages
Every stage has the following fields:
| Field | Description |
|---|---|
|
|
|
A name that is unique in the pipeline. Required. A later stage refers to the stage’s output as |
The curate stage
A curate stage judges each exchange in a set of uploaded sessions and keeps those that score at or above a threshold. Its output is a dataset of the retained exchanges. It has the following fields:
| Field | Default | Description |
|---|---|---|
|
none |
The uploaded sessions to read, by hash. Required. |
|
none |
The format of the sessions: |
|
|
The language of the exchanges to keep. Sessions in |
|
A general data-quality instruction |
The instruction the judge scores each exchange with. The judge answers with a score from 0 to 1. |
|
|
The lowest score an exchange is kept at. From 0 to 1. |
|
none |
The system message for a kept exchange that has none of its own. Required. |
|
none |
The named dataset in the registry that the kept exchanges are registered under, such as |
|
none |
An annotation. |
The distill stage
A distill stage runs a distillation: a teacher answers every decision in a source dataset, and Optimize registers the accepted answers as a version of a target dataset. A later stage names this stage as @STAGE_NAME wherever it names a dataset and takes the version it registered. See Distillation for what a distillation does. A distill stage has the following fields:
| Field | Default | Description |
|---|---|---|
|
none |
The training project, by name or ID. Teacher, source and target references without a namespace use its namespace. Required. |
|
none |
The model that answers, by registry reference. A base model or an adapter over one. It cannot be an earlier stage’s output. Required. |
|
none |
The source chat dataset, by registry reference or as |
|
none |
The named dataset for the accepted rows. Required. |
|
|
|
|
|
The teacher replicas after the smoke, one GPU each. |
|
The first 16 decisions |
The decisions the smoke answers, as a list of |
|
|
The maximum number of tokens in an answer, including reasoning. |
|
|
The maximum combined token count for a prompt and its answer. |
|
|
The sampling temperature, from 0 to 2. |
|
|
The nucleus sampling bound, above 0 and at most 1. |
|
|
The seed used to derive each decision’s sampling seed. |
|
|
Setting |
|
none |
Text appended to each prompt’s system message. |
|
none |
An annotation. |
To train again on a completed distillation, name its registered dataset version in config.dataset and omit the distill stage. Otherwise a new pipeline starts another distillation.
The train stage
A train stage contains the fields of a run plan, except kind and submissionId, plus name. Every train stage names its baseModel. A pipeline that trains a judge and a policy gives each stage its own modelName, so the two are separate named models in the project’s namespace. For the run plan, see Training runs.
The evaluate stage
An evaluate stage has the following fields:
| Field | Description |
|---|---|
|
The model to score, by registry reference or as |
|
A selected base model to score as it is, by repository. Use it to measure the model before training. The evaluation job loads the model at the commit the catalog pins. |
|
The training project the score belongs to, by name or ID. A trained model records its training project, so set this for a |
|
The evaluation dataset. Without it, the stage scores a trained model’s training dataset, which measures reproduction rather than generalization. Required for a base model, an imported model, and a model trained on prepared token rows. |
|
The grader. Default |
|
The instructions used by a |
|
A gate. The pipeline fails when the mean score is below this value. |
|
A ceiling on the length of one scored answer. Without it, the answer length is not capped. |
|
An annotation. |
If a score gate is undecided because examples are unscored, correct the grader or data before retrying.