OpenAI Fine-tuning JSONL Validator

Validate JSONL datasets in the OpenAI fine-tuning chat format line by line, checking the messages structure, role validity and user/assistant completeness, and reporting sample counts with an estimated token total.

FreeOnline Tool
Loading…

How to Use

  1. Paste your JSONL dataset into the input box, or click "Upload file" to pick a local .jsonl file
  2. Click "Validate" (pasting also triggers a run); the tool parses every line and checks it against the OpenAI fine-tuning chat format rules
  3. The summary panel at the top shows total lines, passed/failed line counts, total message count and an estimated total token count
  4. The per-line result list below marks each line as passed or failed; failed lines spell out the exact reason, for example "Line 3: messages[1].role is not a valid value"
  5. Click "Load sample JSONL dataset" to see a demo containing both valid samples and several kinds of broken ones

Features

  • Purpose-built for the OpenAI fine-tuning chat format: each line must be a JSON object containing a messages array
  • Checks every message individually: role must be one of system, user or assistant, content must be a string, and each line must contain at least one user message and one assistant message
  • Precise per-line errors: reports the exact line number plus the exact field path (such as messages[1].role or messages[0].content) instead of a vague "format error"
  • Reports total lines, passed/failed lines, total messages and an estimated token count (approximation: roughly 4 characters per token for English, roughly 1.7 characters per token for Chinese — labeled as an estimate, not real tokenizer output)
  • How it differs from the site's jsonl-viewer tool: jsonl-viewer is a general JSONL viewer with search and tree browsing and performs no format validation, while this tool is a rule checker dedicated to the OpenAI fine-tuning chat format and offers no tree browsing or search

Use Cases

Pre-flight check before submitting a dataset
Validate the JSONL file locally before uploading it to the OpenAI fine-tuning platform so a formatting mistake does not fail the job.
Pinpointing which line is broken
On a large dataset, jump straight to the offending line number and field path instead of eyeballing every record against the spec.
Estimating dataset token size
Get a rough token total before launching a fine-tuning job to gauge training cost or decide whether to trim the data.
Checking for missing conversation roles
Confirm that every training sample contains both a user question and an assistant reply, so one-sided samples do not slip through.

FAQ

How is this different from the jsonl-viewer tool on this site?
jsonl-viewer is a general-purpose JSONL viewer with tree browsing, search and raw/formatted switching, and it validates nothing. This tool is a rule checker built specifically for the OpenAI fine-tuning chat dataset format and only does compliance checking (messages structure, role validity, user/assistant completeness), with no tree browsing or search. They serve different purposes and work well together.
Is the token count accurate?
No, it is an approximation. It uses the rule-of-thumb ratios of about 4 characters per token for English and about 1.7 characters per token for Chinese, so it will deviate from OpenAI's official tokenizer (such as cl100k_base). Treat it as a rough sense of scale, never as a precise basis for billing or training-cost estimates.
Which roles are accepted?
Only the three roles defined by the OpenAI chat format: system, user and assistant. Any other role name, such as function or tool, is reported as invalid.
Are blank lines in the file treated as errors?
No. Completely blank lines are skipped automatically and excluded from the total line count, so trailing or in-between empty lines will not trigger errors. Reported line numbers still use the real physical line number in the file so you can jump straight to it in your editor.