Fine-tune LLMs from one YAML. Layer streaming trains an 8B model on a 4 GB laptop GPU.
Python cliconsumer-gpudpofine-tuningggufhuggingfacellmllmopslocal-ailocal-llmloralow-vrammachine-learningollamapeftpythonpytorchqlorasfttransformers
docs(contributors): #1590, #1083, #1286, #1624, #1594, #1625, #1627 [skip ci]
Alpamys66cc8b9add07
diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.mdindex 341a3e7a..34d53494 100644--- a/CONTRIBUTORS.md+++ b/CONTRIBUTORS.md@@ -136,6 +136,7 @@ Listed by first contribution. PR numbers link the work.- QuEST artifacts wrote the local base's absolute path into both the sidecar and `config.json["soup_quest"]`, so every artifact disclosed a directory layout and resume depended on a path string. They replaced it with a content identity over the files Transformers actually loads, and **three review rounds each ended with every requested item closed, including the ones marked optional.** A real `soup train` found that a tool-use template edited on a relocated base was accepted, and they bound `additional_chat_templates/*.jinja` by name and content. A mutation showed renaming a template went unnoticed, and they pinned it. The Windows and POSIX sort orders disagreed, so they sorted by file name. A legacy tokenizer layout escaped the fingerprint, so they refused it the way `auto_map` is refused. Of 29 mutations, 28 fail the suite, and the survivor can only differ on Python 3.13+ ([#1162](https://github.com/MakazhanAlpamys/Soup/issues/1162), [#1176](https://github.com/MakazhanAlpamys/Soup/pull/1176))- The QuEST route accepted `training.auto_mixed_precision`, which can switch its fake-quant arithmetic to FP16 from nothing more than a substring of the base name, a precision the #674 gate never measured. **It is now refused at config load, naming both fields**, while a QuEST config without the key still loads. They took the first refusal the same evening, counted the shipped configs affected (none), and pinned the guard so that moving or widening it turns a test red; 6 of 6 mutations fail a test ([#1245](https://github.com/MakazhanAlpamys/Soup/issues/1245), [#1252](https://github.com/MakazhanAlpamys/Soup/pull/1252))- Took both optional points from the #1252 review about twenty minutes after they were raised. With more than one invalid QuEST setting, the task, backend or modality error is now reported before the auto mixed-precision refusal, and the Auto Mixed-Precision guide links to the QuEST evidence boundary. **The test pins the guard's position, not just its presence**: moving it back to the top fails 3 tests, and moving it only partway fails 2 or 1; 5 of 5 mutations fail a test ([#1252](https://github.com/MakazhanAlpamys/Soup/pull/1252), [#1276](https://github.com/MakazhanAlpamys/Soup/pull/1276))+ - Continuing from a local QuEST artifact quietly recalibrated its activation clips on the first 32 new rows. They made the warm start restore the stored calibration under the artifact loader's rule (the `config.json` declaration must equal the sidecar) and added two checks of their own: the base must not change while loading, and a non-local artifact is refused. They published the best post-fit checkpoint as a record that leads with the still-failing gate (ratio 1.038367, gap +0.0785 nat [+0.0715, +0.0860]), keeps nine negative or inconclusive follow-ups, and ships a verifier that reproduces its numbers exactly. All three review items were closed within half an hour. The new tests fail on `main` (6 of 6), and every non-equivalent mutation of the continuation branch tried over two review rounds now fails a test ([#674](https://github.com/MakazhanAlpamys/Soup/issues/674), [#1624](https://github.com/MakazhanAlpamys/Soup/pull/1624))- **Achuth Reddy Bangaru** ([@AchuthReddy-16](https://github.com/AchuthReddy-16))- `soup train --no-reexec` printed a launch command with the user's own flags dropped, so following it trained without `--fsdp` while still succeeding. Rather than patch the printed copy, they deleted it and derived the hint from the argv that actually launches the run — then, asked for a guard, wrote one whose exclusion set forces a *decision* for every new `soup train` flag instead of letting silence make it ([#415](https://github.com/MakazhanAlpamys/Soup/pull/415))- A tokenizer output that is dict-LIKE but not a registered `Mapping` was read as a sequence, so its KEYS became tokens and the error named `input_ids[0]='input_ids'` — pointing the reader at their data when the cause was the type check. They went past the reported instance to the second, quieter one: the same gate at `_apply_template_with_mask` does not raise, it silently drops `assistant_masks` and trains unmasked, so widening only the loud gate would have left the worse half in place. Also renamed the helper `data_doctor` had been importing across module boundaries under a private name ([#447](https://github.com/MakazhanAlpamys/Soup/pull/447))@@ -346,6 +347,7 @@ Listed by first contribution. PR numbers link the work.- Finished the LLaMA-Factory and Unsloth halves of `soup migrate`'s preference mapping. `pref_loss: ipo` had become plain DPO, `hinge` / `kto_pair` loaded as DPO, and four TRL trainer classes migrated as SFT, all without a warning. Each value now maps to its Soup task or stops by name, `OnlineDPOTrainer` gets a placeholder judge that loads, and `SFTConfig` hyperparameters are read. **The fourth round is the one worth copying.** Adding `SFTConfig` exposed that the notebook walk was breadth-first, so an inline SFT warm-up beat a later GRPO config, and four public Unsloth GRPO notebooks turned into SFT recipes with a 40x learning rate. They switched to a source-order walk. Unasked, they also made the config resolver handle the positional `CPOTrainer(model, args)` form and refuse a rebound config name instead of reading a stale one. 278 tests pass on the merged tree, the new tests fail 42 of 67 on `main`, and all 9 mutations run on the last two rounds' code are caught ([#1214](https://github.com/MakazhanAlpamys/Soup/issues/1214), [#1560](https://github.com/MakazhanAlpamys/Soup/pull/1560))- Removed the Web UI plugin registry that nothing rendered: `soup_cli.ui.plugins` had been importable since v0.44.0, but `create_app` never read it and a registered tab never appeared. The module, its docs section and its 11 dead tests went, exactly as the ruling listed, with `soup plugins` and `ui_env` untouched. They added a guard that keeps it gone; in review they reproduced the stale ignored `__pycache__` failure themselves before applying the suggested replacement, and they extended the route pin to every decorated Web UI path plus the static mount. 709 passed / 2 skipped across 19 files; 9 of 9 mutations caught ([#1465](https://github.com/MakazhanAlpamys/Soup/issues/1465), [#1608](https://github.com/MakazhanAlpamys/Soup/pull/1608))- Made `soup migrate --from unsloth` read real Unsloth notebooks: IPython magics were parsed as Python, so every official notebook was refused as one `SyntaxError`. Their per-cell transform treats a `!` / `%` line as a magic only at statement level. That keeps `%` / `!=` continuation lines as Python, and a magic that opens a suite becomes a `pass`, so the block stays valid. It keeps the bodies of `%%capture`-style cells, treats a backslash-continued install as one magic, and makes a real syntax error name its cell and line. All 82 official GRPO notebooks migrate (0 on `main`). On the final head 129 migrate tests pass, 217 pass on the merged tree, and 8 of 8 mutations are caught ([#1579](https://github.com/MakazhanAlpamys/Soup/issues/1579), [#1583](https://github.com/MakazhanAlpamys/Soup/pull/1583))+ - On transformers 5 the routed experts of an MoE are fused 3-D parameters, so `moe_lora` adapted attention only on Mixtral, MiniMax, Qwen2-MoE and Qwen3.5-MoE, and `moe_expert_quant` reported `applied to 0 expert Linear block(s)` as success. They found the fused parameters by shape, carried them on the resolved targets into `build_lora_config` so every MoE-wired trainer adapts the experts without a call-site change, widened the expert scan to return the fused block, and made the quant refuse it by name. Measured per family before and after; on the merged tree 4155 passed, 26 skipped across 72 related files, and removing the parameter merge fails 15 tests ([#1421](https://github.com/MakazhanAlpamys/Soup/issues/1421), [#1590](https://github.com/MakazhanAlpamys/Soup/pull/1590))- **Sohaib Kamash** ([@Nick-800](https://github.com/Nick-800))- Added seven validated Qwen2.5-Coder, Qwen2.5-Math, and DeepSeek-R1-Distill-Qwen SFT recipes; synchronized all catalog-count sites and repaired the Mistral Small model identifier. Literal repository IDs and per-recipe learning rates are now load-bearing assertions ([#536](https://github.com/MakazhanAlpamys/Soup/pull/536)).@@ -393,6 +395,8 @@ Listed by first contribution. PR numbers link the work.- Brought the "Reproducing" section of `gate-h100-validation.md` in line with the harnesses that are now published: it said no script was in the repo and linked none, so a reader following the record was told there was nothing to run. **They re-synced it the same day `graddiff.py` merged and made their own note stale**, which is the discipline that keeps a dated correction true. Each of the three reconstructions is labelled as one, the unpublished rows still point at #379, and every other cell is left as the record had it. Checked by a 19-check script (19/19, fails on `main`), 11 mutations of the section (11 killed) and 104 resolving links ([#1348](https://github.com/MakazhanAlpamys/Soup/issues/1348), [#1364](https://github.com/MakazhanAlpamys/Soup/pull/1364))- `data.format: pre_tokenized` loaded with `data.add_new_tokens`, `data.new_special_tokens`, `data.prompt_strategy` or a non-text `modality`, although `soup data preprocess` never applies any of them, so the run trained on cached ids that silently lacked the transformation. They refused each combination at config load (three `DataConfig` checks plus a `SoupConfig` validator placed after the quantization resolver), updated the `NOT_PREPROCESS_KEY_FIELDS` reasons and the docs, and after review rewrote the one refusal that stated the opposite reason and pinned it in the test. Re-run by the maintainer: the 6 new cases fail on `main`, 15 of 16 mutations killed, 1452 related tests pass ([#1273](https://github.com/MakazhanAlpamys/Soup/issues/1273), [#1363](https://github.com/MakazhanAlpamys/Soup/pull/1363))- Published the STEP 9 mechanism reproducer behind the layer-streaming NF4 record, the five-arm harness that shows the defect is aliasing of the recycled buffers and that neither the packed weights nor the quantisation state alone is enough. It took six review rounds: as first submitted it crashed on its first pooled acquire; the repair then overflowed, so its "exact" column was `inf == inf` arithmetic that happened to land on the record's counts; the clone baseline was compared against a copy of itself and could not fail; a non-finite run under `--bypass-pool` exited 1, the same code as "negative control caught"; and five verdict rules were reached by no test. **The part worth keeping is the last two rounds**: they gave the overflow its own exception and exit code 3, made the full clone match a resident run that bypasses the pools (so a clone that is 1.5x off or drifts between repetitions now exits 1), and then wrote five per-arm tests that each drive the real `main()` to the rule they name. 17 CPU tests; 14 of 17 mutations of the harness fail them, and the 3 survivors are named rather than hidden — one verdict message that a neighbouring rule makes redundant for the exit code, one display-only count and one equivalent mutant. They said plainly that they had no CUDA device to run it on ([#379](https://github.com/MakazhanAlpamys/Soup/issues/379), [#1119](https://github.com/MakazhanAlpamys/Soup/pull/1119))+ - `soup infer` was documented as batch inference but generated one prompt at a time. They added an opt-in `--batch-size` that renders each prompt through the shared template path, left-pads, generates once per batch and writes rows back in input order, with token counts that stop at the first EOS or pad, so short rows are not inflated, plus a refusal of `--cuda-graphs` above batch 1. **The review rounds were about proving order, and they got there**: their prompt-dependent pairing test, where the fake model answers from each row's own content with mixed lengths and early stops, kills the length-sort and reversed-batch mutations that position-only tests could not see. 79 tests in the two infer files (21 fail on `main`), 14 of 14 behavioural mutations killed ([#765](https://github.com/MakazhanAlpamys/Soup/issues/765), [#1083](https://github.com/MakazhanAlpamys/Soup/pull/1083))+ - Published the STEP 2b determinism reconstruction (`benchmarks/harness/determinism.py`): forward twice, backward rep 1 vs rep 3 and a trained 5-step curve twice, streamed NF4 against a resident NF4 reference, with the record's asymmetry as the verdict. Over four rounds it went from a validator of hand-written JSON (where a `null` read as the defect) to an in-process measurement. **The fix that mattered** was ordering: the historical control has to be installed before the streamed model is built, or the harness measures the repaired path. It now goes through `build_streamed_arm(..., "control", ...)` and restores the control in a `finally`, and a `main()` test pins both, so swapping in the clone arm or dropping the restore fails it. Six of its 20 CPU tests drive the real measurement path. Not run on CUDA ([#379](https://github.com/MakazhanAlpamys/Soup/issues/379), [#1286](https://github.com/MakazhanAlpamys/Soup/pull/1286))- **chadetov** ([@chadetov](https://github.com/chadetov))- First contribution, and it is the kind that is easy to file as a one-line fixture tweak and much harder to *diagnose*: `test_sft_smoke` had been red since v0.36.0, and they traced why nobody knew. `pyproject`'s `addopts` carry `-m 'not smoke'`, and the only smoke job in CI is `mlx-smoke`, which selects `-k mlx_sft_smoke` on an install that asserts the PyTorch stack is **absent** — so `test_sft_smoke` and `test_dpo_smoke` run in neither the default suite nor CI, which is how a fixture drifted out of sync with a hard error added five releases earlier. **The scope discipline is what got it merged unchanged**: the MLX fixture carries the same `format: chatml` line and they left it alone, because it reaches the MLX trainer rather than `sft_format.py` and is the one smoke test CI actually runs and passes — verified, not assumed. They also declined to wire the PyTorch smoke tests into CI in the same PR and said why (model downloads, runner minutes), leaving the call to the maintainer instead of taking it ([#594](https://github.com/MakazhanAlpamys/Soup/pull/594)). Separately, and on the same day, they measured `utils/log_level.py`'s branch coverage on #273 and filed [#595](https://github.com/MakazhanAlpamys/Soup/issues/595) — four code sites quoting a probe-denominated VRAM ratio under a "real peak" label, plus a schema field description still carrying a justification the gate record had explicitly withdrawn@@ -764,6 +768,8 @@ Listed by first contribution. PR numbers link the work.- **vaputa** ([@vaputa](https://github.com/vaputa))- First contribution: `soup data from-traces --logs session.jsonl --format soup-serve` ended in a green `Wrote 0 preference pair(s)`, exit 0 and an empty output file, because the soup-serve reader walks a directory and quietly returns nothing for a single file. They claimed the issue, took the smaller of the two proposed fixes (refuse the file at the CLI, naming `--logs`, the directory `soup serve --trace-log` writes and the `--format langchain`/`openai` alternative), added a `Read 0 trace(s) from --logs '<path>' ...` line with a per-format reason whenever a source reads nothing, and left the zero-pair exit code alone as the issue asked. **The part worth copying is the scoping**: the parser keeps the behaviour its own tests pin, two controls prove the refusal is not wider than the bug, and on review they fixed a misleading reason for a directory under a file format ("no line parsed" when nothing had been opened) in the same push. 8 tests (6 fail on `main`, the 2 controls pass), 6 of 9 mutations killed ([#1530](https://github.com/MakazhanAlpamys/Soup/issues/1530), [#1557](https://github.com/MakazhanAlpamys/Soup/pull/1557))- `soup train --task unlearn` ran every step, saved the adapter, wrote the tracker row and then died with `KeyError: 'duration'` in the completion panel, because the unlearn wrapper was the one trainer returning `duration_secs` without the formatted `duration` string. They claimed the issue first, fixed both halves (the wrapper now returns `duration`, the panel formats from `duration_secs` when a wrapper omits it and says `unknown` when both are absent, keeping a measured `0m` apart from a missing measurement), and pinned the wrapper with a stubbed-loop test and the whole trainer family with a scan. **The part worth copying is the turnaround on review**: when the first review showed that reverting the panel line left all seven tests green, they added an AST pin for the call site the same day; and when `main` moved under the approved branch twice (the unlearn loop gained gradient accumulation, the same spot in `commands/train.py` gained another function), they brought it back with one push that kept both functions and changed nothing else. The 9 tests do not collect on `main`; on the final head reverting the panel line fails 1 of them and dropping the wrapper's key fails 3; 591 neighbouring tests pass on the merged tree ([#1529](https://github.com/MakazhanAlpamys/Soup/issues/1529), [#1537](https://github.com/MakazhanAlpamys/Soup/pull/1537))+ - `training.grad_accum_auto_tune` measured VRAM pressure against a fixed 24 GB, so it could never fire on an 8 GB card and fired at 28% use on an 80 GB one. They read the card's real total memory lazily on the first advisory call, read the peak from the same device, kept an explicit `grad_accum_total_vram_gb` as an override, and put the measured numbers in the advisory. **The PR description named the one existing assertion the change had to touch, and why.** When review showed the `on_log` gate, the enabled guard and the same-device claim were not covered by any test, they added all three tests in one push. 9 of 10 mutations killed, and the tests give 7 failed on `main` ([#1620](https://github.com/MakazhanAlpamys/Soup/issues/1620), [#1625](https://github.com/MakazhanAlpamys/Soup/pull/1625))+ - `training.auto_mixed_precision` loaded on all 23 tasks, but only the SFT trainer (and `tts` through it) reads it, so a DPO, GRPO or KTO run that set it trained at its trainer's default precision and said nothing, and Autopilot's flat `generate_config` helper wrote the key for any task. They refused `true` outside a named `AMP_APPLYING_TASKS = {sft, tts}` at config load, with the field, the task and the fix in the message. `false` still loads everywhere. The validator sits between the #795 resolver and QuEST check and the unsloth refusal, the generator is scoped to the same set, and the GRPO `grpo_fp16` message, the field description and the docs were corrected. **The part worth copying is the test table**: the gate is parametrized over every value of the `task` Literal with `sft`/`tts` listed literally, so a new task is refused by default and the controls cannot drift with the constant. When review found that nothing pinned SFT keeping the field in the generator, they added that control. 7329 tests pass across 61 related files (23 of their tests fail on `main`); 8 mutations killed in the first round and 6 in the final one ([#1618](https://github.com/MakazhanAlpamys/Soup/issues/1618), [#1627](https://github.com/MakazhanAlpamys/Soup/pull/1627))- **Akshat Shah** ([@akshatshahh](https://github.com/akshatshahh))- First contribution: `http://[::1]:<port>` was accepted by the judge API-base and vLLM checks but refused by eval-gate suites, `soup ship --judge-model` and the online-DPO trainer, because three gates kept their own `("localhost", "127.0.0.1")` literal and two more kept a third copy. They made all five import `net_guard.LOOPBACK_HOSTS` and added an AST ratchet that fails on any rebuilt loopback literal, including single-quoted and multi-line spellings. Their 27 tests: 11 fail on main, 27 pass here; 7 mutations, all killed ([#1548](https://github.com/MakazhanAlpamys/Soup/issues/1548), [#1554](https://github.com/MakazhanAlpamys/Soup/pull/1554))@@ -782,6 +788,9 @@ Listed by first contribution. PR numbers link the work.- First contribution, one slice of the #1448 audit: `soup serve` dropped `--structured-output` / `--json-schema` / `--regex-pattern` and `--reasoning-parser` on streaming chat completions, so `stream: true` returned unconstrained text with the `<think>` block still in it while the same request without streaming was constrained and stripped. They claimed that one item, wired the processors, the n-gram config and the reasoning parser into the streaming path exactly as the non-streaming handler does, and stripped the text before both the SSE chunks and the trace log. **Review found that the first constraint test mocked the builder, so building for `None` (the reported bug) still passed; they added the parity test the review supplied, which drives the same app with and without `stream` and compares what the client sees and what generation receives.** 5 tests fail on `main`, 11 of 11 mutations of the constraint, n-gram and parser hand-offs are caught, and 1231 serve-related tests pass with `main` merged ([#1448](https://github.com/MakazhanAlpamys/Soup/issues/1448), [#1607](https://github.com/MakazhanAlpamys/Soup/pull/1607))- Fourth merge: a bad `SOUP_LAYER_STREAM_STRIPE_DIRS` entry was refused only when the layer-stream setup ran, after the dataset had loaded and a run row existed, and `soup train --dry-run` and `soup doctor` never checked the variable. They split the checks that need no disk probe into one helper shared by the setup path and doctor, so the setup stays the authority and the NVMe probe stays where it was; `soup train` and `--dry-run` now refuse before the prompt and the dataset load, and `soup doctor` lists each entry, sanitised, records an advisory issue for a refused one and applies the NVMe rule under `--disk`. Every gap four review rounds found became a test: 20 pass, the file cannot import on `main`, and 15 of 15 mutations of the new code fail one ([#1613](https://github.com/MakazhanAlpamys/Soup/issues/1613), [#1628](https://github.com/MakazhanAlpamys/Soup/pull/1628))+- **John Coplin** ([@johncoplin](https://github.com/johncoplin))+ - First contribution: the friendly-error formatter's `HTTP 401`/`HTTP 403` text patterns let two whitespace groups compete for the same run, so an exception message with `HTTP` followed by a long whitespace run and no status took about 13 s to print at 50,000 spaces. Since #1366, that check runs for every exception in the chain. They claimed the issue, rewrote both patterns so the optional whitespace is consumed only after a `:`/`=` separator, and added a timing test that fails on `main`. **The part worth copying is the equivalence test**: all 15 phrasings from the issue run against the old and the new pattern for both 401 and 403, so the speed-up provably changes nothing about what gets classified. 31 tests (1 fails on main), 7 of 7 mutations killed ([#1367](https://github.com/MakazhanAlpamys/Soup/issues/1367), [#1594](https://github.com/MakazhanAlpamys/Soup/pull/1594))+---Want to join this list? See [CONTRIBUTING.md](CONTRIBUTING.md) — good first issues are