Best-of-N & Evol-Instruct (v0.71.31)

Two soup data subcommands that put an LLM judge in the loop to build training data, the data side of the v0.71.31 judge-in-the-loop suite.

No competitor (Unsloth, Axolotl, LLaMA-Factory, OpenPipe) ships this as an integrated CLI suite.

soup data best-of-n — rejection sampling (BOND-lite)

Sample N completions from a base model, let a judge score each one, keep the winner as a clean SFT row. With --emit-pairs it also writes winner-versus-loser DPO pairs, so one pass bootstraps both an SFT set and a preference set.

bash
soup data best-of-n --base HuggingFaceTB/SmolLM2-135M-Instruct \
    --prompts prompts.jsonl --n 8 --judge ollama://llama3.1 \
    -o best_of_n.jsonl --emit-pairs pairs.jsonl
FlagDefaultMeaning
--baserequiredModel to sample from (loads locally; bounded by your GPU).
--promptsrequiredPrompt JSONL (cwd-contained, symlink-rejected).
--judgerequiredJudge URL, SSRF-validated.
--n8Candidates per prompt (2..64).
-o, --outputrequiredSFT output JSONL; each row carries a _best_of_n provenance object (n, winner_idx, judge_model, scores).
--emit-pairsoffAlso write winner-vs-loser DPO pairs to this path.
--temperature1.0Sampling temperature (0..2).
--max-new-tokens256Tokens per candidate (1..4096).
--seed0Sampling seed.
--plan-onlyoffPrint the plan and exit without sampling.

Judging is pointwise (one judge call per candidate, argmax), so cost scales with --n.

soup data evolve — Evol-Instruct (WizardLM)

Grow instruction diversity by mutating seed prompts, completing the synthetic-data suite (Magpie, Forge, Persona, evolve). depth deepens an instruction (adds constraints, concretizes, adds reasoning steps); breadth creates a new sibling instruction in the same domain.

bash
soup data evolve --input seeds.jsonl --provider ollama --model llama3.1 \
    --strategy depth --rounds 2 -o evolved.jsonl
FlagDefaultMeaning
--inputrequiredSeed instructions JSONL.
--providerrequiredollama or vllm (the raw-completion providers; anthropic is rejected).
--modelrequiredGenerator model id.
--strategydepthdepth (deepen) or breadth (diversify).
--rounds1Evolution rounds (1..5).
-o, --outputrequiredEvolved output JSONL.
--max-tokens512Generation budget (1..16384).

Each round evolves every live instruction and drops empty, unchanged, or meta-prompt-echo outputs; if a round eliminates everything, the previous generation carries forward.

Security

Both write atomically (mkstemp + os.replace) with cwd containment re-validated to close a symlink-swap window; every judge / provider URL is SSRF-validated; --base loads with trust_remote_code=False (probe + warn); dataset-derived text is escaped before it is echoed. Prompts / seeds are capped at 100,000 rows.

See also