Fine-Tuning JSONL Validator
Validate OpenAI or Anthropic fine-tuning JSONL row by row for schema, role order, token counts and duplicates, with per-row issues and summary stats.
Fine-Tuning JSONL Validator
Summary
3 rows: 3 valid, 0 with errors, 0 with warnings
| Line | Roles | Tokens | Issues |
|---|---|---|---|
systemuserassistant | 38 | ok | |
systemuserassistant | 43 | ok | |
userassistant | 23 | ok |
What this tool does
Validate supervised fine-tuning JSONL for OpenAI or Anthropic line by line in your browser: JSON parsing, message schema, role ordering, per-row token counts, and duplicate detection — no upload. The provider toggle matters: Anthropic expects the system prompt as a top-level system string, while OpenAI expects it as the first entry in the messages array.
Updated . Provided as is. Check the output before you rely on it in production.
How to use Fine-Tuning JSONL Validator
- 1
Pick the target provider
Switch between OpenAI and Anthropic. The validator applies provider-specific schema rules — Anthropic puts system prompts at the top level while OpenAI inlines them as the first message.
- 2
Paste your JSONL
Drop one record per line into the input area. Empty lines are skipped. Use the Load sample button to see the expected structure for the selected provider.
- 3
Review the per-row report
Each row shows its detected roles, token count from gpt-tokenizer, and any schema or ordering issues. Filter the table by errors or warnings to focus on problem rows.
- 4
Resolve duplicates and shape issues
The summary panel surfaces duplicate groups, token distribution, and total error and warning counts. Fix consecutive-role warnings and missing assistant turns before kicking off a fine-tune job.
Questions and answers
Which providers are supported?
How are token counts computed?
How does duplicate detection work?
Does it send my data to a server?
Can it catch role-ordering bugs?
For AI agents: how to call this tool
Machine-readable contract, endpoints and examples. Humans can ignore this section.
Best Path For Builders
Browser workflow
Runs instantly in the browser with private local processing and copy/export-ready output.
Browser Workflow
This tool is optimized for instant in-browser execution with local data handling. Run it here and copy/export the output directly.
/fine-tuning-jsonl-validator/
For automation planning, fetch the canonical contract at /api/tool/fine-tuning-jsonl-validator.json.
How do I validate a JSONL file for OpenAI or Anthropic fine-tuning?
Pick the provider, paste the JSONL, and read the report. Every non-empty line is parsed as its own JSON object and checked against that provider's chat-format rules; failures show the exact line number, an issue code, and the raw row, so you fix the offending records instead of resubmitting a job blind.
Step by step
- Select OpenAI or Anthropic — the two formats differ, and a file that is valid for one fails the other.
- Paste your JSONL, or load the sample to see the expected shape.
- Read the summary: rows, valid, errors, warnings, duplicates, and token totals with average, minimum, and maximum per row.
- Click any row to expand its issue codes and raw JSON; filter the table to errors or warnings only.
- Fix the flagged lines in your dataset and re-paste until errors reach zero.
Format rules this validator enforces
| Rule | OpenAI | Anthropic |
|---|---|---|
| Row shape | JSON object with a messages array | Same, plus optional top-level system string |
| System prompt | Role system inside messages; warned if not first | Top-level only — a system role inside messages is an error |
| Allowed roles | system, user, assistant, tool, function | user and assistant only |
| Minimum content | At least 2 messages per row, including at least one assistant message — the training target | |
| Ordering | Consecutive same-role messages warn; last message expected to be assistant | First message expected to be user; consecutive same-role messages warn |
Rules as implemented in this validator's checks. Provider requirements evolve — treat the provider's own fine-tuning documentation as canonical for anything not listed here.
Which issues are errors and which are warnings?
Errors break the format: unparseable JSON, a missing messages array, an invalid role, missing content, or no assistant message at all. Warnings flag rows that load fine but train poorly: a system message that is not first, two same-role messages in a row, a final message that is not from the assistant, and exact duplicates of an earlier line — duplicate rows skew the loss toward repeated examples.
How are the token counts computed?
With the gpt-tokenizer o200k encoding, loaded lazily in the browser because its BPE table is around 2 MB. Until it finishes loading, counts fall back to a characters-divided-by-four estimate, then recompute exactly. Use the min/max spread to spot outlier rows — a single giant example can dominate a training epoch or exceed the per-example context limit.
Is my training data uploaded?
No. Parsing, validation, and token counting all run in the page; nothing is transmitted or stored. Fine-tuning datasets are typically distilled from production prompts and real user conversations, which is exactly the data you should not paste into a tool that phones home.