Fine-tune JSONL Validator
Validate chat fine-tuning datasets and inspect local token estimates
About
Paste one chat fine-tuning sample per line to validate JSON syntax and message schemas. Switch between OpenAI and Anthropic formats to catch role and turn-order issues, then inspect deterministic line-level token estimates and role statistics.
Examples
Invalid JSON on line 2
validateFinetuneJsonl('{"messages":[...]} \nnot-json\n {"messages":[...]}')errors: [{ line: 2, type: "invalid-json" }], totalSamples: 3The bad line is pinpointed by number while valid lines still contribute role stats.
Anthropic alternation warning
validateFinetuneJsonl('{...two user messages...}', "anthropic")warnings: [{ line: 1, type: "alternation" }], errors: []Consecutive user messages warn about alternation but the sample still validates.
About this tool
Finetune JSONL Validator checks one-JSON-object-per-line training files with validateFinetuneJsonl(source, mode) (aliases buildFinetuneJsonlValidation, analyzeFinetuneJsonl): openai mode accepts system/user/assistant/tool roles, while anthropic mode requires user/assistant alternation with an optional separate system string and warns on consecutive same-role messages.
Every failure is tagged with a 1-based line number: unparseable lines become invalid-json, unknown roles become role errors, and structural problems become schema errors. An empty file reports an empty-file error at line 0, and a single trailing newline is ignored rather than counted as a sample.
Per-line stats (chars, estimatedTokens via chars/4, per-line roles) roll up into statistics with totalSamples, validSamples, invalidSamples, roleDistribution, and averageMessageLength. All validation runs in the browser, so training data never leaves the device.
How to use this tool
Paste JSONL and pick a mode
Put one sample object per line and choose openai or anthropic depending on the target API.
Fix errors by line number
Work through invalid-json, role, and schema errors using each finding's line field.
Resolve anthropic warnings
Reorder consecutive same-role messages into user/assistant alternation; keep system text in system.
Check role distribution
Confirm the role counts and average message length look right before exporting the file.
Use cases
Pre-flight before a fine-tune job
Catch malformed lines and bad roles locally instead of failing a billed training run.
Converting to Anthropic format
Surface non-alternating sequences and misplaced system roles before upload.
Auditing dataset balance
Use roleDistribution and average message length to spot skewed or truncated samples.
Common mistakes
Mistake:Using a role outside system/user/assistant/tool.
Fix:Anything else (e.g. developer, moderator) is a role error — map it to one of the four supported roles.
Mistake:Counting a trailing newline as a broken sample.
Fix:One final newline is stripped automatically; only genuinely non-empty bad lines produce errors.
Mistake:Putting system instructions inside messages for Anthropic.
Fix:Anthropic samples allow only user/assistant in messages — move system text to the top-level system string.
Frequently asked questions
What does this tool do?
It validates one-JSON-object-per-line training files with validateFinetuneJsonl (aliases buildFinetuneJsonlValidation, analyzeFinetuneJsonl): openai mode takes system/user/assistant/tool roles, anthropic mode enforces user/assistant alternation with a separate system string.
How are errors reported?
Every finding carries a 1-based line number — invalid-json for bad lines, role for unknown roles, schema for structural issues, and empty-file at line 0. A single trailing newline is ignored, not counted as a sample.
Is my training data uploaded or stored?
No. All validation and role-distribution stats run entirely in your browser.
What does the Anthropic alternation warning mean?
Consecutive same-role messages warn (e.g. two user turns in a row) without failing validation; reorder into user/assistant alternation and keep system text in system.
Related guides
References & standards
Related tools
Agent Tool Flowchart Builder
Design agentic tool-call DAGs with decision branches and bounded loops. Validates reachability, cycle handling, and emits clean Mermaid flowcharts — fully in your browser.
AI Agent Memory & Buffer Simulator
Compare sliding window, summary buffer, and vector memory strategies
AI API Client SDK Generator
Generate typed API client SDK files from OpenAPI specifications or cURL requests
AI Code Explainer
Explain code snippets with grounded cloud AI
AI Code Security Auditor
Scan source code for high-confidence OWASP Top 10 vulnerabilities
AI Code Translator
Translate code into idiomatic implementations in another language