Skip to content
Owais KhanSoftware Reviews

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. Thischatgpt 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)

ModelEst. 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 errors1

  • 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 validatorwithout 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, andgpt-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 validatorbefore 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.

Frequently asked questions

Why does OpenAI reject my JSONL fine-tuning file without detailed logs?
OpenAI's fine-tuning API performs schema validation server-side and often returns only a generic error message, making it hard to pinpoint which line or message object caused the rejection. Common culprits include missing "messages" arrays, invalid role values (anything other than system, user, or assistant), consecutive messages with the same role, and examples that contain no user or no assistant turn at all. This validator checks every one of those rules locally and reports the exact line number and message index so you can fix the file before uploading it.
Is my fine-tuning dataset stored or sent to a server during validation?
No. The entire validation engine runs as an inline script inside this page. Your JSONL text is parsed and checked entirely within your browser's JavaScript engine — no data is transmitted anywhere. There is no backend, no API call, and no logging. The site's automated test suite scans the shipped HTML for every browser API capable of sending data off the page and fails the build if it finds one, so this guarantee is enforced structurally rather than just promised.
How do I check token counts and estimate costs for GPT-4o fine-tuning?
Paste your JSONL dataset into the validator and it will compute an approximate token count for every example using the cl100k_base heuristic (roughly 4 characters per token, the same approximation OpenAI's own cookbook uses). The summary shows total, minimum, maximum, and average tokens per example. The cost table then multiplies total tokens by each model's published per-1 000-token training rate and by your chosen epoch count, giving you side-by-side estimates for gpt-4o-2024-08-06, gpt-4o-mini-2024-07-18, and gpt-3.5-turbo before you commit to a run.
What are the mandatory role alternation rules for OpenAI chat fine-tuning?
OpenAI's chat fine-tuning format requires that each example in your JSONL contains at least one "user" message and at least one "assistant" message. The "system" role is optional and, if present, should appear only at the start. Consecutive messages sharing the same "user" or "assistant" role are flagged as errors because the model expects turns to alternate — two user messages in a row with no assistant reply in between is not a valid conversational pattern. The auto-fix option in this tool merges consecutive same-role messages by concatenating their content with a newline.
Is anything I paste uploaded or processed on a server?
No. The validation logic is bundled directly into this page as an inline script, so everything runs inside your browser without any network requests. Your dataset — which may contain proprietary training examples, internal knowledge-base content, or sensitive domain data — never leaves your machine. Everything runs locally: what you paste never leaves your browser.