Skip to content

Data Forge & Quality Moat (v0.47.0)

soup data forge — synthetic data pipeline

Chunk → judge → active-prune → JSONL with provenance.

bash
# Smoke test of the plumbing only: no model runs, every answer is a canned placeholder line.
soup data forge --docs ./docs --output ./synth.jsonl --task sft --target-rows 100

# Real synthesis needs a live judge backend.
soup data forge --docs ./docs --output ./synth.jsonl --task sft --target-rows 5000 \
  --judge-provider ollama --judge-model llama3.1 --provenance ./provenance.json

Without --judge-provider nothing is generated. The default judge is a deterministic offline stub that writes Synthesised answer (offline): ... as every assistant turn and exits 0. --teacher is only a label recorded in the provenance manifest (as judge_id); it never loads or calls a model, so a stub run still names whatever you passed. --judge-provider takes ollama (localhost only), anthropic (key from ANTHROPIC_API_KEY) or vllm. --hub modelscope|modelers pre-fetches --teacher only when it is an owner/name repo id.

--task picks the shape of what comes out: sft, preference or tool. --provenance writes a separate manifest, a single JSON document (not JSONL) of {version, row_count, records} where each record is {row_id, source_doc, judge_id, chunk_id, filter_score}, so a generated row can be traced back to the document it came from. The rest tune the pipeline: --uncertainty-threshold for the active-prune step, --max-chunk-chars for chunking, --judge-model / --judge-base-url for the judge, and --hub hf|modelscope|modelers for where the teacher is pulled from.

--docs is a directory under the working directory (not a symlink). Soup reads the .txt, .md, .json and .jsonl files directly inside it, in name order, up to 10,000 of them and at most 4 MiB of text each. It does not descend into sub-folders and it skips names that start with a dot and symlinks; PDF and DOCX files are not read, so convert them first with soup data ingest. A directory with no such file stops with no documents found under '<name>'. Defaults: --task sft, --target-rows 100 (1 to 1,000,000), --max-chunk-chars 1000 (1 to 64,000), --output forge_dataset.jsonl, --provenance forge_provenance.json, --teacher local-judge, --judge-model llama3.1.

Each row carries provenance (source doc, chunk id, judge id, filter score).

--output and --provenance must not be an input (since v0.77.2). soup data forge refuses an --output or --provenance that is the same file as --docs or as any document in it, and refuses --output and --provenance that are the same file as each other, before any document is read, with exit 1 (#2226, #2274 by @kok-o). The refusal text no longer starts with Plan failed:; a --provenance that collides reads --provenance '...' is the same file as --docs ...; choose a different --provenance (run on v0.77.2 with -o and --provenance inside the --docs directory). At v0.77.1 forge was not among the eighteen commands that refuse an output that is an input, and upstream listed it as not checked yet; that item is closed. See Data tools.

A failed judge call never becomes a row (v0.76.0). A call that fails (a transport error, a non-200 status, a malformed reply) or returns an empty reply is dropped, whatever --uncertainty-threshold is. The summary reports N of M judge calls failed for --judge-provider <name> (<endpoint>); first error: .... A partial outage keeps the rows that succeeded and prints the panel as Data Forge — synth complete with judge failures, with a Judge calls: N of M failed line. If no usable row was produced the command prints No usable rows produced and exits 1 without writing the dataset or the provenance file. --judge-base-url has no effect for anthropic: every call goes to https://api.anthropic.com, and the error label names that origin.

Warning:

Re-run this. Through v0.75.2 a failed judge call came back as empty text, was scored as maximally uncertain so that no --uncertainty-threshold could prune it, and was written as a row with an empty answer, after which the command printed synth complete and exited 0. A dataset made by soup data forge --judge-provider ... while the provider was down or rate-limiting can therefore hold rows with an empty assistant turn. Filter for them, or regenerate. (The same release closed the equivalent hole in soup data augment and soup distill-prompt; see Data augmentation.)

soup data score — composite quality scorecard

PII + an abuse-keyword heuristic (not a toxicity classifier) + langdetect + educational value. The Decontaminated cell reads not run (no benchmark texts) unless you supply comparison texts.

bash
soup data score --input ./train.jsonl
soup data score --input ./train.jsonl --benchmark-file ./benchmark.jsonl --threshold 0.8

The plain run prints a table with the rows PII flagged, Abuse-keyword flagged, Edu mean, Decontaminated (not run (no benchmark texts) until you supply a file) and one lang:<code> row per language found. The scorecard reports PII matches, abuse-keyword matches, the language mix and mean educational value.

What the six quality commands read (v0.77.0). soup data score, pii, toxicity, langdetect, educational and decontaminate read text with the same extractor as soup expect: plain text and content, Alpaca instruction, input and output, prompt, chosen, rejected and completion, ShareGPT and ChatML turns, embedding fields and the text of tool-call arguments (#2037). They warn with a count when some rows have no extractable text (Warning: 1 of 2 input rows have no extractable text), and stop with exit 1 before reporting or writing anything when no row has text or the file has no rows (no extractable text in 2 input rows). The detectors themselves are unchanged.

Warning:

Re-run this (v0.77.0). Through v0.76.1 these six commands read only text, content and messages[].content, so in upstream's words they "scanned alpaca, preference and ShareGPT rows as empty and reported them clean": such rows reported Flagged: 0 and Edu mean 0.000, "and a {prompt} benchmark file removed nothing" (#1427, #2037). Scan alpaca, DPO, KTO or ShareGPT data again, and re-train a model whose training set relied on a decontamination against a benchmark file of prompt rows.

An output that is an input is refused (v0.77.1). pii, toxicity, langdetect, educational and decontaminate write to pii.jsonl, toxicity.jsonl, langdetect.jsonl, educational.jsonl and clean.jsonl in the current directory unless you pass --output; soup data score prints its table and writes no file. Through v0.77.0 an input with one of those names was replaced and the command exited 0; in upstream's words, the original could not be recovered. Since v0.77.1 each of the five refuses an --output that is the same file as --input (for decontaminate, also as --benchmark-file), under any spelling, before the data is read: --output 'pii.jsonl' is the same file as --input 'pii.jsonl'; choose a different --output, exit 1 (#2245). An input that carries one of those default names now stops the command with that message and is left as it was; name a different file with --output. The rule covers eighteen soup data commands in all; see Data tools.

Decontamination is opt-in and breaking (v0.76.0, #1448). Through v0.75.2 the cell was a fixed 0, which read as a measurement. Now it is not run unless --benchmark-file <jsonl> supplies your own comparison texts (a file under the working directory; since v0.77.0 each row's text, prompt, Alpaca, preference or conversation fields count, and, for soup data decontaminate, a file with no text in any row exits 1; --threshold is the overlap threshold, default 0.8). soup data score is stricter about this file: it reads it in strict mode and every row must yield at least one 8-gram of text (eight or more words), otherwise it exits 1 with --benchmark-file: row N has no usable 8-gram text, naming the first offending row, and a malformed line is refused the same way; soup data decontaminate only warns (Warning: 1 of 2 benchmark rows have no extractable text) and uses the usable rows, and exits 1 only when no row has text. --benchmarks / -b (mmlu, gsm8k, humaneval, truthfulqa, arc, hellaswag) are labels that are validated and nothing more: they do not select rows of that file, and they now require --benchmark-file, so soup data score --input f.jsonl -b mmlu alone exits 1 with score --benchmarks labels need --benchmark-file; benchmark corpora are not bundled. Soup bundles no benchmark corpora. A zero obtained with a file describes only those texts, not the absence of contamination against public benchmarks. Use soup data decontaminate --benchmark-file for real overlap removal.

Each filter is also addressable individually:

  • soup data decontaminate --input ./train.jsonl --benchmark-file ./benchmarks/eval_sets.jsonl — drop rows whose n-grams overlap a benchmark file you supply. Since v0.77.0 each benchmark row's text, prompt, Alpaca, preference or conversation fields count, and a benchmark file with no text in any row exits 1 (no extractable text in N benchmark rows); through v0.76.1 a prompt field was not read, so such a file loaded zero texts and removed nothing, with exit 0. Soup bundles no benchmark corpora: --benchmarks gsm8k alone only records a label and removes nothing, and with neither option the command exits 1. The kept rows go to clean.jsonl by default (an input named clean.jsonl is refused since v0.77.1).
  • soup data toxicity — an abuse-keyword heuristic, labelled as one since v0.76.0 (--help: "Run an abuse-keyword heuristic (not a toxicity classifier)"); the panel is titled Abuse-keyword heuristic. It is not a toxicity classifier and no classifier backend ships. Ambiguous technical terms such as a process kill no longer count on their own. In upstream's published maintainer review of this scorer, 9 of 10 held-out abusive examples scored zero and 10 of 12 benign technical or editorial examples were flagged at the default threshold, so use it for keyword triage only, never as a safety decision. The [data-pro] extra adds langdetect and Presidio only; it does not install Llama Guard or FineWeb-Edu
  • soup data langdetect — 2-letter language code per row
  • soup data pii — flag email / phone / SSN / credit-card patterns
  • soup data educational — educational-value score per row [0, 1]

A nan threshold is refused (v0.78.0, #2917). soup data score --threshold, soup data decontaminate --threshold, soup data toxicity --threshold and soup data forge --uncertainty-threshold take a float in [0.0, 1.0] and now refuse nan, as they refuse inf and 1.5, with a usage error (exit 2, nan is not in the range 0.0<=x<=1.0.) before any input is read. Checked on the v0.78.0 binary for all four. The same refusal covers soup data validate --min-valid-fraction (exit 3) and soup draft measure --min-acceptance (exit 2).

Train/evaluation overlap is a different command. soup data decontaminate drops training rows whose n-grams overlap benchmark texts you supply. To count how many rows of an evaluation file have exactly the same input text as some training row, without writing or filtering anything, use soup data leakage (v0.78.0, exact matching only; exit 0 clean, 2 on overlap, 3 on unusable input), documented under Data tools.

Soup is free and Apache-2.0. If it saved you a training run, starring the repo costs nothing and helps most. You can also fund the GPU time behind the work a 4 GB laptop cannot reach.