Toloka Training produces a Model Version that you download. Deploying it and generating predictions are jobs for the inference tooling you operate. The scorer on this page is a local Python script, not a built-in Toloka Evaluate product.
Before you start
You need:- A Data Labeling pipeline with a text input named
ticket_textand a resolved string output namedintent. - At least 12 completed, labeled items for the small split in this walkthrough: 2 for local evaluation and at least 10 to upload for Training. Exact duplicate prompts stay together, so you need more rows if a duplicate group leaves fewer than 10 to upload. A production evaluation needs a larger set that represents the data you expect to see.
- The Toloka CLI installed, signed in, and set to a project where your credentials can create and upload datasets, create Trainings, and deploy Training Runs. For browser login, use a team with Full access; switch teams if needed. For an API key, check CLI permissions.
- A funded team balance. Cost estimation is free; starting a Training Run is billed.
- Python 3.9 or later for the local conversion and scoring scripts.
- Your own compatible serving stack for the downloaded model files.
1
Label the examples
Build and run a pipeline that receives
ticket_text and returns intent from its End node. For example, intent might be one of question, complaint, or praise.Get your first labeled dataset covers the complete pipeline cycle. Check that each completed item’s intent is question, complaint, or praise and correctly labels its ticket_text.2
Export one finished pipeline run
Open the run’s Items tab and create an export as described in Export your labeled results. Download the JSON file after the export reaches The conversion ignores all status values other than
completed.Create the export after the run finishes: the file will not include results produced later. The converter uses each entry’s index, status, input.ticket_text, and output.intent:completed. See Export format for the complete entry contract.3
Create training and evaluation partitions
Follow Prepare training data from labels to save The converter assigns exact duplicate prompts to the same partition and makes the selection deterministic. It writes:
prepare_label_export.py. Then run:Open all three files. Confirm that the indexes in the two evaluation files match each other and that the training rows contain assistant labels while the evaluation inputs do not. The training file deliberately omits source indexes; use the converter’s printed counts to inspect the partition rather than adding indexes or golden labels to a model request.
4
Upload only the training rows
Create a dataset in the selected project and upload the training partition:Copy the
ds.… ID printed by dataset list. Uploads append, so run the upload once unless you deliberately want duplicate examples.Each uploaded line has the supported message shape:evaluation-inputs.jsonl has no assistant answer, so it is not a training dataset. evaluation-gold.jsonl is not uploaded at all.5
Create and price the fine-tuning run
List the current Base models, create an SFT Training, and calculate a free cost estimate:Copy the
trg.… Training ID from training create. The cost command validates the chat rows and saves the estimate to estimate.json. Open that file, require status: "ready", and review maximumCharge before continuing. training create creates an 80% train, 10% validation, 10% test split for this new dataset and freezes a slice. With the minimum 10 uploaded rows, expect 8 training rows and 1 validation row; 1 test row stays out of learning. All three parts remain separate from the local golden set.Fine-tune a model explains the settings, states, billing behavior, and failure messages in detail.6
Run Training and download the Model Version
When you accept the saved estimate, start one Training Run with that estimate and follow it to completion:Copy the The SFT result is a LoRA adapter Model Version. Your serving stack must load it with the matching Base model. Use the downloaded version for the next step, not the unchanged Base model by itself.Training metrics such as validation loss and validation token accuracy describe results on the validation part. They do not replace the task-level exact-match evaluation below.
trn.… ID from training run. A completed run publishes a Model Version. List and download it:7
Generate predictions with your serving stack
Deploy the downloaded model files with tooling you operate.For every line in There must be exactly one prediction for every evaluation index. Do not hand-correct a response before writing it; the purpose is to measure what the deployed Model Version actually returned.
prepared/evaluation-inputs.jsonl:- Send only the
messagesvalue to the deployed trained model. - Record the model’s actual response without looking up the matching golden label.
- Write the response with the same
indextopredictions.jsonl.
8
Score the actual predictions locally
Save the following as Run it against the hidden answers and the predictions produced in the previous step:If one of two predictions is correct, it prints:The script refuses to score a partial or mismatched set of indexes. For a real decision, use enough held-out examples for every important class; two rows only demonstrate the mechanics.
score_predictions.py: