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): #1303, #947, #1170, #1390, #1470, #1401, #1399
Alpamys89dc498a8d0d
diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.mdindex a765962a..5bbf8fff 100644--- a/CONTRIBUTORS.md+++ b/CONTRIBUTORS.md@@ -196,6 +196,7 @@ Listed by first contribution. PR numbers link the work.- DeepSeek-V4-Pro had only an SFT recipe. They added `deepseek-v4-pro-dpo` and `deepseek-v4-pro-grpo` in one PR, as #850 asked, with every value's source stated. The model block comes from the Pro SFT sibling and the task blocks from the DPO and MoE-GRPO conventions. Both surfaces (`RecipeMeta.model` and YAML `base:`) are pinned by tests. Along the way they fixed the MoE counts in the docs. After #1132 they redid the catalog count with the sync and snapshot scripts, so the five sites and the fixture agree at 174. 2266 passed across 11 recipe files; 17 of 20 mutations caught (the other 3 equivalent), and 5 of 5 re-run after the rebase ([#850](https://github.com/MakazhanAlpamys/Soup/issues/850), [#1297](https://github.com/MakazhanAlpamys/Soup/pull/1297))- `soup migrate` dropped the quantization key for unquantized sources and wrote nothing for full fine-tunes, so axolotl, LLaMA-Factory and Unsloth configs silently became 4-bit LoRA runs on load. They made all three migrators write quantization explicitly: HQQ/EETQ mapped, Unsloth's own precedence and notebook variables resolved, and a full fine-tune written as `lora.r: 0` or refused by task name. `soup migrate` now validates before writing. The review rounds added a receiver-qualified exception to the #748 guard instead of deleting its entry, a LoRA fallback for `llama-adapter`, HQQ 5/6-bit, and source-order variable resolution. Six mutations that survived gained tests, and a clash with #1254's import landed a one-line fix. 275 passed, 0 failed across 9 migrate files; 16 of 18 mutations caught ([#1215](https://github.com/MakazhanAlpamys/Soup/issues/1215), [#1302](https://github.com/MakazhanAlpamys/Soup/pull/1302))- Every DPO, IPO and `preference` run that set `dpo_beta_schedule` or `dpo_ref_regen_epochs` crashed at step 0. Both callbacks were plain classes, and transformers' `CallbackHandler` calls every event on every callback with no `hasattr` guard. They rebuilt both on the lazily resolved `TrainerCallback`, with the PEP 562 pattern of `lisa.py`, so the module still imports no torch. They also fixed the third bare callback the issue named. Their real CPU DPO `train()` tests assert the β trl uses after the first optimizer step, not just that the run finishes. `dpo_ref_regen_epochs` could never regenerate the reference: with LoRA there is no separate reference model, and `lora.r: 0` fails in peft. It is now refused at load in every case until [#1345](https://github.com/MakazhanAlpamys/Soup/issues/1345) wires it. 10 of 11 mutations fail tests ([#1229](https://github.com/MakazhanAlpamys/Soup/issues/1229), [#1294](https://github.com/MakazhanAlpamys/Soup/pull/1294))+ - `soup train --resume` on `task: prm` and `task: moe_lora_routing` announced the checkpoint, then retrained from step 0 and rewrote it: both wrappers dropped `resume_from_checkpoint`, and MoLE's periodic checkpoints held no trained gate. They forwarded it in both, saved `mole_gate.pt` into every `checkpoint-N`, restored it on resume with the base and task adapters re-frozen, refused resume on `task: unlearn`, and added a scan that fails when any trainer wrapper accepts the checkpoint without passing it on. **Four rounds, and the last one made two fixes pin each other**: every copy of the gate now goes through one fp32 save shared with #1312, and a recording test fails if a checkpoint copy skips it. 6 new tests, all failing on `main`; 13 of 13 mutations fail a test; on the final `main` the PR still merges clean and 2446 tests across 57 related files pass ([#1220](https://github.com/MakazhanAlpamys/Soup/issues/1220), [#1303](https://github.com/MakazhanAlpamys/Soup/pull/1303))- **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))@@ -367,6 +368,8 @@ Listed by first contribution. PR numbers link the work.- The NF4 bit-exactness test compared a streamed model against a resident reference taking a **different bitsandbytes kernel** — production streams through `install_dequant_forward` (`dequantize_4bit + F.linear`) while the reference used the fused `MatMul4Bit` — so a failure measured a kernel-path difference rather than a streaming defect. **What makes this one stand out is what they did NOT do**: the assertions stay at exact equality, no tolerance, no `approx`, no skip, no xfail. Two failing arms turning green is exactly the shape a weakening takes, and this is the opposite of one — the reference moves onto the same compute path, which strictly narrows what the test measures. It also handed over the root cause of [#776](https://github.com/MakazhanAlpamys/Soup/issues/776): isolated with streaming removed from the experiment entirely, two resident NF4 models with byte-identical weights differ by 6.10e-04 in float16 and 4.39e-03 in bfloat16 purely on which bitsandbytes 4-bit path they take, so streaming was never the variable. The `layer_stream_runtime.py` edit was confirmed docstring-only by comparing ASTs with docstrings stripped, so no card's behaviour changes ([#776](https://github.com/MakazhanAlpamys/Soup/issues/776), [#857](https://github.com/MakazhanAlpamys/Soup/pull/857))- `soup doctor` parsed the CUDA version out of `nvidia-smi` with a pattern that did not match modern driver headers, so a current NVIDIA driver read as *no version* and the wheel advice fell back to `cu121` — **confidently wrong rather than absent** ([#827](https://github.com/MakazhanAlpamys/Soup/issues/827)). Measured on this box (RTX 5070 Laptop, driver 616.92, header `CUDA UMD Version: 13.4`): `main` gives `driver=None, tag=cu121`; theirs gives `driver=(13,4), tag=cu132`. The half that makes it *safe* is the second one — an unrecognised driver now returns `None` instead of guessing, and both call sites guard on the **tag**, so no advice is printed rather than wrong advice. Their mutation is the best kind: dropping `if tag else None` emits `whl/None` **from the real wheel table**, which is what proves the test drives production code instead of a stub of itself — the defect I had blocked an earlier revision for. ([#883](https://github.com/MakazhanAlpamys/Soup/pull/883))- Published the measurement harness behind the layer-streaming NF4 cost record, which until now could not be reproduced by anyone - including by us. **The property that earned the merge is that it REFUSES rather than guesses**: on a model too small to exhibit the mechanism it exits 1 saying the control never reproduced a gradient mismatch, instead of printing a cost for something it did not observe. Two rounds, and the second turned `--self-test` from a check that declared PASS on ANY exception into a real negative acceptance test - it now catches the PRODUCTION assertion in `layer_stream_runtime.py` being neutered while the harness itself is untouched, which is the stronger of the two directions. The unverifiable half is stated in the record rather than omitted: the ~20 GiB figure is the original record's, because the timing path needs a 32B checkpoint and more VRAM than the review box has ([#379](https://github.com/MakazhanAlpamys/Soup/issues/379), [#1121](https://github.com/MakazhanAlpamys/Soup/pull/1121))+ - Answered #829, the defect that the GPU panel printed only a name and a size while a torch build that could not run the card still read "available": `soup doctor` now shows `sm_120 (Blackwell)`, a red line with the wheel hint when `get_arch_list()` does not cover the card (same-major later-minor SASS, `a`-suffixed targets exact-only, PTX fallback), and a Precision features block for BF16 / FP8 / NVFP4. **What earned the merge is that they made disagreement impossible rather than testing it**: the NVFP4 software row calls an `is_nvfp4_software_supported()` that resolves the same torchao classes `apply_nvfp4` does, and the last blocker (#829's own text named `torch.cuda.is_bf16_supported()`, which answers yes on a T4 through emulation) was closed by delegating to `cuda_supports_bf16()`, the gate every trainer uses, with a T4 test that fails against the old call. Review on real hardware: sm_120 output matched `nvidia-smi` row by row, six mutations killed, 59 passed on the merged tree ([#829](https://github.com/MakazhanAlpamys/Soup/issues/829), [#947](https://github.com/MakazhanAlpamys/Soup/pull/947))+ - Published the STEP 2b GRADDIFF measurement, the two-line result that started the 32B investigation (gradients match after one backward, yet the curves do not reproduce themselves). The bar for a reconstruction is that it can say no, and the review rounds were about exactly that: the success condition demanded a resident curve the record had printed as non-identical, the success branch could not be reached at any commit because every tree that can import the harness already carries the #331 repair, a NaN streamed curve counted as the defect, and eight mutations of the verdict left `--self-test` green. **What they did with it**: imported the historical control from `mechanism_cost` and restored it in a `finally`, made NaN an invalid measurement with its own exit code, stated the departures from the record (fresh adapter and optimizer per curve; the record never explains its C = False) as differences rather than causes, and took the maintainer's guard tests in as their own file — all seven mutations that still survived the second review are now killed. 33 CPU tests drive the real `main()` and `run_measurement()`; 19 of 26 mutations of the harness fail them and the 7 survivors are non-verdict guards that are named, not hidden. They said plainly that the CUDA path needs a 32B checkpoint they did not have ([#379](https://github.com/MakazhanAlpamys/Soup/issues/379), [#1170](https://github.com/MakazhanAlpamys/Soup/pull/1170))- **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@@ -610,6 +613,8 @@ Listed by first contribution. PR numbers link the work.- `soup data doctor` could not mirror `data.mask_history: true`: its report and `--show-mask` preview trained every assistant turn, while such a run trains only the last. A new `--mask-history` flag is threaded through every label builder the doctor uses, and it is refused with `--no-train-on-responses-only` or `--train-on-messages-with-train-field`, exactly as `soup.yaml` refuses them. Verified: 16 passed in the new test file (14 failed on `main`), and all 10 mutations of the fix fail a test ([#1251](https://github.com/MakazhanAlpamys/Soup/issues/1251), [#1259](https://github.com/MakazhanAlpamys/Soup/pull/1259))- `src/soup_cli/utils/auto_quant.py` had outlived its purpose. `soup serve --auto-quant` has refused with exit 2 since #816, so the module survived only as a dormant import target for historical tests, with no end date. They deleted it on the release #1131 fixed, together with the six test classes that exercised only its helpers (41 tests), and left the refusal's regression test untouched. They also corrected the CONTRIBUTING.md module list and test-table rows that still described the deleted coverage. `import soup_cli.utils.auto_quant` now raises `ModuleNotFoundError`, and the refusal still exits 2 on every backend. Verified: 441 passed on the merged tree (482 on `main`, the difference exactly the removed tests), and all 5 mutations of the refusal and its imports fail a test ([#1131](https://github.com/MakazhanAlpamys/Soup/issues/1131), [#1262](https://github.com/MakazhanAlpamys/Soup/pull/1262))- `training.loraplus_lr_ratio` loaded on `backend: mlx` and trained plain LoRA at one learning rate with no warning anywhere, because the MLX optimizer takes no parameter groups. They refused it at config load in its own validator placed after the MLX task gate, so tasks MLX cannot run keep their own messages, and pinned that order with five tests that fail in all three wrong positions; 10 of 10 mutations killed, 133 configs re-loaded with exactly the 11 `task: sft` MLX configs changing ([#1324](https://github.com/MakazhanAlpamys/Soup/issues/1324), [#1383](https://github.com/MakazhanAlpamys/Soup/pull/1383))+ - `training.expand_layers` (LLaMA Pro) was accepted on every task, backend and modality although only the transformers text `sft` and `pretrain` trainers apply it, so a `task: dpo` or `backend: mlx` config trained the unexpanded model with no message. They refused it at config load in its own validator placed right after the #795 quantization resolver, where the existing order pins protect it, and took the review's test file, which reads the task list from the schema so a new task is covered without editing a list; 33 tests (30 fail on `main`), 12 of 12 mutations killed ([#1325](https://github.com/MakazhanAlpamys/Soup/issues/1325), [#1390](https://github.com/MakazhanAlpamys/Soup/pull/1390))+ - `training.freeze_trainable_layers` was accepted on its own while nothing read it, so a config written to train only the top layers trained the whole model (or every LoRA target) and printed no warning. They refused it at config load when `expand_layers` is unset, in the validator that already holds the reverse refusal, testing `is not None` so `0` is refused and the `null` of a dumped config still reloads; 5 new tests fail on `main`, 8 of 8 mutations killed ([#1396](https://github.com/MakazhanAlpamys/Soup/issues/1396), [#1399](https://github.com/MakazhanAlpamys/Soup/pull/1399))- **yi111** ([@Yi-111-a](https://github.com/Yi-111-a))- First contribution: with torchao actually installed, four FP8-gate tests failed. The `converts` fixture stubbed `torchao` as a bare module that transformers' torchao quantizer could not import, and two "torchao absent" tests left real `torchao.*` submodules cached. The fixture now pre-seeds a package-shaped stub tree, the absent-torchao tests clear cached submodules, and the torchao-contract CI job runs the file against real torchao. **They fixed two failures the issue had not listed.** Those appear only when an earlier test file has already imported torchao, which is the CI job's own order. With torchao 0.18.0, `main` fails 4 of 333 in that job's command and the branch passes all 333; 5 of 7 fixture mutations fail a test ([#1205](https://github.com/MakazhanAlpamys/Soup/issues/1205), [#1284](https://github.com/MakazhanAlpamys/Soup/pull/1284))@@ -665,6 +670,12 @@ Listed by first contribution. PR numbers link the work.- `task: ppo` could not complete a single step on trl 0.29. The dataset handed to trl's `PPOTrainer` still carried the `prompt_text` strings, and trl's padding collator raised on them at the first batch, after three models had loaded. A train set smaller than one rollout batch spun forever at 100% CPU instead. trl now gets only `input_ids` / `attention_mask` at all three hand-offs, and a train set with fewer than `batch_size` x `gradient_accumulation_steps` x the number of processes rows is refused before any model loads, naming the numbers. **They wrote the suite's first test that runs a real trl PPO update, on CPU with nothing mocked, and it fails on `main` with the issue's exact error. When review asked for the refusal to move ahead of the model loads, they applied it and also pinned the two trl hand-offs no test covered.** 191 tests in the six PPO files pass with `main` merged, and 11 of 11 mutations of the fix fail a test ([#1391](https://github.com/MakazhanAlpamys/Soup/issues/1391), [#1410](https://github.com/MakazhanAlpamys/Soup/pull/1410))- `--fsdp` was accepted and silently dropped on `task: prm` and `task: moe_lora_routing`, and `--fsdp` and `--deepspeed` on `task: online_dpo`: the wrappers stored `fsdp_config` / `deepspeed_config` and never handed them to their trainer arguments. The fix spreads `**(self.fsdp_config or {})` into the `TrainingArguments` of `prm.py` and `mole_routing.py` and forwards both to `OnlineDPOConfig`, exactly as `dpo.py` does. The four new tests build each real wrapper over a tiny Llama and record the arguments-class kwargs, so no FSDP or DeepSpeed runtime is needed; 3 of 4 fail on `main`, the "neither set" control passes on both, and all 6 mutations of the fix fail a test ([#1204](https://github.com/MakazhanAlpamys/Soup/issues/1204), [#1417](https://github.com/MakazhanAlpamys/Soup/pull/1417))+- **Abhinay Kumar** ([@abhinyaay](https://github.com/abhinyaay))+ - First contribution: `soup audit-log tail --json`, `soup bom emit`, `soup eval leaderboard --format json|csv` and `soup profile --json` printed machine-readable output through Rich's `console.print`, so piped, a record over 80 columns was folded across lines (invalid JSONL / JSON, CSV rows split into fragments) and `[...]` in a value was swallowed, or crashed the command with `MarkupError` on `[/x]`. They moved the four sites to `typer.echo`, named the two sibling sites they left out, and pinned each command at console width 80; the 4 tests fail on main and pass, and reverting each site fails its test (4 of 4) ([#1468](https://github.com/MakazhanAlpamys/Soup/issues/1468), [#1470](https://github.com/MakazhanAlpamys/Soup/pull/1470))++- **Urooj Fatima Mukhtar** ([@UroojFatima-052](https://github.com/UroojFatima-052))+ - First contribution: ten real-`train()` tests were still skipped on every windows-latest cell under #382, although #1314 had traced the crash to CPU bf16/fp16 matmuls and the skip helper's docstring still blamed bitsandbytes for all of them. Nine now request `aten_half_matmuls` and the tenth, an fp32 run, just loses its skip. **The part worth copying is the guard that keeps the list honest**: a `FIXTURE_TESTS` check fails if any of the nine stops requesting the fixture, and, after review, if one both requests it and carries the skip again. `GUARDED_TESTS` shrinks to the two NF4 tests that really are the bitsandbytes crash, with the reason written next to the list. They flagged that their own CPU probably never hits `0xc000001d`, so the windows-latest cells are the real test, and the required run on their first head was green on all three with every one of the ten tests passing. 6 of 8 mutations fail a named test, one is caught by an existing test elsewhere, and the new guard file fails 9 on `main` ([#1359](https://github.com/MakazhanAlpamys/Soup/issues/1359), [#1401](https://github.com/MakazhanAlpamys/Soup/pull/1401))+---Want to join this list? See [CONTRIBUTING.md](CONTRIBUTING.md) — good first issues are