> ## Documentation Index
> Fetch the complete documentation index at: /docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Train your first model

> Split 10 support tickets into train, validation, and test parts, then train and download a Model Version.

Split 10 support tickets into 8 training rows, 1 validation row, and 1 test row. Then train a model and download its Model Version: the files a completed Training Run produces.

Commands print IDs that you paste into later commands. Values that differ on your account appear as `…` or `YOUR_…`: IDs, timestamps, token counts, charges, and project counts.

This tutorial uses project Training through the CLI.

## Before you start

You need:

* macOS or glibc Linux on ARM64 or x64. Native Windows and musl Linux standalone releases are not available.
* A Toloka account on a team. You sign in through your browser; no API key is needed.
* A funded team balance. Calculating the estimate is free, but a Training Run uses the balance. See [Manage your team and balance](/docs/core/teams-and-balance.md#top-up).
* A browser signed in to [Toloka Platform](https://platform.toloka.ai) so you can identify your team.

This tutorial starts a paid Training Run. Stop after Step 7 if you only want to validate the data and see the maximum charge.

## Step 1 — Install the CLI and sign in

Install the latest CLI release:

```sh theme={null}
curl -fsSL https://platform.toloka.ai/cli/install.sh | sh
toloka --version
```

The standalone CLI includes its runtime, so this tutorial needs neither Bun nor an SDK project dependency. Rerun the installer for an immediate update; there is no `toloka update` command. If the installer asks you to add a folder to `PATH`, do so and rerun `toloka --version`.

Sign in through your browser:

```sh theme={null}
toloka login
```

Choose **Sign in with your browser**, select your provider on the page that opens, finish sign-in, and allow the Toloka CLI when asked the first time.

Check the connection:

```sh theme={null}
toloka whoami
```

The `Account` line names the signed-in account. The `Project` line is empty until you create the project below. See [CLI](/docs/cli.md) for noninteractive authentication and installation troubleshooting.

## Step 2 — Find your team ID

Open [Toloka Platform](https://platform.toloka.ai) and sign in. After choosing a team, the browser address contains:

```text theme={null}
https://platform.toloka.ai/teams/YOUR_TEAM_ID/projects
```

Copy the part between `/teams/` and `/projects`.

> [!NOTE]
>
> If you land in the earlier workspace first, follow the workspace-switching step in [Get your first labeled dataset](/docs/data/get-started/first-labeled-dataset.md), then return here.

## Step 3 — Create the project

A project holds the dataset, Training, and resulting Model. Billing goes to its team.

Open a new, empty folder in your terminal, then run:

```sh theme={null}
toloka project create first-training --name "First training" --team-id YOUR_TEAM_ID
toloka project current
```

`project create` selects the project and writes `toloka.json` in the current folder. Run the rest of the tutorial from this folder.

## Step 4 — Save the training data

A dataset is a collection of items. The CLI calls items rows. Each line below is one chat containing a support ticket and its label.

Save these 10 rows as `support-tickets.jsonl`:

```json theme={null}
{"messages":[{"role":"user","content":"Hi, how do I reset my password? I can't find the option anywhere."},{"role":"assistant","content":"question"}]}
{"messages":[{"role":"user","content":"This is the third time my order arrived damaged. I'm furious."},{"role":"assistant","content":"complaint"}]}
{"messages":[{"role":"user","content":"Just wanted to say your support team was incredibly helpful today, thank you!"},{"role":"assistant","content":"praise"}]}
{"messages":[{"role":"user","content":"What are your business hours on weekends?"},{"role":"assistant","content":"question"}]}
{"messages":[{"role":"user","content":"The app keeps crashing every time I open the checkout page. Please fix this."},{"role":"assistant","content":"complaint"}]}
{"messages":[{"role":"user","content":"Amazing product, it has saved me hours every week. Great job!"},{"role":"assistant","content":"praise"}]}
{"messages":[{"role":"user","content":"Can I change the shipping address after placing an order?"},{"role":"assistant","content":"question"}]}
{"messages":[{"role":"user","content":"I was charged twice for the same subscription and nobody is responding."},{"role":"assistant","content":"complaint"}]}
{"messages":[{"role":"user","content":"Do you offer student discounts?"},{"role":"assistant","content":"question"}]}
{"messages":[{"role":"user","content":"The new dashboard update is fantastic, much easier to use now."},{"role":"assistant","content":"praise"}]}
```

Each final assistant turn contains the expected label: `question`, `complaint`, or `praise`. Keep all 10 rows in one file. The Training command will split this new dataset into 8 training rows, 1 validation row, and 1 test row.

Check that the file has 10 lines:

```sh theme={null}
wc -l support-tickets.jsonl
```

## Step 5 — Create and upload the dataset

Create the empty dataset, upload the file once, and list the project datasets:

```sh theme={null}
toloka dataset create support-tickets
toloka dataset upload support-tickets ./support-tickets.jsonl
toloka dataset list
```

The upload prints `Uploaded 10 rows to dataset support-tickets.` Uploads append, so a second run adds the same 10 rows again. Copy the `ds.…` dataset ID from `dataset list`.

To inspect the project and dataset in the web app, print its address:

```sh theme={null}
toloka project url
```

## Step 6 — Create the Training

A Base model is the catalog model your Training starts from. List the available entries:

```sh theme={null}
toloka base-model list
```

This tutorial uses `qwen3-4b`, the smallest catalog Base model.

A Training is an editable draft that records the Base model, frozen dataset slice, split column, and settings. Create one named `First training`:

```sh theme={null}
toloka training create "First training" \
  --base-model qwen3-4b \
  --dataset ds.YOUR_DATASET_ID
toloka training get trg.YOUR_TRAINING_ID
```

The command creates the default 80/10/10 split and freezes a slice named `First training`. Copy the `trg.…` Training ID from the create command. **Method** is `Supervised fine-tuning (SFT)`. **Output Model** is `-` because no Training Run has been created yet. SFT is the default, so this command does not pass `--method`.

## Step 7 — Review the cost estimate

A cost estimate is free. It validates the frozen Training inputs and shows the most the Training Run can cost.

```sh theme={null}
toloka training cost trg.YOUR_TRAINING_ID --json > estimate.json
```

Open `estimate.json` and require `status: "ready"`. Review its training row count, token count, maximum GPU seconds, and `maximumCharge`. Expect 8 training rows and 1 validation row; the remaining test row is kept out of learning. The `fingerprint` identifies this exact estimate; keep the file for the next step.

If the estimate is blocked, the command exits with code 1 and prints `Training cannot run with these inputs:` followed by one line per problem. Fix every issue, then calculate again. See [Training errors](/docs/train/reference/errors.md#cost-estimate-errors).

> [!WARNING]
>
> The next step starts a paid Training Run and places a hold for the saved estimate's maximum charge. Do not continue until you accept that amount. If the estimate is rejected or expires, calculate and review a new one before retrying.

When the Training Run settles, it charges for billable GPU use up to the maximum and returns the rest of the hold. See [Training cost](/docs/train/concepts/cost.md) for minimum charges and no-charge cases.

## Step 8 — Start and watch the Training Run

A Training Run is one billed execution of the Training. Start it:

```sh theme={null}
toloka training run trg.YOUR_TRAINING_ID --estimate-file estimate.json
```

The command uses the saved estimate and names the future Model Version `First training`. Copy the `trn.…` Training Run ID.

Follow the logs, then check status:

```sh theme={null}
toloka training logs trn.YOUR_RUN_ID --follow
toloka training status trn.YOUR_RUN_ID
```

Status normally moves from `queued` to `running` to `completed`. While it is `running`, the **Progress** row shows the current phase. Status `completed` with revision `1` means the Model Version is published. **Charged amount** is the settled cost and is no greater than the approved maximum charge.

If status is `blocked` with reason `funds`, the team balance cannot cover the hold. Add funds, then run:

```sh theme={null}
toloka training resume trn.YOUR_RUN_ID
```

Nothing is charged if the Training Run stops before training begins.

## Step 9 — Download the Model Version

The first Training Run creates a Model named `First training`; completion publishes revision 1 in that Model. List its versions:

```sh theme={null}
toloka model versions "First training"
```

Copy the `mdv.…` ID, then download the files:

```sh theme={null}
toloka model version download mdv.YOUR_VERSION_ID --out ./first-training-model
```

The folder contains `adapter_model.safetensors`, `adapter_config.json`, and possibly additional validated `.json` files. Together they form a LoRA adapter that needs the matching Qwen3 4B Base model. The Model Version records the Base model ID, not a pinned upstream repository/revision; see [Pinned revisions and lineage](/docs/train/reference/base-models.md#pinned-revisions-and-lineage) before serving it. The download command verifies every file's size and SHA-256.

The platform does not host or serve the model.

## Next steps

* [How Training works](/docs/train/concepts/how-training-works.md) — Training drafts, estimates, runs, and Model Versions
* [Fine-tune a model](/docs/train/guides/fine-tune.md) — use the workflow with your own labeled conversations
* [Compress a prompt with gisting](/docs/train/guides/gist.md) — use the other Training method
* [Prepare training data](/docs/train/guides/prepare-training-data.md) — build valid examples from project data
* [Datasets](/docs/core/datasets.md) — understand project datasets
* [CLI](/docs/cli.md) — commands, flags, and sign-in options


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.