Anti-trend Insurance (v0.68.0)
Five-bet hedge against paradigm shifts. If prompt engineering keeps winning, soup compile keeps you covered. If prompt costs wall out, soup distill-prompt migrates the system prompt into weights. soup compile-tools does the same trick for tool descriptions. soup apple-adapter converts HF and MLX adapters, with Apple FoundationModels (iOS 26+) directions that are accepted but refuse until Apple publishes the adapter format. And soup local-rl builds a personal-LLM feedback flywheel from thumbs-up/down on your own machine.
soup compile — DSPy + GEPA + TextGrad prompt-program compiler
soup compile ./program.py --eval ./examples.jsonl \
--optimizer mipro --max-iters 500 --output ./compiled_program.pyClosed optimiser allowlist of 5: mipro, gepa, textgrad, copro, bootstrap_fewshot. Hard bound MAX_COMPILE_ITERS=1000.
--output must stay under the working directory and must not be a symlink. Since v0.76.0 that is checked at plan time, before the optimizer and its LLM calls start: a destination outside the working directory or a symlink exits 2, and --plan-only refuses it too instead of printing the plan (#1445). Through v0.75.2 the whole optimization ran first and the path was refused at the end with an unhandled ValueError (exit 1).
--eval is a JSON or JSONL file of example objects: a JSON array, a single object, or one object per line. YAML is not parsed. The plan step only checks that the path stays under the working directory, so --plan-only prints a clean plan for a .yaml suite (or for a file that does not exist), and the loader then keeps only lines that parse as JSON objects, which gives zero examples from a YAML file. The output is a compiled Python program (--output, default compiled_program.py), not JSON.
validate_program_pathrequires.py, cwd containment,os.lstat + S_ISLNKrejection via sharedpaths.enforce_under_cwd_and_no_symlinkCompileResultenforces finite-score (no NaN / ±Inf), iterations ≥ 0- Module is
commands/compile_cmd.pybecausecompileis a Python builtin - Live as of v0.71.13 (behind the
[compile]extra) —run_compiledispatches DSPy / GEPA / TextGrad;soup compile-toolsoptimises tool schemas too;--plan-onlystill renders the plan and exits 0 - Since v0.77.0 the eval suite reaches the optimizer (#1810, #1956):
soup compileandsoup compile-toolspass the eval suite's signal, the metric derived from it and the iteration bound to DSPy, TextGrad and GEPA, andsoup compileprintsScore: unmeasuredfor a result with no measured score. Before this release they did not, so a program compiled on an earlier version was not optimised against your suite: compile it again. A livesoup compilenow also exits 2 unless the program supplies what its optimizer uses: TextGrad a backward engine (enginein the program, ortextgrad.set_backward_engine(...)), GEPA atask_lmor anadapter, and the DSPy optimizers a callablemetricwhen the eval suite gives no examples.
soup distill-prompt — long prompts → small fine-tunes
soup distill-prompt --traces ./traces.jsonl \
--teacher llama3.1:70b --student llama3.2:3b \
--strategy sft --output ./dataset.jsonl--teacher and --student are model names in the provider you choose, not Hugging Face repo ids: --provider is ollama by default (or vllm or anthropic, with --base-url for the first two), so the example uses Ollama tags. The teacher is called once per trace; the student is called only for the preference strategy, where it supplies the rejected side. A call that fails, returns a malformed reply or returns empty text never becomes a row, and since v0.76.0 it is counted (#1274). If the run writes no rows because calls failed (a wrong model name, a provider that is down), the command prints No usable rows produced: N of M provider calls failed for --provider <p> (<endpoint>); first error: ... and exits 1. A partial outage keeps the successful rows and ends with a yellow done with provider failures panel carrying a Provider calls: N of M failed line; read it before you train on the file. (Through v0.75.2 a failed call was skipped without a message, so a wrong model name finished with Rows: 0, an empty output file and exit 0, and a partial outage looked like a clean run.)
A traces file with no prompt in it is refused (since v0.77.2, #2209, by @akkupratap323). When no trace row has a prompt Soup recognises, the command stops before any provider call with No prompts found in traces: 0 of N trace rows had a prompt ..., naming what it looked for (a non-empty string under prompt, input, instruction, question or query, or a user turn with string content in messages), exits 3 and leaves --output as it was; run here on a two-row file, the existing output file kept its contents. The v0.77.2 notes describe the old result as "empty output written" (exit 0); if a script ran this command on v0.77.1 and kept the file, look at it. When only some rows have no prompt, upstream's documentation says the done panel counts the rows skipped for want of a prompt.
--temperature sets the sampling temperature of the teacher and, under preference, the student (default 0.0, allowed 0 to 2, otherwise exit 2; this is checked when the run starts, so --plan-only does not reject it). --max-rows N stops once N rows have been written (a positive integer; by default every trace is used). It counts rows written, not model calls, so a prompt that gets no usable reply still costs a call. --plan-only prints the plan and calls no model.
Closed strategy set {sft, preference, kl}. Teacher / student IDs capped at 512 chars; null-byte + empty rejected. Composes with v0.71 cross-tokenizer ULD. Live as of v0.71.13 (behind the [compile] extra) — prepare_distill_dataset calls the teacher once per trace via the v0.20 providers and emits sft/kl messages or preference chosen/rejected pairs.
soup compile-tools — textual gradients over tool descriptions
soup compile-tools ./spec.json --eval ./eval.jsonl --optimizer textgrad --engine gpt-4o
soup compile-tools ./spec.json --eval ./eval.jsonl --optimizer gepa --task-lm <model>Spec extension allowlist {.json, .yaml, .yml} (case-insensitive on Windows). TextGrad / GEPA optimise tool descriptions so model picks them more accurately. Since v0.77.0 TextGrad needs a backward engine (--engine, or one you set in TextGrad yourself), and GEPA a task model (--task-lm; --reflection-lm defaults to it); without them a live run exits 2 (No backward engine configured for TextGrad. Pass --engine <name> ..., GEPA optimizer requires --task-lm to be specified.), while --plan-only still prints the plan and exits 0. Through v0.76.1 the TextGrad path stepped an optimizer with no engine and the eval signal never reached it, so re-run tool descriptions compiled on an earlier version. Composes with v0.46 Agent Forge — Agent Forge parses the spec, ToolCompile optimises descriptions.
soup apple-adapter — HF ↔ MLX ↔ Apple FoundationModels
soup apple-adapter ./adapter \
--direction hf-to-mlx --output ./mlx-adapter --signClosed direction allowlist of 4: hf-to-mlx, mlx-to-hf, hf-to-apple, mlx-to-apple. Explicit S_ISDIR + symlink rejection on source. sign must be real bool (bool-as-int defence). Reuses v0.60 Part B signing infrastructure and extends the v0.25 MLX backend. Live as of v0.71.21 — convert_apple_adapter does the PEFT ↔ mlx-lm round trip for hf-to-mlx / mlx-to-hf (real bf16 adapter smoke); the *-to-apple directions stay upstream-gated until Apple's on-device adapter spec settles: they are accepted by the allowlist and then refuse with exit 3 ("no stable public spec yet"), so only hf-to-mlx and mlx-to-hf convert anything.
--sign here uses the unsigned backend: it writes .soup-signature.json with a Merkle root over the output files, so it detects later tampering but carries no ed25519 signature and says nothing about who produced the files, even though the summary prints "Signed: True". For a real signature run soup adapters sign ./mlx-adapter --backend ed25519 --key <key.pem> on the output.
soup local-rl — personal-LLM feedback flywheel (LIVE)
# The DB path must stay under the current working directory: a ~ path is refused.
soup local-rl init --db ./local.db
soup local-rl record --db ./local.db \
--prompt "summarise my last commit" --response "..." --thumb up
# or let the served model fill the same DB for you:
soup serve --model ./output --record-thumbs ./local.db
soup local-rl status --db ./local.db
soup local-rl harvest --db ./local.db --output ./pairs.jsonl
soup train --config dpo.yaml # point data.train at ./pairs.jsonl- You do not have to call
recordby hand.soup serve --record-thumbs <db>turns onPOST /v1/thumbsand writes into this same database, which is the edge that closes the loop: serve, collect, harvest, train. Path contained under cwd, transformers backend only (since v0.78.0--record-thumbswith--backend vllm,sglangormiiis refused with exit 2 once the[serve]extra is installed, where it was ignored; on a core install the missing-extra message comes first, exit 1). soup loop watchreads the same database since v0.77.0 (#1440, #1832): with the pre-wired stages, setsoup loop init --thumbs-db ./local.db(orSOUP_LOOP_THUMBS_DB) and its harvest adds the thumbs pairs to the trace pairs. See Soup Loop.- POSIX
0o600SQLite,interactions+thumbstables (idempotentCREATE TABLE IF NOT EXISTS) - Parameterised inserts, 16 KiB prompt + 16 KiB response caps, null-byte rejection
harvestwalks thumbs byts ASC, emits oneDpoPair{prompt, chosen, rejected}per prompt with both an up and down (last-writes-win dedup), atomic JSONL write viatempfile.mkstemp + os.replace. Since v0.78.0 (#2521 by @kok-o)harvest, the nightly local-RL training and the pre-wired loop skip a prompt whose latest upvote and downvote carry identical responsessoup local-rl trainis live as of v0.71.13 —--onceharvests the latest thumbs DPO pairs and runs a real nightly DPO/KTO/ORPO train via asoup trainsubprocess (astatetable skips re-runs with no new feedback or fewer than--min-pairs); without--onceit renders an injection-safe systemd.service/.timer+ launchd.plistscheduler scaffold- Since v0.76.0 the scaffold carries the
--min-pairsand-oyou passed (#1448); through v0.75.2 the nightly job ignored them and used the defaults (10 pairs,local_rl_adapter/), so regenerate unit files you installed earlier. A--min-pairsthe nightly run would refuse exits 2 before any unit file is written --train-method ktowritesbatch_size: 2into the generated config, becausetask: ktois refused below a batch of 2 (#1420)--backendis accepted for compatibility, is validated, and has no effect on training: passing it printsNote: --backend has no effect on training.and it is not rendered into the scheduler scaffold (#1678)
Numbers
+204 tests in v0.68.0 (11,021 → 11,225) across 6 new test files. 2 POSIX-only symlink tests skip on Windows.
See also
- Data engineering pro (v0.69) —
soup build+soup expectbuild on the same TOCTOU helper consolidated here. - Loop hardening (v0.70) — cross-tokenizer ULD pairs with
soup distill-prompt. - MLX backend — what
soup apple-adapterextends.
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.