Skip to content

armgit / Soup

Public Imported from GitHub
0

Fine-tune LLMs from one YAML. Layer streaming trains an 8B model on a 4 GB laptop GPU.

docs(contributors): #1626, #1630, #1646, #1656, #1657 [skip ci]

Alpamys7d55d21996fc
diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md
index 6d4e9965..61128b78 100644
--- a/CONTRIBUTORS.md
+++ b/CONTRIBUTORS.md
@@ -217,6 +217,8 @@ Listed by first contribution. PR numbers link the work.
- The Auto-Eval section of `docs/evaluation.md` showed the `eval` extra's install command with no lead-in while the benchmark bullet still said "install the dependencies required by your environment", and its `trust_remote_code` bullet stated only half the rule. They added the lead-in, pointed the bullet at the extra, and made the trust bullet say it holds even with `soup train --trust-remote-code` and how to evaluate a custom-code base by hand, plus a pointer in the `--trust-remote-code` Coverage list; docs only, and the behaviour it describes is pinned by an existing test that fails if auto-eval opts in ([#1642](https://github.com/MakazhanAlpamys/Soup/issues/1642), [#1659](https://github.com/MakazhanAlpamys/Soup/pull/1659))
- Carried #1504's resume fix to the other TRL trainers: resuming DPO, IPO, GRPO or Reward on a quantized base upcast the bf16 adapter to fp32 because only SFT restored the dtype after `_load_from_checkpoint`. One guarded `keep_trainable_dtype_on_resume` call per wrapper, and tests that drive each wrapper's own `train()` so a removed call is caught per wrapper; 4 of the new cases fail on main, 12 mutations (three per wrapper), 12 killed ([#1573](https://github.com/MakazhanAlpamys/Soup/issues/1573), [#1660](https://github.com/MakazhanAlpamys/Soup/pull/1660))
- Removed the `eval_config` that `SoupTrainerCallback` accepted and stored but no code had read since auto-eval moved to `soup train`, together with the builder's pass-through. The two tests that had asserted the dead attribute were rewritten to check the fields the callback really uses, one of them through `GRPOTrainerWrapper.train()`. A second round added an absence assert in each, because restoring the old callback still passed: now that mutation fails 2 tests, the same 2 fail on `main`, and 564 tests across the callback test files pass on a trial merge with `main` ([#1643](https://github.com/MakazhanAlpamys/Soup/issues/1643), [#1654](https://github.com/MakazhanAlpamys/Soup/pull/1654))
+ - `soup autopilot` recommended `mxfp4` for a pre-quantized MXFP4 base whatever the budget, although such a base loads dequantized to bf16, so a 20B model written out for a 16 GB card could only fail at load. It is now budgeted at 2 bytes per parameter, read from the hardware-fit table so the two estimators share one figure, and a smaller `--gpu-budget` is refused with a message that names the dequantization. The second round turned a test that any figure between about 0.8 and 2.4 bytes per parameter would pass into a boundary test at 39.9 / 40.0 GB: 6 of 6 mutations killed, including the shared table entry, against 1 of 5 before ([#1653](https://github.com/MakazhanAlpamys/Soup/issues/1653), [#1656](https://github.com/MakazhanAlpamys/Soup/pull/1656))
+ - `training.lora.use_dora: true` loaded on `backend: unsloth` and `backend: mlx`, where no DoRA adapter is ever built, so the run quietly trained plain LoRA. It is now refused at config load, through the same variant gate as `use_vera`, while mlx with a Quant Menu format keeps its own refusal. Review asked for one docs sentence and suggested a stricter test `match`, and the stricter match proved load-bearing: rewording the refusal message now fails the test, where the original pattern let it through. When the comment they added turned out to break a source-splitting test elsewhere, they reworded it in one push. 1977 related tests passed on the merged tree, and 7 of 8 mutations were killed (the eighth is an equivalent mutant) ([#1651](https://github.com/MakazhanAlpamys/Soup/issues/1651), [#1657](https://github.com/MakazhanAlpamys/Soup/pull/1657))
- **AmixDigital** ([@Amix29](https://github.com/Amix29))
- Gave `soup monitor` a real Apple Silicon path, where it had reported nothing but an NVIDIA-shaped blank since v0.44.1. The security work is the part worth naming: fixed absolute executable paths so `PATH` cannot influence what runs, `sudo -n` that never prompts and never reads a password, stderr pattern-matched for permission markers but never printed, and a parser that returns `[]` against a billion-laughs entity bomb, an XXE `file:///` reference, 5,000-deep nesting and embedded NUL bytes. **Three guards had no test holding them up and they closed all three in twenty minutes** — most importantly the call site that decides which implementation every Linux and Windows user gets, where `if True or detect_apple_silicon()` had left 126 tests passing. Their oversize-payload test had also been asserting on `b"x" * (CAP + 1)`, which is not a valid plist and returns `[]` whether the cap exists or not; they rebuilt it around a valid oversized document. The test file shrank by 18 lines and **every deletion was an upgrade** — membership assertions became adjacency assertions. Asked to confirm the live plist schema, they said plainly that the Mac is not theirs and they cannot authenticate `sudo`, rather than guessing — while confirming the two things they could check against the real binary ([#481](https://github.com/MakazhanAlpamys/Soup/pull/481))
@@ -572,6 +574,7 @@ Listed by first contribution. PR numbers link the work.
- A Bearer token containing a non-ASCII character made the Web UI's token check raise `TypeError`, so the request failed with a 500 and a traceback on the server console instead of a 401. **The header is now compared as UTF-8 bytes through one constant-time helper used by both auth paths**, pinned by a spy test that fails if the comparison ever becomes `==`, and a guard that walks the whole package for a `compare_digest` call on a str. They took both requested changes and both optional ones in one push ([#1195](https://github.com/MakazhanAlpamys/Soup/issues/1195), [#1246](https://github.com/MakazhanAlpamys/Soup/pull/1246))
- The hardware-fit gate sized Hub models from a fixed marker list and called anything else 7B, so a 72B, 405B or 675B base was budgeted as 7B and let through to OOM on Linux or spill on Windows. Substring hits made it worse: `a3b` read as 3B, `11b` as 1B, `17b` as 7B. They replaced the list with a boundary-safe size parse, handling `8x7B` MoE totals, Llama 4 `17B-16E` active-plus-expert names, `-A22B` active tokens and OLMoE's active-first `1B-7B`. On the 91 catalog bases with a known real count, estimates within 10% went from 34 to 61, and 2x-or-worse under-predictions from 40 to 16. **What made it trustworthy was the yardstick**: the catalog test now checks real parameter totals rather than recipe labels, so a label wrong in the same direction as the estimate (Scout's "17B", DeepSeek-V3-0324's "7B") can no longer hide one. A reverse check keeps both tables in step with the catalog, which is how #1132's repointed ids were caught and fixed in the rebase rather than drifting. Three review rounds, every requested and optional item taken; 24 of 24 mutations fail a test ([#1198](https://github.com/MakazhanAlpamys/Soup/issues/1198), [#1285](https://github.com/MakazhanAlpamys/Soup/pull/1285))
- `mistral-medium-3-5-sft` could not attach LoRA: its base is a `mistral3` vision-language wrapper, but the recipe had no `modality: vision` (so `AutoModelForCausalLM` rejected `Mistral3Config`) and `target_modules: auto` had no `mistral3` row. **They measured the real key names on the meta device before choosing the pattern**, so the row is a language-tower regex (8 modules adapted on a 2-layer skeleton, 0 in the Pixtral vision tower, where a plain suffix list would have adapted 16), left `ministral3` out as the issue asked, removed the recipe's `EXCEPTIONS` pin, and after review named the real Hub repo in the changelog, documented the row, built the stand-in on the real `Ministral3Config` and relabelled the tests that only document alternatives. 20 of 30 new tests fail on clean main, seven mutations caught, `recipes verify` moves from 0 attach to 1 attach ([#1395](https://github.com/MakazhanAlpamys/Soup/issues/1395), [#1482](https://github.com/MakazhanAlpamys/Soup/pull/1482))
+ - A sink-based ratchet for outbound HTTP calls: the #616 guard found gates by their shape, so a differently written gate, or no gate at all, passed unchecked, and `energy.py` had its own loopback set that missed abbreviated IPv4 and `100.64.0.0/10`. They built the inverted scanner the issue asked for, and it **improved under review rather than merely passing it**: the first version saw 20 of 46 spellings of an outbound call, the two-pass one sees 45 (the missing one, an untyped client passed in as a parameter, is stated as a limit in the docstring); the table is keyed by qualified name with an exact call multiset, so a second call inside a declared function fails; and every declared gate is checked to exist and to be called (review had found four entries that named functions that do not exist). When review showed that the inert list held classes that open a connection, they removed the names rather than argue. `validate_electricity_map_endpoint` now goes through `net_guard`. 363 tests passed on the final head and 1361 on the tree merged with main, and 51 mutations were run on it, 42 caught ([#1547](https://github.com/MakazhanAlpamys/Soup/issues/1547), [#1646](https://github.com/MakazhanAlpamys/Soup/pull/1646))
- **Harsh Raj Singhania** ([@HarshRajSinghania](https://github.com/HarshRajSinghania))
- First contribution. With six of seven `[train]` packages installed, `soup doctor` announced `Training stack not installed` and recommended `pip install "soup-cli[train]"` — a command that is a no-op for the six already satisfied. `group_missing` flipped on the first absent member, so **the usual broken install, one missing wheel, was reported as no install at all**. A partial stack now names what is missing. The same patch gates the NVIDIA wheel-tag hint on torch actually being absent: with torch present on a CUDA box that hint explains how to obtain a CUDA build of a package you already have, and it was printing anyway. **What decided this over a competing patch was the test.** The wheel-tag gate had a mutation that survived on the earlier head — dropping `and torch_missing` changed nothing any test could see — and they added `test_doctor_nvidia_partial_stack_with_torch_present`, after which that mutation fails exactly one test and no others. The assertion is `"index-url" not in out` rather than a specific sentence, which catches the hint appearing in either `issues` or `fix_pre`; a sentence match would have missed the duplicate line. They also took a consolidation request seriously when arguing that the original patch already passed its own tests would have been easier ([#875](https://github.com/MakazhanAlpamys/Soup/issues/875), [#884](https://github.com/MakazhanAlpamys/Soup/pull/884))
@@ -742,6 +745,7 @@ Listed by first contribution. PR numbers link the work.
- Second merge. The `reasoning` template behind `soup data generate --template reasoning` asked the generator for "the final answer" in no parseable form, so a generated gold such as `So there are 42 apples.` made `soup train` refuse the dataset before generation. The prompt now asks for `#### <number>` on its own line for `math` and a final `Answer: <answer>` line for `logic` and `code`, and the new tests pin the two fixture copies as byte-identical and every row as a numeric gold. **They re-scoped the PR the moment #1371 made their fixture edit unnecessary and said so in the description, and when review found that nothing read a gold written the way the new prompt asks, they added that test and ran the marker mutation themselves, reporting 11 failed / 4 passed, which reproduces exactly.** On `main` 3 of the 15 tests fail (the template-marker ones), and 9 of 9 mutations of the template text, both fixture copies, the variable-prefix rule, the `####` marker and the answer-phrase matcher fail a test in the file ([#1349](https://github.com/MakazhanAlpamys/Soup/issues/1349), [#1471](https://github.com/MakazhanAlpamys/Soup/pull/1471))
- Third merge. Custom-eval scoring was wrong in both directions: `contains` was a raw substring test, so an expected `4` was paid by `14` and `42` by `#### 420`, and `exact` scored `The answer is 4.` as a miss. They made `contains` token-bounded and added `scoring: "answer"`, which compares the answer a model states through the shared GRPO parser and refuses, at load time and in the eval gate, an `expected` that states no single answer, naming its line. **The second round is the part worth copying**: my review found that removing `re.escape` left all 24 tests green and that a stamped baseline recorded under the old `contains` (1.0) read back at 0.5 with a failed gate and no warning, because the baseline stamp covers only the bundled suites. They took the test verbatim (3 of 6 cases fail without the escape), put the score-shift warning in the changelog and the docs, and documented the limits that remained (the `.` boundary, ASCII-only bounds, `answer` needing a stated answer). 30 new tests (15 fail on `main`); 17 of 18 mutations caught; 433 related tests passed ([#1342](https://github.com/MakazhanAlpamys/Soup/issues/1342), [#1490](https://github.com/MakazhanAlpamys/Soup/pull/1490))
- Fourth merge. `soup reward synth`'s numeric verifier carried its own regex copy of the answer parser, so `1,000`, `#### 1,000`, `\boxed {42}` and `#### −42` scored 0 under the generated file and a good reference counted as rejected with no name. Both sides now go through `parse_reference` / `parse_completion` (the built-ins' parser), the compare at tolerance 0 is `Decimal` equality so large integers stay exact, and the report names every rejected reference while a refused run prints the first ten and `+N more`. **Worth copying is how three rounds were taken**: review found three mutations that survived (the refusal panel's naming, and reading the gold or the completion with the wrong parser) and they put the three tests in verbatim; the next push also took the unrequested follow-ups (`variables_conflict` in the emitted body, the capped listing) and then tripped the repo's ANSI ratchet, which they fixed with `strip_ansi` and a precise "non-dollar currency" wording. 27 new tests (7 failed, 6 passed, 14 errors on `main`); 22 of 22 mutations killed; 4,000 generated pairs agree with `math_verify_reward` ([#1350](https://github.com/MakazhanAlpamys/Soup/issues/1350), [#1533](https://github.com/MakazhanAlpamys/Soup/pull/1533))
+ - Fifth merge. `info_rm` scored reward-model health with a cluster-separation index over a median split of the step's rewards, and on a two-valued reward such as `reward_fn: accuracy`'s 0/1 one half of that split is always constant, so the pooled variance fell to the `1e-9` floor and the index measured the success rate: a first step at exactly 50% recorded a baseline near 31,623, every healthier step after it read as a collapse, and a run halted or had its beta raised on a phantom signal. They made a step with a constant half cast no vote (no baseline, `halt_on_hack` and `kl_control` untouched, one warning per run) and tied the variance floor to the observed reward range. The review found the guard also silenced a genuine total collapse on a continuous reward; they took the narrow fix (a fully constant step votes once a baseline exists), restored the constant collapse fixtures, and caught a surviving mutation of their own by adding the test that pins it. 293 tests on the four files, nine mutations all caught, 11 of the 14 new tests fail on main ([#1438](https://github.com/MakazhanAlpamys/Soup/issues/1438), [#1630](https://github.com/MakazhanAlpamys/Soup/pull/1630))
- **Maxi** ([@maximilianfeix](https://github.com/maximilianfeix))
- AutoDistill's vocabulary guards and the weight shards' `retain_bytes=False` were pinned by no test. Disabling both guards and turning full-RAM hashing back on left all 41 autodistill tests passing. Tests now cover the capture guard for both bounds, the worker's own guard before the teacher loads (on a dataset that still matches its fingerprint), and a shard hash that retains no bytes. **They noticed the `-1` cases still passed with the capture guard off, because `CaptureToken` raises the same phrase, and said so in the PR instead of shipping them as coverage. Anchoring the matches on the full message closed the gap on the next push.** Every mutation fails the new tests: whole guard 4, lower bound 2, context and prompt bypasses 2 each, worker guard 1, teacher loaded first 4, each retention mutation 1 ([#1341](https://github.com/MakazhanAlpamys/Soup/issues/1341), [#1400](https://github.com/MakazhanAlpamys/Soup/pull/1400))
@@ -786,6 +790,7 @@ Listed by first contribution. PR numbers link the work.
- `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))
+ - Every `SOUP_LAYER_STREAM_STRIPE_DIRS` refusal printed the entry with `repr`, so a Windows path came out with every backslash doubled and could not be copied back. They added `quote_path()`, which keeps a path as typed inside single quotes and escapes exactly the control characters the validation refuses, and used it at every site in the issue's table, including four Windows API errors that only fire on Windows. **They listed the spellings first (drive letter, UNC, spaces, trailing separator, POSIX, relative) and tested each one.** After review they added the changelog fragment, moved the helper to a neutral module and added a UNC case. 22 new tests (the file does not collect on `main` without the helper), 11 of 11 mutations killed ([#1611](https://github.com/MakazhanAlpamys/Soup/issues/1611), [#1626](https://github.com/MakazhanAlpamys/Soup/pull/1626))
- **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))