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): #1504, #1510, #1557, #1554, #1533, #1119 [skip ci]

Alpamys566f1f8e0d17
diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md
index 65cf39e8..a0686f64 100644
--- a/CONTRIBUTORS.md
+++ b/CONTRIBUTORS.md
@@ -381,6 +381,7 @@ Listed by first contribution. PR numbers link the work.
- 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))
- Brought the "Reproducing" section of `gate-h100-validation.md` in line with the harnesses that are now published: it said no script was in the repo and linked none, so a reader following the record was told there was nothing to run. **They re-synced it the same day `graddiff.py` merged and made their own note stale**, which is the discipline that keeps a dated correction true. Each of the three reconstructions is labelled as one, the unpublished rows still point at #379, and every other cell is left as the record had it. Checked by a 19-check script (19/19, fails on `main`), 11 mutations of the section (11 killed) and 104 resolving links ([#1348](https://github.com/MakazhanAlpamys/Soup/issues/1348), [#1364](https://github.com/MakazhanAlpamys/Soup/pull/1364))
- `data.format: pre_tokenized` loaded with `data.add_new_tokens`, `data.new_special_tokens`, `data.prompt_strategy` or a non-text `modality`, although `soup data preprocess` never applies any of them, so the run trained on cached ids that silently lacked the transformation. They refused each combination at config load (three `DataConfig` checks plus a `SoupConfig` validator placed after the quantization resolver), updated the `NOT_PREPROCESS_KEY_FIELDS` reasons and the docs, and after review rewrote the one refusal that stated the opposite reason and pinned it in the test. Re-run by the maintainer: the 6 new cases fail on `main`, 15 of 16 mutations killed, 1452 related tests pass ([#1273](https://github.com/MakazhanAlpamys/Soup/issues/1273), [#1363](https://github.com/MakazhanAlpamys/Soup/pull/1363))
+ - Published the STEP 9 mechanism reproducer behind the layer-streaming NF4 record, the five-arm harness that shows the defect is aliasing of the recycled buffers and that neither the packed weights nor the quantisation state alone is enough. It took six review rounds: as first submitted it crashed on its first pooled acquire; the repair then overflowed, so its "exact" column was `inf == inf` arithmetic that happened to land on the record's counts; the clone baseline was compared against a copy of itself and could not fail; a non-finite run under `--bypass-pool` exited 1, the same code as "negative control caught"; and five verdict rules were reached by no test. **The part worth keeping is the last two rounds**: they gave the overflow its own exception and exit code 3, made the full clone match a resident run that bypasses the pools (so a clone that is 1.5x off or drifts between repetitions now exits 1), and then wrote five per-arm tests that each drive the real `main()` to the rule they name. 17 CPU tests; 14 of 17 mutations of the harness fail them, and the 3 survivors are named rather than hidden — one verdict message that a neighbouring rule makes redundant for the exit code, one display-only count and one equivalent mutant. They said plainly that they had no CUDA device to run it on ([#379](https://github.com/MakazhanAlpamys/Soup/issues/379), [#1119](https://github.com/MakazhanAlpamys/Soup/pull/1119))
- **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
@@ -702,6 +703,7 @@ Listed by first contribution. PR numbers link the work.
- First contribution: the streamed test builders picked `cuda` or `cpu` and never `mps`, so on Apple Silicon the model sat on the CPU while `TrainingArguments` picked `mps:0`. 32 streamed training cases, plus three classes #1258 had just added, therefore skipped on every macOS cell, and CI had never run a streamed backward pass, optimizer step or save on MPS. One `accelerator_device()` resolver in `tests/conftest.py` now serves all four builders, the three private `_mps_is_the_accelerator` copies are gone, and those cases run on MPS while both bitsandbytes skips stay. **They ran every round on an M3 Ultra and an RTX 4090 D before asking for review. They also set aside the CPU pin the issue proposed, because no CPU-pinned case reaches a trainer step, which checks out, and dropped #1258's MPS skip only after its classes passed on real hardware.** A resolver test now catches all four resolver mutations on any machine (3, 2, 1 and 1 failures), and forcing the MPS probe on a machine without MPS fails 67 cases ([#1355](https://github.com/MakazhanAlpamys/Soup/issues/1355), [#1375](https://github.com/MakazhanAlpamys/Soup/pull/1375))
- 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))
- **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))
@@ -735,6 +737,16 @@ Listed by first contribution. PR numbers link the work.
- First contribution: PRM, MoLE routing, PPO and unlearning built their backend arguments from only part of `TrainingConfig`, so the configured optimizer, scheduler, warmup, weight decay and gradient clipping were accepted, validated and then replaced by backend defaults, and the unlearning loop ran a fixed optimizer and a hard-coded 256-token limit. That is this project's most common defect shape, an option validated and read by nothing, and they found four instances of it in one pass and fixed all four: PRM and MoLE now pass the settings to `TrainingArguments` and resolve `batch_size: auto` through the memory estimator, PPO forwards them behind the existing `config_accepts` probes, and unlearning builds its optimizer through transformers, runs a warmup scheduler, clips gradients, accumulates `batch_size` x `gradient_accumulation_steps` single-example passes per update (a short last group is averaged by its real size), reads `data.max_length` instead of 256, and keeps its reported loss and example counts on their original scale. **When review showed that 7 of 8 value mutations survived their first tests, which only checked the spelling of keyword arguments, they replaced them with tests that train PRM and MoLE on a tiny CPU model and assert on the arguments and the `Adafactor` optimizer actually built, construct a real trl `PPOConfig`, and train SimNPO and NPO unlearning.** The work stayed theirs through the announced date of 2026-10-01; the maintainer then finished the remaining review items in #1564, which carries their nine commits unchanged and names them as co-author, and #868 was closed in its favour ([#805](https://github.com/MakazhanAlpamys/Soup/issues/805), [#868](https://github.com/MakazhanAlpamys/Soup/pull/868), [#1564](https://github.com/MakazhanAlpamys/Soup/pull/1564))
- While on it they found that `task: prm` and `task: moe_lora_routing` accepted `fsdp_config` and never read it, a second defect of the same shape outside the issue they were fixing: it was split out of the PR as #1204 with the finding credited to them (checking it showed `online_dpo` drops `--deepspeed` too) and fixed in #1417 ([#1204](https://github.com/MakazhanAlpamys/Soup/issues/1204))
+- **Alberto Cucca** ([@bobbonauta](https://github.com/bobbonauta))
+ - First contribution: resuming a QLoRA SFT run upcast the trainable LoRA adapter from bf16 to fp32, because TRL casts it to bf16 at init and peft's `load_adapter` autocasts it back on `_load_from_checkpoint`, so a resumed run could not reproduce the uninterrupted one. `keep_trainable_dtype_on_resume` records each trainable parameter's dtype and restores it right after the reload, before the optimizer exists. Frozen and quantized weights are left to the loader, and the run's own dtype is restored, so the #429 fp16 path is untouched. **They measured the result on a real 8B NF4 run (a bit-identical adapter, loss and grad norm against the uninterrupted run). When review showed the SFT call was pinned by no CI test, they added CPU tests through `SFTTrainerWrapper.train`, strengthened two unit tests, and filed #1573 for the trainers this PR left out.** 9 of 10 mutations fail a test. Deleting the call fails 1 test and inverting it fails 2 ([#1503](https://github.com/MakazhanAlpamys/Soup/issues/1503), [#1504](https://github.com/MakazhanAlpamys/Soup/pull/1504))
+ - First contribution: layer streaming refused every model cached by huggingface_hub 1.32 or later, because Xet blobs moved into a cache-wide shared store that the snapshot materializer treated as an escape. Links into that store are now followed only when it carries huggingface_hub's marker and neither the store nor the marker is a link or junction. Links leaving both stores are still refused. The recorded blob id is the per-repo etag, so copies made before the change are reused. **They traced it from a real Qwen3-8B NF4 run to the exact huggingface_hub change, and kept old copies reusable by reading the etag from the first link rather than the final file. When review showed that a symlinked store directory was trusted where huggingface_hub would not trust it, they applied the lstat check and pinned both refusals.** 12 of 14 mutations of the fix fail a test, and a cache built by huggingface_hub 1.33.0 itself materializes, shards and is reused ([#1509](https://github.com/MakazhanAlpamys/Soup/issues/1509), [#1510](https://github.com/MakazhanAlpamys/Soup/pull/1510))
+
+- **vaputa** ([@vaputa](https://github.com/vaputa))
+ - First contribution: `soup data from-traces --logs session.jsonl --format soup-serve` ended in a green `Wrote 0 preference pair(s)`, exit 0 and an empty output file, because the soup-serve reader walks a directory and quietly returns nothing for a single file. They claimed the issue, took the smaller of the two proposed fixes (refuse the file at the CLI, naming `--logs`, the directory `soup serve --trace-log` writes and the `--format langchain`/`openai` alternative), added a `Read 0 trace(s) from --logs '<path>' ...` line with a per-format reason whenever a source reads nothing, and left the zero-pair exit code alone as the issue asked. **The part worth copying is the scoping**: the parser keeps the behaviour its own tests pin, two controls prove the refusal is not wider than the bug, and on review they fixed a misleading reason for a directory under a file format ("no line parsed" when nothing had been opened) in the same push. 8 tests (6 fail on `main`, the 2 controls pass), 6 of 9 mutations killed ([#1530](https://github.com/MakazhanAlpamys/Soup/issues/1530), [#1557](https://github.com/MakazhanAlpamys/Soup/pull/1557))
+
+- **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))
+
---
Want to join this list? See [CONTRIBUTING.md](CONTRIBUTING.md) — good first issues are