Quickstart
Train a support-message classifier, evaluate it against the base model, and serve it on a test endpoint. The downloadable example supplies the data script and YAML plan.
Before you begin
You need the following:
-
Optimize in your Akka project and an authenticated
akka optimizesession. See CLI. -
Python 3 and access to
datasets-server.huggingface.coto download the example data. -
Available training quota. Check
akka optimize training capacity.
Read your Optimize route’s hostname with akka routes get ROUTE_NAME. Set the service URL and check the connection:
export AKKA_OPTIMIZE_URL=https://ROUTE_HOSTNAME
akka optimize status
Download and extract the support triage archive. Run the commands from that directory.
Step 1: Prepare and upload training data
The example trains on chat messages whose assistant answer is an intent label, such as {"intent":"card_arrival"}. Prepare 500 training rows and 100 separate evaluation rows:
export ROWS=500 EVAL_ROWS=100
python3 prepare_dataset.py --rows "$ROWS" --eval-rows "$EVAL_ROWS"
akka optimize registry datasets register support-triage/train -f data/train.jsonl
akka optimize registry datasets register support-triage/eval -f data/eval-tuned.jsonl
akka optimize registry datasets register support-triage/eval-frontier -f data/eval-frontier.jsonl
Each command prints a dataset version. The third file contains the same evaluation rows with the longer prompt an untuned model needs.
Step 2: Create a project and select a base model
Create the training project with its evaluation dataset and grader:
akka optimize training projects create support-triage --dataset support-triage/eval --grader json-label-match
akka optimize training base-models select unsloth/Llama-3.2-1B-Instruct --wait
If this model is unavailable in your deployment, choose one from akka optimize training base-models list --all and update baseModel in run.yaml. Step 4 also names the base model in its baseline command; update that reference too.
Step 3: Start training and watch it complete
The archive’s run.yaml trains for two epochs with this configuration:
kind: run
project: support-triage
baseModel: unsloth/Llama-3.2-1B-Instruct
config:
dataset: support-triage/train
method: sft
hyperparams:
lora:
rank: 8
optimizer:
learningRate: 0.0001
training:
epochs: 2
maxSeqLength: 2048
model:
precision: BF16
execution:
gpus: 1
saveEvery: 20
keepAdapters: 4
description: two epochs at rank 8
configName: r8-e2
Validate it, start the run, and wait:
akka optimize training runs start -f run.yaml --dry-run
RUN=$(akka optimize training runs start -f run.yaml -o json --jq .runId)
akka optimize training runs wait "$RUN" --exit-status
Starting asks for confirmation. While you wait, the CLI reports the phase and progress. When training completes, Results names the registered model version. Read that version into MODEL:
MODEL=$(akka optimize training runs get "$RUN" -o json --jq .modelId)
Step 4: Evaluate and compare the model
Score the trained model on held-out rows:
EVALUATION=$(akka optimize training evaluations start --model "$MODEL" \
--dataset support-triage/eval -o json --jq .evaluationId)
akka optimize training evaluations wait "$EVALUATION" --exit-status
akka optimize training evaluations report "$EVALUATION"
The report shows the mean score, unscored examples and per-field accuracy.
# Selecting the base model registered it as a version of the named model its repository
# lowercases to, so the baseline names that version.
BASE=$(akka optimize registry models get unsloth/llama-3.2-1b-instruct:latest -o json --jq .reference)
BASELINE=$(akka optimize training evaluations start --model "$BASE" \
--dataset support-triage/eval-frontier --project support-triage -o json --jq .evaluationId)
akka optimize training evaluations wait "$BASELINE" --exit-status
Read both scores:
akka optimize training projects scores support-triage
akka optimize training evaluations report "$BASELINE"
The project score table includes the trained model. The baseline uses a different prompt dataset, so read its report separately. Compare accuracy before choosing the trained model.
Step 5: Serve and call the model
Create a test endpoint. The command claims devices and asks for confirmation:
akka optimize training endpoints create --model "$MODEL" --wait
When it is ready, use its ID to send a message:
akka optimize training endpoints send ENDPOINT_ID --input "My card still has not arrived."
The command prints the model’s answer. Check that it has the expected intent label and JSON format.
Step 6: Stop the endpoint
The endpoint holds devices against your training quota. Delete it when you finish testing:
akka optimize training endpoints delete ENDPOINT_ID --wait
The command waits until the endpoint stops and releases its devices.
Next steps
-
Record your chosen model version and use it in production routing.