---
title: "Preview tokenized data"
method: POST
path: "/fine-tunes/preview"
tags: ["Fine-tuning"]
---

# Preview tokenized data

`POST /fine-tunes/preview`

Preview how sampled rows from a fine-tuning training file will be tokenized before packing.

## Request body

- FineTunePreviewRequest — Request body for previewing tokenized fine-tuning data.
  - `model` string, required — Name of the base model whose tokenizer and chat template will be used.
  - `training_file` string, required — File-ID of the uploaded JSONL training file to sample for preview.
  - `training_method` 'sft' — Fine-tuning method to preview. Only supervised fine-tuning is currently supported.
  - `train_on_inputs` boolean — Whether prompt or user-message tokens should contribute to training loss in the preview.
  - `top_k` integer — Maximum number of rows from the start of the training file to tokenize.

## Response `200`

Tokenized data preview generated successfully

- FineTunePreviewResponse — Tokenized preview for sampled rows from a fine-tuning training file.
  - `model` string, required — Name of the base model used to tokenize the sampled rows.
  - `dataset_format` 'general' | 'conversation' | 'instruction', required — Detected SFT dataset format for the sampled rows.
  - `max_seq_length` integer, required — Maximum sequence length configured for the requested model.
  - `train_on_inputs` boolean, required — Whether prompt or user-message tokens contribute to training loss.
  - `rows` FineTunePreviewRow[], required — Tokenized preview rows, in the same order as the sampled training file rows.
    - `input_ids` integer[], required — Token IDs produced for the sampled row.
    - `tokens` string[], required — Raw token strings produced for the sampled row.
    - `labels` integer[], required — Training labels for each token; masked tokens use -100.
    - `trained_spans` array[], required — Half-open token index ranges that contribute to training loss.
      - integer[] — Start and end token indexes for one trained span.
    - `num_tokens` integer, required — Total number of tokens in the preview row after truncation.
    - `num_trained_tokens` integer, required — Number of tokens in the row that contribute to training loss.
    - `truncated` boolean, required — Whether the row was truncated to the model maximum sequence length.

## Other responses

- `400` — Invalid request or unsupported dataset for preview.
- `401` — Unauthorized
- `404` — Training file not found.
- `500` — Internal Server Error
- `502` — Preview service unavailable.
- `503` — Preview service is at capacity.

---

[API](https://skmtc.net/together/apis/together-apis.md) · [All operations](https://skmtc.net/together/apis/together-apis/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/together/together-apis/revisions/3ad4ab328948/schema)
