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): #1733, #1737, #1738, #1739 [skip ci]

Alpamysc1cf0d47a57a
diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md
index 02c488e1..3574d9c5 100644
--- a/CONTRIBUTORS.md
+++ b/CONTRIBUTORS.md
@@ -163,6 +163,7 @@ Listed by first contribution. PR numbers link the work.
- 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))
+ - Issue #1721: nothing told you whether an adapter had learned anything before you spent an eval or a merge on it, and the failure is silent, since an adapter whose `lora_B` never left zero loads, merges and serves like a trained one. They built `soup adapters check`: total and per-layer ||ΔW||_F by the trace identity in float64, live-layer fraction, all-zero `lora_B`, incomplete and shape-mismatched pairs, non-finite weights and leaked `.inner.` wrapper keys, ending in one line, `alive` or `inactive: <reason>` (exit 0 / 2). It took three review rounds to pin every guard rather than most of them: float32 accumulation, both symlink checks, the `--json` fields, the scaling division, the live-fraction denominator, the Conv1D branch and the root-sum-square total each got a test that fails when it is removed, then the zero-delta verdict (an all-zero `lora_A` had reported `alive`) and the control-byte stripping at every rendered name, and the `FORCE_COLOR=1` collision between Rich's colour codes and the injected-ESC assertions was fixed by pinning the stderr console. 30 tests; 28 of 32 mutations fail a named test and the other four are redundant defence or equivalent ([#1721](https://github.com/MakazhanAlpamys/Soup/issues/1721), [#1738](https://github.com/MakazhanAlpamys/Soup/pull/1738))
- **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))
@@ -367,6 +368,7 @@ Listed by first contribution. PR numbers link the work.
- Made every documented `soup` invocation resolve in the live CLI. They corrected six spellings from the issue and about sixteen more the reviews surfaced, and wrote a guard that walks the Click tree over every `soup ...` line and inline span in `docs/*.md` and `README.md` and every recipe description. It handles global options, `--no-*` flags, groups that run on their own, routed default subcommands, aligned columns and `VAR=value` prefixes. Over three rounds every gap came back closed with a control row. On the final head the guard, #979's guard and the translation sync test give 111 passed on the merged tree, and 12 of 12 mutations are caught ([#1465](https://github.com/MakazhanAlpamys/Soup/issues/1465), [#1578](https://github.com/MakazhanAlpamys/Soup/pull/1578))
- Filed #1393 from the #1145 measurements and then fixed it: DPO built `AutoModelForCausalLM` whatever `modality` said, so a vision-language wrapper checkpoint (MiniMax-M3) could not load in DPO. They gave the DPO wrapper SFT's vision path (processor, pad-token mirror, vocab expansion through the processor's tokenizer, LoRA on the language tower) and **answered the open trl question by measurement**: a real DPO step on a tiny LLaVA showed trl keys its vision collator on an `images` column, not on the processor, so text-only preference rows train. Review found the preflight answered DPO + `audio` wrongly (a green verdict for a config the trainer cannot load) and missed a `preference_loss_weights` blend led by dpo in both the preflight and the unsloth refusal; the fix was one per-trainer modality map plus resolving the blend by its largest weight in both places, with a control test against widening the refusal, and their re-measured mutation counts reproduced exactly. 17 of 19 mutations killed (the two survivors only change an equal-weight tie, which I recorded rather than blocked on), 111 tests in the two PR files, 2531 on a trial merge with `main` ([#1393](https://github.com/MakazhanAlpamys/Soup/issues/1393), [#1707](https://github.com/MakazhanAlpamys/Soup/pull/1707))
- Closed #1197, which they filed and measured: `training.moe_lora: true` with `lora.use_vera: true` adapted the attention projections exactly as VeRA without the flag did and still printed `ScatterMoE LoRA: targeting 7 module patterns`, because peft's `VeraConfig` wraps `nn.Linear` modules only and a transformers-5 MoE keeps its routed experts as fused 3-D parameters. **The part worth copying is that they took the maintainer's correction on their own numbers and kept the shape the data pointed to**: their 12 / 4 counted `lora_A` names (two per adapted layer), the true figure was 6 layers with 2 on experts, and Mixtral is fused at the transformers floor too, so the check is "VeRA wraps no routed expert", not #798's predicate. They claimed the issue, waited for #1590 to land because the refusal reads its `find_fused_expert_parameters`, and opened the PR rebased on it. The refusal sits in `resolve_moe_lora_targets` ahead of the dropout rule, so every MoE-wired trainer reaches it without a call-site change; it names both flags, the fused parameters and the two ways out, and leaves `use_vera` without `moe_lora`, a dense base and a one-`nn.Linear`-per-expert checkpoint alone. 15 tests on tiny real Qwen3-MoE, Mixtral, MiniMax and Qwen2-MoE models, 6 of them failing on `main`, including a refusal driven through the real DPO setup; on the head 3237 passed across 52 related files and all 11 source mutations are caught. One had survived their own set of five: nothing asserted the second way out in the message, and it took one assertion ([#1197](https://github.com/MakazhanAlpamys/Soup/issues/1197), [#1723](https://github.com/MakazhanAlpamys/Soup/pull/1723))
+ - Closed the two mutation survivors left by the review of #1707 with a test-only follow-up: an exact-weight `preference_loss_weights` blend is now pinned to follow its first-listed loss in both the loader pre-flight and the unsloth vision refusal, the way the trainer already breaks the tie; making either site prefer the last-listed loss fails exactly its new test ([#1393](https://github.com/MakazhanAlpamys/Soup/issues/1393), [#1739](https://github.com/MakazhanAlpamys/Soup/pull/1739))
- **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)).
@@ -390,6 +392,7 @@ Listed by first contribution. PR numbers link the work.
- Took the `soup data score` slice of [#1448](https://github.com/MakazhanAlpamys/Soup/issues/1448), an option that was validated, announced and then read by nothing: `--benchmarks` and `--threshold` were accepted and decontamination was always called with no texts, so the scorecard printed `Decontaminated 0` for any input. They added `--benchmark-file` and wired the supplied texts and the threshold to the real 8-gram kernel, refuse labels alone by name, and made the "not run" case say so instead of showing a zero. **What makes it worth keeping**: asked what the `-b` labels do once a file is given, they did not argue it — they put the answer in the help text, the docs, a printed note and a test — and every refusal (labels alone, malformed or non-object JSONL, a truncated file, an empty or unusable corpus) comes before a scorecard prints, so a bad corpus can no longer read as a clean result. 34 tests (22 fail on a clean `main`); 16 mutations of the wiring, the strict loader and the core validation, 16 killed ([#1448](https://github.com/MakazhanAlpamys/Soup/issues/1448), [#1518](https://github.com/MakazhanAlpamys/Soup/pull/1518))
- Closed #1718: `soup eval benchmark` started each tracker row from `score = 0.0`, so a benchmark that was missing from the lm-eval results, or present without a numeric metric, was stored as a measured zero and then reported as saved - and `soup eval compare` and `soup eval leaderboard` take the newest row per benchmark, so that zero replaced a real score. They took the accepted contract exactly and did not widen it: skip, name and count the unmeasured names (never refuse the whole run over one task), print the banner only when a row was saved and carry the count (`2 of 4`), exit 1 when nothing was saved, keep a real `0.0`, refuse a `bool` as a score (the `isinstance(True, int)` trap), and treat a group like any other requested name without saving its sub-tasks. **What makes it worth keeping**: the results table and the tracker now share one metric selector, so they can no longer disagree about what was measured, and the tests drive the real CLI against a real SQLite file with only lm-eval's reply stubbed, with the colour-stripping helper shown to be load-bearing under `FORCE_COLOR=1`. The only existing test touched was the trust-forwarding double, which changed its return value and nothing else. 20 tests; 17 of 17 mutations of the contract (each skip, the bool rule, the zero rule, the banner, the count, the exit code, the `for_terminal` routing at three sites, the group rule) are killed by a named test ([#1718](https://github.com/MakazhanAlpamys/Soup/issues/1718), [#1722](https://github.com/MakazhanAlpamys/Soup/pull/1722))
- `soup eval human` let a JSONL string or array that contained `"prompt"` through its loader, built both model generators, and then died with a `TypeError`. They reported it with a run of the real command, proposed and agreed a narrow scope before writing code, and added the object guard with the wording `eval/custom.py` already uses, so the error names the line before any model is loaded. 14 tests, including a CLI spy that no generator is built for a bad row; removing the guard fails 12 of them ([#1725](https://github.com/MakazhanAlpamys/Soup/issues/1725), [#1727](https://github.com/MakazhanAlpamys/Soup/pull/1727))
+ - 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))
- **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))
@@ -760,6 +763,7 @@ Listed by first contribution. PR numbers link the work.
- 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))
+ - 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)
- **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))