Datasets

A dataset holds versioned training or evaluation examples in the artifact registry. A reference such as triage/train:v1 names an immutable version. Runs record the version they accept, so moving an alias later does not change their data.

Keep training and evaluation rows separate so that evaluation measures answers the model has not trained on.

Format

A dataset can use chat-format JSONL. Each line of chat-format JSONL contains one JSON object with a messages array of system, user, and assistant messages. The following example shows one row:

{"messages":[
  {"role":"system","content":"Extract the invoice total as JSON."},
  {"role":"user","content":"Invoice 1042, 3 items, total due 1290.00 EUR"},
  {"role":"assistant","content":"{\"total\":1290}"}
]}

Supervised fine-tuning teaches the model to produce the assistant message. A reinforcement run samples its own completions and uses the assistant message as the gold answer when the reward requires one. During an evaluation, the grader compares the model’s answer with the assistant message.

For more information about dataset formats, see the following pages:

Images

A user message can carry text and image parts, as in the following example:

{"messages":[
  {"role":"system","content":"Extract the invoice total as JSON."},
  {"role":"user","content":[
    {"type":"text","text":"Read this invoice."},
    {"type":"image","path":"images/invoice-1042.png"}
  ]},
  {"role":"assistant","content":"{\"total\":1290}"}
]}

An image path is relative to the JSONL file. The registry datasets register command uploads missing images. Use --no-upload to check for missing images without uploading or registering anything. To upload images separately, run akka optimize registry images push PATH…​.

To train on images, use SFT with a vision model and no offered tools or assistant tool calls. Graders score text.

Register a dataset

To register a dataset under a namespace and a name, run the following command:

akka optimize registry datasets register triage/train -f train.jsonl

To register a version with an alias, run the following command:

akka optimize registry datasets register triage/train -f train.jsonl --alias candidate

To read a dataset, list its versions, or list datasets in its namespace, use the following commands:

akka optimize registry datasets get triage/train
akka optimize registry datasets versions triage/train
akka optimize registry datasets list --namespace triage

The register command prints the registered version, such as triage/train:v1. Registering the same examples under the same name again returns the existing version. Changing the examples adds a version. The first registration creates the named dataset and its namespace. The --alias option points an alias at the registered version. The registry datasets alias set command moves an alias without another upload.

An upload fails after 60 seconds without progress, or if the registry takes more than ten minutes to answer after the file is sent. A larger upload can continue while it makes progress. Setting --timeout replaces these limits with one total bound for each upload.

A ZIP file can be as large as the deployment’s upload limit, which is 256 MiB unless the deployment sets another. The limit also applies to the total size of the files in a ZIP after extraction. Registration refuses a larger upload and states the limit.

The CLI automatically shards JSONL files larger than 256 MiB. If the registry reports no limit, the CLI assumes at most 1,000 shards per dataset version. To choose another shard size, use --shard-size:

akka optimize registry datasets register triage/train -f train.jsonl --shard-size 64MiB

If an upload exceeds the deployment’s limits, the refusal names a --shard-size that fits. Run akka optimize registry info to read the limits.

If a sharded upload stops, run the same command again within 7 days. It sends only the shards the registry does not already hold. A file that changed since is sent again in full.

A run plan, a pipeline stage, a training project’s evaluation settings, and an evaluation command name a dataset by registry reference. References take the following forms:

  • The reference triage/train resolves through the latest alias, which always points at the newest version.

  • The version reference triage/train:v3 names a version by number.

  • The alias reference triage/train:candidate names the version an alias points at.

  • The digest reference triage/train@sha256:…​ names a version by its digest.

A reference without a namespace names a dataset in the training project’s namespace, so in a run plan for the triage project, train is triage/train and train:v3 is triage/train:v3. A registry datasets command has no training project to read one from, so name the namespace there. References are case-insensitive: Triage/Train is triage/train.

Read a dataset’s rows

Index a dataset version’s rows before you read them, as you analyze a dataset before you train on it. To index a version, run the following command:

akka optimize training datasets index triage/train --wait

Indexing uses no GPUs. Running the command again for the same rows returns the same index. After you upgrade Optimize, an existing index stays readable. If a later Optimize version indexes chat rows or preference pairs in a new format, the command indexes them again, and reads use the existing index until the new one is done. Prepared token rows are not indexed again. A prepared row’s text is the text the Optimize version that built the index decoded.

Once the index of chat rows or preference pairs is done, the command prints what the rows carry, counted over the whole version:

  • the rows with tool calls, and the tools called by the most rows;

  • the rows with images, in any message, and how many images;

  • the rows of text alone, which carry neither tool calls nor images;

  • the turns a row holds, as the median and the longest. A turn is one user message and the replies that follow it.

A preference pair is counted by its prompt, and the command also prints how many pairs differ in their answers' tool calls and how many differ only in text. Prepared token rows get no counts.

To page through the rows, run the following command:

akka optimize training datasets rows triage/train

The command prints each row with its position. A chat row shows its messages, tool calls and tool results. A preference pair shows the prompt and both answers. A prepared token row shows its text with the trained tokens between [[ and ]]. A row that occurs more than once in the version says how often and where.

A version with no index prints the command that indexes it. To see which versions of a namespace are indexed, which are being indexed and how far each has come, and which failed, run akka optimize training datasets indexes triage:

akka optimize training datasets indexes triage
INDEX         DATASET          KIND  STATUS   ROWS          FORMAT  STARTED
8a1f3c5e7b9d  triage/train:v2  chat  Running  1240 of 2400  1       3h2m ago
5d8e1a0c3b7f  triage/train:v1  chat  Done     2000          1       3h30m ago
1 to 2 of 2 indexes.

To read one row in full, with each text whole up to 1,048,576 characters, use --position, as in akka optimize training datasets rows triage/train --position 12.

Use the following options to choose rows:

  • --offset and --limit choose the page. A page holds 25 rows unless --limit says otherwise, and at most 100. The command prints the --offset of the next page.

  • --search finds the rows that hold its words one after another within one message, in any case, across the whole version. A search that reads many rows prints the --offset to go on from.

  • --trained-only shows only the text a prepared row trains on, each part after the 400 characters before it.

  • --repeated lists only the rows that occur more than once.

  • --tool-calls, --images and --text-only list only the rows that carry tool calls, carry images, or carry neither, as the index counted them. A preference pair is filtered by its prompt. --tool-calls and --images together list the rows that carry both. The page says exactly how many rows match. An index built by an earlier Optimize version holds no such lists, and the command prints how to index the rows again.

  • --model shows each chat row’s token length under a base model, once training datasets analyze has measured the dataset under it. See Dataset analysis.

The following example searches the examples:

akka optimize training datasets rows triage/train --search arrived --limit 2
Dataset   triage/train:v1
Rows      Chat rows, 2000
Repeated  6 rows in 3 groups
Lengths   use --model BASE_MODEL to read each row's length from a dataset analysis
Showing   2 rows, positions 112 to 417
Next      --offset 418

Row 112  examples.jsonl line 112
  system: Classify the banking support message as one intent. Answer with JSON.
  user: My new card arrived but the app says it is still on its way.
  assistant: {"intent":"card_arrival"}

Row 417  examples.jsonl line 417, occurs 2x (rows 417, 1530)
  system: Classify the banking support message as one intent. Answer with JSON.
  user: The card arrived today. How do I activate it?
  assistant: {"intent":"activate_my_card"}

A text longer than 16,384 characters is shown as its start and its end, with the number of characters left out between them. Use -o json for the whole page as Optimize sends it.