Openai Fine Tuning Jsonl Validator
Paste your openai fine tuning jsonl format dataset and get instant line-by-line error reports, token counts, and cost estimates — all without uploading anything. This chatgpt fine tuning dataset validator checks role alternation, required fields, and schema rules that the OpenAI API enforces but rarely explains clearly.
Everything runs locally: what you paste never leaves your browser.
Validate your OpenAI fine-tuning JSONL dataset
Summary
- Lines parsed
- 4
- Valid examples
- 3
- Errors found
- 1
- Total tokens (est.)
- 148
- Avg tokens / example
- 37
- Min / Max tokens
- 30 / 44
Cost estimates (3 epochs)
| Model | Est. cost (USD) |
|---|---|
| gpt-4o-2024-08-06 | $0.0111 |
| gpt-4o-mini-2024-07-18 | $0.0013 |
| gpt-3.5-turbo | $0.0036 |
Token counts use the cl100k_base approximation (~4 chars = 1 token). Actual costs may vary.
Validation errors 1
- Line 4: Line 4, message[1]: Consecutive "user" messages detected — roles should alternate.
How to validate openai training data online
The openai fine tuning jsonl format requires each line to be a self-contained
JSON object with a single top-level key, "messages", whose value is an array of
message objects. Every message must have a "role" (one of system,
user, or assistant) and a "content" string. This
validator checks every one of those constraints line by line and reports the exact position
of each violation.
Token counting uses the cl100k_base heuristic — the same approximation used in OpenAI's own fine-tuning cookbook — making this a practical tiktoken jsonl dataset validator without requiring a server-side tiktoken installation. The estimate is clearly labelled so you know it is approximate; real token counts from the API may differ by a few percent.
jsonl token counter openai — how the math works
Each example's token count mirrors the num_tokens_from_messages function from
OpenAI's cookbook: 3 base tokens per example, 4 overhead tokens per message (for role and
framing), plus the character-length of the role string and content string each divided by 4.
The total across all examples is then multiplied by your chosen epoch count and by the
per-1 000-token training rate for each model to produce the cost estimate table.
Cost rates are hard-coded from OpenAI's published pricing as of mid-2024:
gpt-3.5-turbo at $0.008 / 1 K tokens,
gpt-4o-mini-2024-07-18 at $0.003 / 1 K tokens, and
gpt-4o-2024-08-06 at $0.025 / 1 K tokens. No network request is made to fetch
live prices — the page has no outbound connections at all.
Auto-fix: what it changes and what it cannot
Enabling auto-fix applies a set of safe, reversible transformations to a deep clone of your
data. It strips unrecognised top-level keys (only "messages" is allowed),
trims trailing whitespace from message content, removes empty system messages, and merges
consecutive same-role messages by joining their content with a newline. The original text in
the input box is never modified. Lines with JSON syntax errors cannot be auto-fixed and are
passed through unchanged.
Auto-fix does not invent missing user or assistant turns, does not reorder messages, and does not alter content beyond whitespace trimming. If an example is structurally broken in a way that requires semantic judgement — for example, a conversation with only system messages — the error is reported and the line is left for you to correct manually.
Why the OpenAI API gives vague rejection messages
When you submit a fine-tuning job, OpenAI validates the uploaded file server-side and may cancel the job with a message like "Invalid training file" without specifying which line failed or why. Running your dataset through a chatgpt fine tuning dataset validator before uploading catches the common schema errors — missing assistant turns, invalid roles, consecutive same-role messages — that trigger those opaque rejections. The line numbers reported here map directly to the lines in your file, so you can jump straight to the problem rather than scanning thousands of examples by eye.