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): #1837, #1875, #1843, #1901, #1908, #1899, #1928, #1929, #1863, #1907 [skip ci]
Alpamys4a9247287642
diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.mdindex 6e70a437..a8670967 100644--- a/CONTRIBUTORS.md+++ b/CONTRIBUTORS.md@@ -229,6 +229,9 @@ Listed by first contribution. PR numbers link the work.- Closed #1801: the comment above the hub-cache `model_copy(update={"base": ...})` call in `commands/train.py` claimed Pydantic reruns the `base` validators, which `model_copy` never does. They rewrote it to say what the call does and why no revalidation is needed (`local_path` is the `is_under_cwd`-checked cache directory). Comment-only, AST identical before and after ([#1801](https://github.com/MakazhanAlpamys/Soup/issues/1801), [#1845](https://github.com/MakazhanAlpamys/Soup/pull/1845))- Closed #1800, which asked that the Linux disk kind describe the volume holding the cache. They made the probe resolve the device through sysfs, follow partitions and stacked-volume members (slowest kind wins) with a depth cap and an "unknown" fallback, and after review fixed a Windows-only fixture path and pinned all five guard branches. 20 new tests; five mutations (depth cap, isdir guard, member order, rotational default, ValueError except) each fail 1-2 of them ([#1800](https://github.com/MakazhanAlpamys/Soup/issues/1800), [#1847](https://github.com/MakazhanAlpamys/Soup/pull/1847))- Closed #1405, which asked that unlearning code stop promising features for an already-shipped release. They removed the expired promises from the helpers and the eval command, made the MLX refusal name the supported backend, and widened the schema-only guard to every raise message under src/soup_cli, then, after review, pinned that the helper file is scanned and covered the eval docstring. 10 tests pass; two mutations (narrowed scan root, re-added promise) each fail one ([#1405](https://github.com/MakazhanAlpamys/Soup/issues/1405), [#1842](https://github.com/MakazhanAlpamys/Soup/pull/1842))+ - Closed #1406: `training.citation_faithful: true` loaded on `task: pretrain`, whose trainer never reads it, so the citation-span weights were silently not applied. They narrowed the compat validator to `task: sft` with a refusal that names the field, the task and the way out, updated `docs/training.md`, and flipped the old `test_citation_faithful_on_pretrain_accepted`, which had pinned the bug, rather than deleting it. The pretrain-refusal test and the flipped one fail on `main` and pass; 7 of 7 validator mutations killed, and all 170 recipes, 21 packaged templates and 8 example configs still load ([#1406](https://github.com/MakazhanAlpamys/Soup/issues/1406), [#1843](https://github.com/MakazhanAlpamys/Soup/pull/1843))+ - Fixed #1910: a judge task with an empty or whitespace-only prompt file scored 0.0 without judging anything, so it could pass the gate at threshold 0 or mint a baseline. They made `_run_judge_task` raise a `ValueError` naming the file and task, which `run_gate`'s no-score path turns into a closed failure with no baseline written; measured scores keep their behaviour. 30 tests, 20 failing on main; 3 mutants killed ([#1910](https://github.com/MakazhanAlpamys/Soup/issues/1910), [#1928](https://github.com/MakazhanAlpamys/Soup/pull/1928))+ - Fixed #1819: judge and generation HTTP calls read whole response bodies without a limit. They added `utils/http_response.py`, a streamed reader whose budget counts decoded bytes, with a `Content-Length` pre-check and the stream closed on overflow (judge cap 1 MiB, generation and Magpie 8 MiB); errors name the cap and never a body or key, provider error logs drop bodies, and Magpie drops an oversized sample within its attempt bound. **The part worth copying is the read ratchet over `httpx.post`/`httpx.get`**, which makes the next unbounded read fail a test. 61 new tests; five mutation families (decoded-budget check, `Content-Length` check, judge cap x10, Magpie re-raise, a new unbounded read) each fail named tests ([#1819](https://github.com/MakazhanAlpamys/Soup/issues/1819), [#1929](https://github.com/MakazhanAlpamys/Soup/pull/1929))- **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))@@ -409,6 +412,7 @@ Listed by first contribution. PR numbers link the work.- The custom-eval scorer `tool_call_args_subset` gave full argument credit to malformed tool-call arguments (`"not-json"`, `[]`, `null`, a number) whenever the gold call expected none, because a failed parse was collapsed into an empty object. They reported it with a probe on the real scorer, asked how malformed arguments should be treated before writing code, and withheld argument credit only for a present-but-invalid payload, leaving valid empty objects, an omitted field, the weights and the threshold as they were, each pinned. 22 tests; removing the fix fails 8 of them ([#1734](https://github.com/MakazhanAlpamys/Soup/issues/1734), [#1737](https://github.com/MakazhanAlpamys/Soup/pull/1737))- Closed #1740, the `quant-check` verdict that moved with float round-off: 19/20 -> 18/20 subtracts to `-0.04999999999999993`, so an exact five-point drop was MINOR and the command exited 0 instead of 2 (and an exact two-point drop was OK). They took the accepted policy as written - round the drop inside `classify_delta` for BOTH thresholds, not a looser threshold - and left the defaults, the scores, the raw JSON `delta` and the schema alone. **What makes it worth keeping**: the tests start from task COUNTS rather than literal deltas (the existing boundary tests all passed because they used `-0.05`, which is why the bug survived), they add 1e-7 near-boundary controls that stop the rounding from becoming a looser threshold in disguise, and one set runs the real `quant-check --format json` command with only the generators stubbed, asserting verdict and exit code and comparing the CLI row with the core row. 19 tests, 6 of them fail on the previous source; 10 of 10 mutations (no rounding, rounding at only one threshold, looser defaults, rounding to 1 / 2 / 3 places, the exit mapping dropped or exiting 1) are killed by a named test ([#1740](https://github.com/MakazhanAlpamys/Soup/issues/1740), [#1743](https://github.com/MakazhanAlpamys/Soup/pull/1743))- Closed #1798, their own report: `soup eval gate` printed `GATE PASSED` and exited 0 for a suite with no tasks (`tasks: []`, a missing `tasks` key, or a `task:` typo holding the intended evaluation), because the list defaulted to empty, unknown keys were ignored and `run_gate` returned a pass after zero iterations. They asked for the contract of an explicit `tasks: []` before touching it, then added one shared check called from both `load_suite` and `run_gate`, so `soup eval gate` exits 3 before a model is built and a direct `run_gate` caller or a suite emptied after loading is refused with a message naming the suite and `tasks`. **The part worth copying is the test that empties a loaded suite**: `load_suite` accepted it, so only the `run_gate` guard can stop it, the case a loader-only fix would miss (removing the `load_suite` guard fails 9 tests, the `run_gate` guard 4), and a factory spy shows the CLI never builds a model. Non-empty PASS, FAIL and regression controls run through both the API and the CLI, the old #404 test was rewritten to keep its intent instead of leaning on an empty suite, and the PR says what it did not run (full suite, mypy, a live model). 24 new tests, 13 of which fail on the previous `gate.py` ([#1798](https://github.com/MakazhanAlpamys/Soup/issues/1798), [#1821](https://github.com/MakazhanAlpamys/Soup/pull/1821))+ - Fixed #1834, which they reported: the leaderboard CSV export joined fields by hand, so a model or benchmark name with a comma, quote or newline broke the file. They moved it to `csv.writer` with LF output, kept plain exports byte-identical and the empty-board header, and pinned round trips through a real SQLite CLI run; every mutation of the writer killed, 14 of the first 20 tests fail on `main` ([#1834](https://github.com/MakazhanAlpamys/Soup/issues/1834), [#1863](https://github.com/MakazhanAlpamys/Soup/pull/1863))- **k4its1t** ([@k4its1t](https://github.com/k4its1t))- First contribution, picking up where #497 stopped one day earlier. The dtype scanner's predicate already matched anything starting with `AutoModel`, so every `AutoModelFor*` load was covered and the surviving hole was **concrete, non-Auto** classes: `Qwen2VLForImageTextToText.from_pretrained(..., dtype=)` or `BertForMaskedLM.from_config(..., dtype=)` were invisible and would have shipped a kwarg that TypeErrors below the declared transformers floor. Four suffixes, a focused regression test each, both load methods. **Their own mutation claim was the coarse one -- removing all four suffixes makes four tests fail -- and removing them one at a time is stronger than they claimed**: each single removal produces 1 failed, 15 passed, so every named test is the sole guard for its own suffix rather than the four reddening together. The two things I check on any widening they got right: the four existing false-positive controls survive untouched (a guard that fires on correct code is one people delete), and all six deleted lines are a rename plus reworded docstrings, not a test. The rename `_is_transformers_model_load` -> `_is_dtype_guarded_model_load` describes the contract being enforced instead of implying every matched class comes straight from transformers. **Scope was not oversold, which is why it is worth writing down**: none of the four suffixes appears in `src/` today and the scanner reports zero live hits, so this is prospective -- Whisper loads as `WhisperForConditionalGeneration` and #497 already covered it. Timely prospective work, though: concrete vision classes are exactly what #488, #501 and #502 are moving through right now ([#500](https://github.com/MakazhanAlpamys/Soup/pull/500))@@ -513,6 +517,8 @@ Listed by first contribution. PR numbers link the work.- Kept their own #1419 release-note entry true after #1575 retired `--beta`: the entry said the `--alpha` + `--beta` < 1 check "stays" although it is in no tagged release and #1575 removes it, and pointed at #1418 instead of quoting the new 117-pair figure. Changelog-only; verified that neither v0.75.1 nor v0.75.2 carries the check, fragment test 21 passed, and every fragment assembled cleanly on main + #1575 + this PR; they flagged the matching #1378 sentence instead of editing another contributor's entry ([#1575](https://github.com/MakazhanAlpamys/Soup/pull/1575), [#1635](https://github.com/MakazhanAlpamys/Soup/pull/1635))- `training.freeze_layers` / `training.freeze_ratio` still loaded silently on the `sft` / `tts` paths that never read them: MLX, unsloth, vision, audio and layer streaming, plus `tts` on unsloth. Each of those setups attaches an adapter, so the run trained every layer. They filed the per-path table themselves, waited for their own #1532 to merge, then extended its validator so both refusals live in one place. **The part worth copying:** when two settings leave the text path, both are named in the trainer's dispatch order, and an AST scan pins that order and keeps every refused setup free of a freeze read, so the refusal cannot drift from the code. 40 new tests (18 fail on `main`); 12 of 13 mutations killed, the survivor being the `getattr` limit the PR states; 983 passed across 13 related files ([#1581](https://github.com/MakazhanAlpamys/Soup/issues/1581), [#1649](https://github.com/MakazhanAlpamys/Soup/pull/1649))- Closed #1326: `training.expand_layers` (LLaMA Pro) with a LoRA rank trained the wrong thing. The block expansion runs before `get_peft_model`, which froze the appended blocks again, so only adapters on the original layers learned while the console said only the new blocks train. They took route 1 of the ruling: a refusal at config load that names `expand_layers`, `freeze_trainable_layers` and `lora.r` and points to `lora.r: 0` with `quantization: none` (on pretrain: needs `task: sft`), with an early return so `stream_layers`, Spectrum, LISA and QuEST keep their own message. **The part worth copying is the docs test**: it loads every `expand_layers` YAML block in `docs/peft-and-efficiency.md` and `docs/training.md`, requires both files to contribute at least one, and asserts each has `lora.r: 0`, so a docs example cannot drift away from the validator. They also measured on a tiny Llama what trains with and without the rank, and filed #1813 for the pretrain gap they left alone. 15 new tests; disabling the validator fails 4 and refusing `lora.r: 0` as well fails 9 ([#1326](https://github.com/MakazhanAlpamys/Soup/issues/1326), [#1783](https://github.com/MakazhanAlpamys/Soup/pull/1783))+ - Closed the pretrain half of the LLaMA Pro and full-fine-tune family. `task: pretrain` accepted `lora.r: 0` and `expand_layers`, then failed inside peft at trainer start, with an error that named neither Soup nor the field. The change refuses both at config load, **and the part to read is how they bounded it**: LISA genuinely trains pretrain with `lora.r: 0` (no adapter is attached), so they kept it loading and proved it through the real `PretrainTrainerWrapper.setup()` and one epoch instead of by argument, left `stream_layers` and mlx to their own messages, and reworded #1783's fragment when the change made its pretrain clause false. In review they made the pretrain sentence conditional on transformers text (it was false on unsloth), restored the sft negative assertion and showed that widening the refusal to dpo, classifier and asr is already caught by three existing controls. 18 tests, 8 failing on `main`; 16 mutations, all killed ([#1813](https://github.com/MakazhanAlpamys/Soup/issues/1813), [#1875](https://github.com/MakazhanAlpamys/Soup/pull/1875))+ - Part 1 of #1764: `soup registry push --run-id` left `data_hash` null; they added `--data PATH` (refused before any database opens), passed it through `register_from_run`, and showed the hash in `soup registry show`, worded as the registered input rather than proof; six mutations all killed ([#1764](https://github.com/MakazhanAlpamys/Soup/issues/1764), [#1907](https://github.com/MakazhanAlpamys/Soup/pull/1907))- **GitFromRatatouille** ([@swalla02](https://github.com/swalla02))- First contribution, and it is the third instance of this repo's most persistent bug class found by someone else ([#363](https://github.com/MakazhanAlpamys/Soup/issues/363), [#423](https://github.com/MakazhanAlpamys/Soup/issues/423), [#659](https://github.com/MakazhanAlpamys/Soup/issues/659)): `soup migrate` refused **any** input named `*.jsonl`, a valid LLaMA-Factory YAML config included, because the guard branched on the filename while the content sniff written to gate it had **zero call sites in `src/`**. The diagnosis is worth more than the one-line fix — the test was named after the command and its body called the helper, so it passed on a codebase where `migrate` never imported it. **Then review found a regression their own fix introduced, and the way they closed it is the part to copy**: the sniff read `utf-8`, so a UTF-8 BOM survived as U+FEFF, which `str.strip()` does not remove, and a real BOM'd JSONL silently lost the friendly error it used to get — on a project with three Windows CI cells where PowerShell's `Out-File` writes that BOM by default. Their BOM test **guards its own fixture** (asserting the file really contains a BOM before asserting behaviour) and their bounded-read test measures the property with `tracemalloc` rather than pinning the spelling of the loop. Six mutations, six killed; zero assertions removed. They also **declined to widen the fix** to files whose name gives no hint, correctly citing the `.ipynb` case the original comment warns about, and left that as an open question rather than guessing ([#672](https://github.com/MakazhanAlpamys/Soup/issues/672), [#675](https://github.com/MakazhanAlpamys/Soup/pull/675))@@ -797,6 +803,7 @@ Listed by first contribution. PR numbers link the work.- Sixth merge, and the first translation: a Simplified Chinese README. A fifth language is a standing commitment, since every later edit to `README.md` has to be followed by a re-translation and a new stamp, and they signed up for it in the thread before starting, then held the PR until #1630 had merged so the queue stayed at one open PR. `README.zh.md` mirrors `README.md` section for section (19 sections, 12 code blocks, 20 table rows), translating prose and `#` code comments only; code, URLs, link targets, numbers and inline code are identical, which the translation ratchet and a separate mechanical comparison both confirm. The banner edit landed in all five READMEs in the same PR, and the stamps were recomputed after merging a `main` that had changed `README.md` (#1307) under them. They are named in `MAINTAINERS`, so the re-sync is theirs from now on. (#1632, #1733)- Took #1444: with `gradient_accumulation_steps` above 1, `task: prm` and `task: sft` with `data.format: raft` logged `loss`, `train_loss` and `grad_norm` G times too large (4.000x at the default G=4) and clipped a gradient G times too large, because both trainers return their own per-micro-batch mean while transformers still treated the model as one that accepts loss kwargs and skipped its `1 / gradient_accumulation_steps` division. They posted the plan on the issue first (`num_items_in_batch` is a label count, so it cannot express RAFT's `loss_weights` total), then set `model_accepts_loss_kwargs = False` in both trainers. **The part worth copying is the real-wrapper comparison**: PRM and RAFT run through their actual wrappers at `batch_size: 1` with four identical rows, once at G=1 and once at G=4, and the first logged `loss` and `grad_norm` must agree, beside a class-level ratio probe and a citation-boosted RAFT case; the fixture hides MPS from `transformers.training_args`, which caches accelerator availability. Five tests; flipping the flag back fails 2 PRM tests or 3 RAFT tests, and the neighbouring PRM and RAFT test files give 531 passed. The optional guard over all `compute_loss` overrides is not included ([#1444](https://github.com/MakazhanAlpamys/Soup/issues/1444), [#1771](https://github.com/MakazhanAlpamys/Soup/pull/1771))- A polish of their own translation. `README.zh.md` rendered the pre-repair and post-#331 measurement sets of the 8B figure as "一行" / "两行" (a calque of "row", which reads as lines of text) and the clock-adjusted comparison as "按单位时钟频率算". They changed five lines in three places (the figure paragraph, the figure's alt text, the Citing Soup bullet) to "那组数据" / "两组数据" / "折算", leaving every number, link target, code span and tag identical, and no re-stamp is needed because `README.md` is untouched. Prose only; review compared tokens per hunk and the per-section sets of the translation ratchet (all identical), no tests to mutate. ([#1699](https://github.com/MakazhanAlpamys/Soup/pull/1699), [#1836](https://github.com/MakazhanAlpamys/Soup/pull/1836))+ - Polished the zh What's New wording (validation hold-out, CPU-core binding) with numbers and code spans unchanged; fixed the 70B-shaped store phrasing after review ([#1825](https://github.com/MakazhanAlpamys/Soup/issues/1825), [#1837](https://github.com/MakazhanAlpamys/Soup/pull/1837))- **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))@@ -908,6 +915,11 @@ Listed by first contribution. PR numbers link the work.- **Batyrkhan** ([@Batyrkhantzy111](https://github.com/Batyrkhantzy111))- First contribution. `soup serve --backend sglang` on a LoRA adapter answered from the **base model** while `/v1/models` and every response reported the adapter's name: the adapter was registered at startup, but SGLang applies one only to a request whose `lora_path` names it, and neither generation route sent it. The fix threads one explicit name from `create_sglang_runtime` through `_serve_sglang` and `create_sglang_app` to both routes, streaming or not, and a full model still sends none. **The evidence is what stands out**: the tests drive `_serve_sglang` end to end against a recording stand-in for the engine and each case asserts which route the request took, so the token-ids cases cannot silently fall back to the string route; they fail on `main` (5 of 9) and pass after; every claim about SGLang's behaviour is cited to a file and line in the PyPI wheel of the version named, and the author corrected their own earlier comment in the thread (0.3.3 only for the list form of `lora_paths`) before it could mislead; and the dependency floor was raised in a commit of its own with the reason spelled out — from 0.3.1 through 0.5.0rc0 SGLang refuses to start an engine with an adapter unless the radix cache is off ([#1724](https://github.com/MakazhanAlpamys/Soup/issues/1724), [#1732](https://github.com/MakazhanAlpamys/Soup/pull/1732))+- **ndablizov** ([@ndablizov](https://github.com/ndablizov))+ - Fixed #1807: `soup migrate` silently dropped the validation split, re-defaulted LLaMA-Factory LoRA rank/alpha/targets, took the wrong Unsloth base and missed its trainer arguments. They fixed all three migrators, mapped `pref_beta` to `ipo_tau` with source citations, coerced quoted integers, and made every unmapped key a warning; twelve mutations all killed ([#1807](https://github.com/MakazhanAlpamys/Soup/issues/1807), [#1901](https://github.com/MakazhanAlpamys/Soup/pull/1901))+ - Fixed #1887: `soup data validate` did not count rows the loader skips, so a mostly unusable file could pass the valid-fraction gate and the exit code. They counted non-object rows and invalid-JSON lines as skipped, made an all-skipped file exit 2 (with `--format`) or 3 (without), and documented it; sixteen tests fail on main and eight mutations all killed ([#1887](https://github.com/MakazhanAlpamys/Soup/issues/1887), [#1908](https://github.com/MakazhanAlpamys/Soup/pull/1908))+ - Fixed #1853: `lora.use_rslora` loaded on `backend: mlx` and `backend: unsloth` but was never read, so an rsLoRA run trained at plain-LoRA scale (8x smaller update at the default `r: 64, alpha: 16`). They added one `mlx_lora_scale` helper read by both the MLX adapter-config writer and `_apply_lora`, forwarded `use_rslora` from all 11 Unsloth trainers to `get_peft_model`, and pinned every call site with a parametrised test plus a source guard; six mutations all killed ([#1853](https://github.com/MakazhanAlpamys/Soup/issues/1853), [#1899](https://github.com/MakazhanAlpamys/Soup/pull/1899))+---Want to join this list? See [CONTRIBUTING.md](CONTRIBUTING.md) — good first issues are