Convert a CSV dataset into fine-tuning JSONL
The CSV → JSONL Converter maps the columns of a CSV dataset onto the JSON
Lines format that LLM fine-tuning APIs expect. Choose between the modern chat
messages format and the classic prompt/completion pair, map your columns,
preview the result, and download a clean .jsonl file.
How it works
The tool parses your CSV with a quote-aware parser, so commas, newlines, and
escaped quotes inside fields are handled correctly. You then map each output
field to a CSV column. In chat mode it builds a messages array with an optional
system message and the user/assistant turns; in prompt/completion mode it emits
{ "prompt": ..., "completion": ... }. Each CSV row becomes exactly one line of
the output file — the structure fine-tuning APIs read one example at a time.
Output format examples
Chat format
{"messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "How do I reset my password?"}, {"role": "assistant", "content": "Go to the login page and click Forgot password."}]}
Prompt / completion format
{"prompt": "Translate to French: Good morning", "completion": "Bonjour"}
Each line is one self-contained training example. The file must have no blank lines between them.
Tips for high-quality fine-tuning datasets
- Keep one training example per row. If a real conversation spans multiple turns, flatten it into a single
messagesarray with alternating user/assistant entries — do not split it across multiple CSV rows. - Use a consistent system message. For chat fine-tuning, a stable system prompt anchors the model’s persona and task framing across all examples.
- Aim for quality over quantity. Fifty well-crafted examples outperform five hundred noisy ones. Clean outliers and contradictions before training.
- Spot-check the preview before downloading. A wrong column mapping produces a syntactically valid but semantically useless file — the fine-tune will succeed and the model will learn the wrong thing. Verify that the user and assistant columns map to the right CSV columns.
- Balance classes if classifying. For classification tasks represented as chat examples, unbalanced label distribution in the JSONL causes the model to favour the majority class.
Validating your JSONL file
Before uploading to a fine-tuning API, validate the file with:
# Check every line is valid JSON (requires Python)
python3 -c "
import json, sys
with open('train.jsonl') as f:
for i, line in enumerate(f, 1):
line = line.strip()
if not line:
print(f'Line {i}: empty — remove blank lines')
continue
try:
json.loads(line)
except json.JSONDecodeError as e:
print(f'Line {i}: {e}')
"
The most common validation errors are:
- Blank lines — JSONL files must have no empty lines between records.
- Wrong field names — the chat format requires
messages(plural);message(singular) is silently ignored by some APIs. - Missing required roles — chat format requires at least one
userturn and oneassistantturn per example.
Download is generated in-browser via a Blob, so your data never leaves the page.