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): #1617, #1622, #1654, #1655, #1585, #1604, #1610 [skip ci]
Alpamys58b8ec034c8d
diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.mdindex e1a2c9f9..6d4e9965 100644--- a/CONTRIBUTORS.md+++ b/CONTRIBUTORS.md@@ -161,6 +161,7 @@ Listed by first contribution. PR numbers link the work.- Noticed that `CONTRIBUTING.md`'s hand-maintained test-suite counts had gone stale and proposed a ratchet. Shown a measurement that a ratchet there would redden the build on more than half of all merges — 11 of the last 20 commits touch `tests/` — **they took the subtractive fix instead**: delete the numbers so drift becomes impossible rather than merely detectable. Then, told their first shape test asserted "no digits" and would fire on this file's own house style (`(v0.X.Y)` tags sit on every sibling line), they narrowed it to a count shape. Verified both directions: a version tag with a bare digit keeps the suite green, a real count fails by name. Two rounds, both of which they resolved by making the guard *smaller* ([#467](https://github.com/MakazhanAlpamys/Soup/pull/467))- Closed a guard that existed, was cited in its own docstring, and could never fire: `_telemetry_endpoint_is_safe` promised that `https://10.0.0.1/` could not reach an internal network, and accepted it — the HTTPS precondition sat upstream of a scheme-conditional private-IP check, so the rejection was structurally unreachable. **They improved on the fix I proposed rather than implementing it.** My sketch would have replaced the delegation outright; they pointed out it would lose CRLF, null-byte, type and `0.0.0.0` sanitisation, and — the part that mattered — that `_is_private_or_link_local("localhost")` returns `False`, because `ipaddress.ip_address` raises on domain names. A guard that blocks `127.0.0.1` and waves through its own hostname is the half-fix I would have merged. They asked which direction I wanted before writing any of it. The result layers a strict predicate on top of the existing sanitisation, leaves `hubs.py` alone because a private HTTPS endpoint is a legitimate self-hosted hub, and covers bracketed IPv6, uppercase, trailing-dot and IPv4-mapped forms — the last unasked for. 25 tests, every one asserting against the real function with no mocks, and they discriminate in both directions: deleting the strict layer fails 19 named tests, dropping only the loopback half fails exactly the five `localhost` tests, and making the validator reject everything fails the six acceptance tests, so a validator that is too strict would not have merged either ([#593](https://github.com/MakazhanAlpamys/Soup/issues/593), [#598](https://github.com/MakazhanAlpamys/Soup/pull/598))- Traced #342 (GRPO dying at `grad_norm: nan`) through the code and published the hypotheses that turned out wrong along with the ones that held. Their `training_step` clamp would have stopped every GRPO run at step 1 (the inputs there are a list, and on Soup's default `num_iterations=1` there is nothing to clamp), so when review showed it they took the watchdog-only route, dropped the clamp, and rewrote the tests against a real `GRPOTrainer`. The watchdog sits on `on_pre_optimizer_step` so a valid earlier microbatch is never wiped; the skipped fraction is persisted to `trainer_state.json` and read by `soup adapters audit`, with a missing record reading `unknown`. 479 tests passed on the merged tree plus 3 CPU smoke tests, and 15 of 15 mutations (`zero_grad(set_to_none=False)`, the check moved per microbatch, the wiring call, `save_state()`, each audit branch) fail a test; the same tests fail 28 of 29 unit and 3 of 3 smoke on `main` ([#342](https://github.com/MakazhanAlpamys/Soup/issues/342), [#1084](https://github.com/MakazhanAlpamys/Soup/pull/1084))+ - Issue #1609: under policy divergence in bf16/fp16 the unclamped `exp` of the derived importance ratio overflowed to `inf`, and the backward pass through it turned a finite loss into NaN gradients (`0 * inf`); arithmetic masking did the same at padded positions. They clamped the log-ratio (per token, per GSPO sequence, and the KL reference gap) before `exp` with a bound that scales with `|A|`, so `ratio * A` cannot overflow while moderate fp16 ratios keep their gradient, replaced the masks with `torch.where`, kept every loss in its input dtype, and over four rounds pinned each guard with a test that fails when it is removed. When asked to count the logged KL tokens in float32 they accumulated the numerator in float32 as well, which a 100,000-token fp16 batch needs (the sum, 71,800, is past 65,504), and the last round's `promote_types` keeps float64 exact. 149 tests in the file, 35 in `test_issue1263`, 1016 passed across fifteen GRPO files on a trial merge with `main`, float32 and float64 results bit-identical to `main` on a 48-case grid; ten mutations each fail a named test ([#1609](https://github.com/MakazhanAlpamys/Soup/issues/1609), [#1610](https://github.com/MakazhanAlpamys/Soup/pull/1610))- **Osheun** ([@Osheun](https://github.com/Osheun))- Added the `glm-5.1-dpo` recipe — and on a first PR, carried the literal-repo-id guard the house pattern calls for, in all four places, unprompted. It earned its keep immediately: the pre-existing family guard `test_no_recipe_references_thudm_glm5` does NOT fire on a consistently-wrong `THUDM/GLM-5.1`, because it matches the lowercase `glm-5` spelling — so the guard against that exact historical defect was theirs, not ours. They also updated `CONTRIBUTING.md`'s recipe count, the site a sibling recipe PR missed and that I missed on a release ([#452](https://github.com/MakazhanAlpamys/Soup/pull/452))@@ -215,6 +216,7 @@ Listed by first contribution. PR numbers link the work.- Made `soup train`'s custom auto-eval treat a `soup eval custom` that exits with its own message as a skip, as the benchmark branch already did, instead of printing a traceback and `Auto-eval custom failed: 1`. They also added the missing test for the benchmark branch's exit clause. Four mutations, each killed by exactly its own test ([#1641](https://github.com/MakazhanAlpamys/Soup/issues/1641), [#1658](https://github.com/MakazhanAlpamys/Soup/pull/1658))- 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))- **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))@@ -358,6 +360,7 @@ Listed by first contribution. PR numbers link the work.- Made the provenance and compliance artifacts record only what was measured. The `--invocation` of `soup attest emit` now reaches the SLSA statement, and Annex XI / XII write `not measured` instead of zeros. The CycloneDX 1.6 ML-BOM gets an RFC 4122 serial number and canonical SPDX ids, expressions or names. The SPDX 2.3 document gets the right dependency direction and a defined `LicenseRef-` for every license it uses. The receipt fills `driver_version` on a CUDA host. Each artifact is tested against its own specification: a vendored CycloneDX 1.6 schema, a real ed25519-signed statement and the real Annex XI writer. It took five rounds, adding verbatim stdout, a small SPDX expression parser, per-operand `LicenseRef-` entries and a mixed-case operator row, each with its own mutation. On the final head: 278 passed, 0 failed across 8 files, before and after a trial merge with main; 48 of 59 new tests fail on main; in the last two review rounds 23 of 26 mutations caught, one harmless, and both survivors closed by a row added for each ([#1446](https://github.com/MakazhanAlpamys/Soup/issues/1446), [#1569](https://github.com/MakazhanAlpamys/Soup/pull/1569))- Made a `training.prm_reward` Hub id work. The reward head was read only from a local directory, so a GRPO run given `org/name` loaded both models and then died at the first reward call. They download the id (with `@revision`) through Soup's Hub wrapper, so the namespace-pin gate runs first. An existing directory wins over the repo-id shape, and a checkpoint with no reward head is refused at build time, naming the configured value. Two review rounds; each blocking item is pinned by a test that fails when the change is undone. 252 passed on the merged tree; 12 of 12 mutations caught; the new file fails 12 of 14 on `main` ([#1466](https://github.com/MakazhanAlpamys/Soup/issues/1466), [#1580](https://github.com/MakazhanAlpamys/Soup/pull/1580))- A grpo run with `eval_steps` reported TRL's policy objective as `val_loss` everywhere Soup shows a validation number, and the held-out reward reached only `trainer_state.json`. They added a per-task validation-metric table, so grpo records `eval_reward` as `val_reward` in the panel, the tracker (with a lazy migration for existing databases) and the event stream, and every other task is unchanged. A real tiny CPU grpo run proves the tracker series matches `trainer_state.json`. In review they reserved `val_reward` from `benchmark:` gating, which closed a regression verdict computed from training data. 238 passed across 9 related files; 4 of 4 mutations caught on the final head ([#1389](https://github.com/MakazhanAlpamys/Soup/issues/1389), [#1592](https://github.com/MakazhanAlpamys/Soup/pull/1592))+ - `data.add_new_tokens` / `new_special_tokens` loaded and were silently dropped on every unsloth setup, on MLX, under layer streaming and on twelve tasks whose trainers never call the expansion helper. They refused them at config load, ordered so switching backend never meets a second refusal, and re-measured every (task, backend) pair against the current trainers. Over three rounds they exempted SFT's vision/audio paths on unsloth and let a task's own backend refusal speak first. On the final head: 129 passed in the new file, 6 of 6 mutations caught, 186 configs probed, and 6794 passed / 0 failed across 86 files merged with main ([#1358](https://github.com/MakazhanAlpamys/Soup/issues/1358), [#1622](https://github.com/MakazhanAlpamys/Soup/pull/1622))- **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)).@@ -696,6 +699,7 @@ Listed by first contribution. PR numbers link the work.- **Suyog Verma** ([@commit-msuyog](https://github.com/commit-msuyog))- First contribution: A local `.parquet` dataset with list columns loaded 0 training rows for eight formats, because pandas handed every list cell to the converters as a numpy array, and `soup data validate` / `inspect` crashed on the same file. The loader now reads parquet with pyarrow, so rows match the same data in JSONL, and it drops pandas' hidden `__index_level_N__` index column while keeping a named index. The new tests fail 15 of 24 on `main`, and all 5 mutations of the fix fail a test ([#1218](https://github.com/MakazhanAlpamys/Soup/issues/1218), [#1292](https://github.com/MakazhanAlpamys/Soup/pull/1292))- `eval.auto_eval: true` loaded and never ran during `soup train`: the evaluation sat in the callback's `on_train_end`, which no trainer configured and which fires before the adapter is saved. They moved it to `soup train` itself, after the save, so it evaluates the adapter that run produced, on the main process only, with `trust_remote_code` off, and a failure does not fail the run. They also routed the 16 trainers through one callback builder, guarded by an AST scan. Verified with a real CPU `soup train`, 348 tests across 10 related files, and 6 of 8 mutations killed ([#1487](https://github.com/MakazhanAlpamys/Soup/issues/1487), [#1546](https://github.com/MakazhanAlpamys/Soup/pull/1546))+ - Third merge. `soup data inspect` checked "Images found on disk" against the current directory, so the three runs from the issue gave 0, 2 and 2 where 2, 2 and 0 was right, and it counted an image that training drops as outside the image directory. They sent inspect through the loader's own `_resolve_media_entries` instead of keeping a second copy of the rules, added `--image-dir` and an "Images outside image directory" row, and, when review showed the new row was unpinned (replacing the count with 0 left all tests green), pinned it the same day. After a stray `requests` line in `pyproject.toml` conflicted with a fix that had just landed on `main`, they rebased and dropped it without touching the rest of the patch. 7 tests in `TestDataInspectVision` (the three on the bug fail on `main`), 590 passed and 5 skipped across ten related files on the merged tree, 6 of 6 mutations killed ([#1598](https://github.com/MakazhanAlpamys/Soup/issues/1598), [#1604](https://github.com/MakazhanAlpamys/Soup/pull/1604))- **Jamal Kamaladdinoglu** ([@jamalkamaladdin](https://github.com/jamalkamaladdin))- First contribution: `soup migrate --from axolotl` turned `rl: orpo`, `ipo` and `simpo` into `task: sft` with no warning, so those preference configs migrated as SFT or failed at load on a `data.format` error that never named `rl`. They now map to Soup's `orpo`, `ipo` and `simpo` tasks with `data.format: dpo`. Any other `rl` value, such as axolotl's `ebft`, stops the migration with exit 1 and names the value and the supported list, printed through `for_terminal` so a YAML value cannot restyle or hijack the terminal. On `main` all 11 new tests fail; 12 of 12 mutations in the last round fail a test ([#1214](https://github.com/MakazhanAlpamys/Soup/issues/1214), [#1254](https://github.com/MakazhanAlpamys/Soup/pull/1254))@@ -795,6 +799,8 @@ Listed by first contribution. PR numbers link the work.- `training.quantization: mxfp4` passed config validation and then failed at the model load, because Soup built a bitsandbytes config for a format that belongs to transformers' own `Mxfp4Config`; the MXFP4 base Autopilot passes through failed the same way. They reproduced both on `main` and posted what transformers' quantizer says before writing code, then mapped `mxfp4` to `Mxfp4Config(dequantize=True)`, took it out of the k-bit prep path of all 15 trainer sites (it would cast the dequantized model to fp32), refused a local base that is not MXFP4 and the bitsandbytes-only `bnb_4bit_quant_storage`, and priced the base as the bf16 model it loads. **The part worth copying is the "not run" list**: no CUDA, no real MXFP4 weights, no training run, each with what it leaves unproven. 13 new tests (all fail on `main`, 26 across their test files), 26 of 26 mutations killed ([#1466](https://github.com/MakazhanAlpamys/Soup/issues/1466), [#1558](https://github.com/MakazhanAlpamys/Soup/pull/1558))- First contribution: disk-tier layer streaming turned direct I/O off for the whole store when torch's caching host allocator handed back a pinned staging arena off a 4096-byte boundary, and said so only in a log line. They aligned the placements inside the arena or took the next power of two, measured the shift again on the replacement, made `pinned_bytes` count the arenas actually held, and put the remaining page-cache fallback on the console. 12 CPU tests with a forced 512-byte offset (4 fail and 5 error on main), 12 of 12 mutations killed ([#1531](https://github.com/MakazhanAlpamys/Soup/issues/1531), [#1621](https://github.com/MakazhanAlpamys/Soup/pull/1621))- Follow-up to their own judge-down fix: its "N of M not judged" counts had only ever been tested with a judge that was dead from the first request, so the subtraction of the work already done was never observed. They added a test for each caller that stops the judge part-way, and one sentence in the data guide saying what a judge that stops answering does to `soup data from-traces`. **The part worth copying is the plain report**: when review found that the pair test (taken from the reviewer's own snippet) used only ties, so one of the two subtracted terms was never seen, they said they had run only the whole-subtraction mutation, switched to a kept pair first, and reran all three variants themselves. 2 new tests, 5 of 5 mutations killed ([#1522](https://github.com/MakazhanAlpamys/Soup/issues/1522), [#1648](https://github.com/MakazhanAlpamys/Soup/pull/1648))+ - First contribution: the three Fast-LoRA patchers composed destructively. The single-projection unpatch left a bound method on every projection, the kernel a projection ended up with depended on patch order, and unpatching one kernel could silently disable another. They made the Q/K/V and MLP group kernels take their projections over in either order through one release helper that runs only after every refusal guard. The single-projection unpatch now restores exactly the forward it found, and they reversed the #838 first-patcher-wins test after agreeing it in the issue. **They re-measured each gap on `main` before writing code. When review showed the release could be moved above a refusal guard unnoticed, they added the tests and checked every move against them themselves.** 33 tests over all 12 patch/unpatch orders plus the renamed #838 test (18 of the 33 and the renamed test fail on main), 9 of 9 mutations of the fix killed ([#1165](https://github.com/MakazhanAlpamys/Soup/issues/1165), [#1617](https://github.com/MakazhanAlpamys/Soup/pull/1617))+ - The `soup train` VRAM pre-flight skipped `quantization: mxfp4` even though an MXFP4 base is dequantized on load and trains in bf16, so a GPT-OSS-20B run was let through on a 24 GB card that refuses the same config with `quantization: none`. They waited for #1558 to land as agreed on the issue, then added the one mapping entry, gave only the `mxfp4` refusal a sentence saying the estimate prices the bf16 model, and brought the docs row and #1558's fragment in line in the same PR. **The part worth copying is the controls**: every `mxfp4` gate test runs beside a `none` control, and after review they also pinned the warning panel and tried the neighbouring layout changes themselves. 22 tests (10 fail on `main`), 968 passing across 19 related files, 7 of 7 mutations killed ([#1631](https://github.com/MakazhanAlpamys/Soup/issues/1631), [#1655](https://github.com/MakazhanAlpamys/Soup/pull/1655))- **Nariman Abdikarim** ([@Nari-Ab](https://github.com/Nari-Ab))- First contribution: `soup data generate --template preference` appended every preference row before the dedup check, so rows repeating a `--dedup-with` file and repeats within the same run were all written. They claimed that one item of the #1448 audit, routed preference rows through the shared dedup check, and built an order-independent key from the DPO and KTO fields. **Review found that nothing pinned which fields make up the key: a prompt-only key passed every test and would have dropped every later row for the same prompt. They added the proposed test and the exact duplicate count within minutes.** The new file is 4 failed on `main`, 11 of 11 mutations are caught, and 507 related tests pass ([#1448](https://github.com/MakazhanAlpamys/Soup/issues/1448), [#1605](https://github.com/MakazhanAlpamys/Soup/pull/1605))@@ -810,6 +816,7 @@ Listed by first contribution. PR numbers link the work.- **Yunare Maia** ([@yunaremaia](https://github.com/yunaremaia))- First contribution: QuEST refused a local base with the wrong block count or width only after reading and SHA-256-hashing every weight file and loading the model. They added a gate that runs on `config.json` before anything is hashed, placed inside `resolve_base_model_identity` so the v1-resume re-resolve is covered too. The gate shares one refusal constant with the post-load gate and leaves any value it cannot read to that gate. **Their tests count the hashed files, so they pin the order, not just the refusal. Across three review rounds they closed every mutation we found: a message-drift survivor, a dead branch, a `!=` gate tested with one layer count, an unpinned merge precedence and a bool-as-width case.** 21 tests (11 fail on `main`), 13 of 14 mutations killed ([#1199](https://github.com/MakazhanAlpamys/Soup/issues/1199), [#1588](https://github.com/MakazhanAlpamys/Soup/pull/1588))+ - First contribution: `soup ab` stayed at `continue` after a saturated warm-up while the accept hold (#1419) was the only thing holding the verdict back, and kept advising more samples that provably could not release it. They took points 1 and 2 of the issue, added `accept_held`, the two spreads and the real held-out row count to the verdict, and made the panel name the ratio and what to do. **Review found that the four extra webhook keys could only ever be false and that the wording still described a retired accept boundary in the docs, the gate record, three code comments and the test premise; they dropped the keys, put a negative assertion on the payload, rewrote every site, and pinned the panel details we named so that each mutation of them now fails a test.** 19 tests (17 fail on `main`), 18 of 18 mutations killed ([#1524](https://github.com/MakazhanAlpamys/Soup/issues/1524), [#1585](https://github.com/MakazhanAlpamys/Soup/pull/1585))---