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.

fix(eval)[#1192]: give `mini_arithmetic` headroom below the 1.000 rail(1/5) (#1462)

Aaron Probhabec4369c4c5a
diff --git a/benchmarks/README.md b/benchmarks/README.md
index 29e2861d..312f29f3 100644
--- a/benchmarks/README.md
+++ b/benchmarks/README.md
@@ -30,6 +30,7 @@ They are the evidence behind the preprint:
| [`gate-v0.73.2-leg2-scoring.md`](gate-v0.73.2-leg2-scoring.md) | `soup ship`'s leg-2 scorers — the release gate itself, not streaming | A suite scored **0.000** for a stub answering every item *correctly*, twice over: `\boxed{C}` was unknown to the MCQ extractor, and a tool call one closing brace short fell through to the inner object. Two models with **byte-identical** scores on all seven suites, one refusing every benign request, were indistinguishable to the gate. The measured noise floor on this box is **0.0000** — CPU greedy decode is deterministic, and the H100's 0.015/0.020 is explicitly *not* re-claimed here. Carries a **withdrawn** order-dependence scare, a control that varied nothing, and a review finding that was checked against three implementations and **partly rejected** |
| [`gate-v0.76.0-cuda-graph-decode.md`](gate-v0.76.0-cuda-graph-decode.md) | Opt-in CUDA graph decoding for `soup infer` / `soup bench infer` (`--cuda-graphs`), gated UNPINNED against the same-day tree without the flag, A-B-B-A-B-A in fresh processes, on the RTX 5070 box | **All four pre-declared criteria passed**: Qwen2.5-1.5B FP16 decode, slowest graph run **2.90x** the fastest baseline run (60.10 vs 20.71 tok/s), **2.76x** under an unmerged LoRA (49.19 vs 17.80), +42 / +40 MiB reserved, identical token IDs on all 84 harness requests; `soup infer` end to end over 24 varied prompts, load and compile included, 282 / 131 s -> 102 / 96 s with identical responses. Keeps the pinned bridge to the experiment's 32.16 -> 62.57 (31.29 -> 65.64 here), the finding that the UNPINNED baseline is the unstable arm (13.5-20.7 tok/s run to run against 4% for graphs), and a 1024-row re-record probe showing no eager fallback and flat memory. Launched from the agent session in the background, not the owner's foreground window; the record says so |
| [`gate-v0.76.0-tool-call-discrimination.md`](gate-v0.76.0-tool-call-discrimination.md) | `mini_tool_call` discrimination after #405 | Qwen2.5-7B-Instruct moves from the shipped 1.000 ceiling to **0.850 (34/40)** while SmolLM2-135M-Instruct scores **0.050 (2/40)**; the record keeps the rejected 0.969 candidate and the provenance-scale change. |
+| [`gate-v0.76.0-arithmetic-discrimination.md`](gate-v0.76.0-arithmetic-discrimination.md) | `mini_arithmetic` discrimination for #1192 | Qwen2.5-1.5B-Instruct scores **0.800 (32/40)** and SmolLM2-135M-Instruct **0.375 (15/40)** on the revised fixture; half the strong-model misses are 256-token truncation, and no 7B measurement is claimed. |
| [`run-m1-8gb-mlx-sft.md`](run-m1-8gb-mlx-sft.md) | Not a gate — the MLX backend's training loop on hardware CI does not have | `MLXSFTTrainerWrapper` runs end to end on an **8 GB M1**, and the shipped `llama3.1-8b-sft-mlx` recipe **fits**: peak **5.154 GB**, 48 iterations in 71 s. A model too large does **not** fail here, it pages — free memory sat at 5-6% while the machine stayed responsive, so an allocation-failure pre-flight would not fire (the #649 trap from the other platform). Carries a **failed fixture** — the model id #23 itself recommends ships legacy `weights.NN.safetensors` and cannot be loaded — and two **corrections** I made mid-measurement |
| [`gate-qwen4-ple-m4-max.md`](gate-qwen4-ple-m4-max.md) | Qwen4-Exp/oQ decoder mapping and read-only PLE on Apple Silicon | **Partial pass only:** 1,167/1,167 cached tensors and tiny CPU/MPS parity passed; the production optimizer step was stopped and is explicitly **not validated** |
| [`gate-h100-validation.md`](gate-h100-validation.md) | The method on someone else's hardware: bit-exactness at real sizes, convergence quality, DeepSpeed, variance | **Forward** bit-exact to 72B; **backward** bit-exact to 14B NF4 pre-repair, re-gated after the STEP 14 fix at 32B (256/256) **and at 72B (320/320, the size where the defect was worst)**; 2.93x DeepSpeed ZeRO-3 offload in 9.7x less VRAM; and the silent wrong-gradient defect that fix repairs. **Carries three dated 2026-08-13 corrections**: it explains the H100 replication as host-to-device transfer, which the probe record above later measured and refuted. The original lines are left standing with the correction beside them |
diff --git a/benchmarks/gate-v0.76.0-arithmetic-discrimination.md b/benchmarks/gate-v0.76.0-arithmetic-discrimination.md
new file mode 100644
index 00000000..98039aed
--- /dev/null
+++ b/benchmarks/gate-v0.76.0-arithmetic-discrimination.md
@@ -0,0 +1,90 @@
+# v0.76.0 gate: arithmetic discrimination (#1192)
+
+`mini_arithmetic` had reached a ceiling: the #1111 record measured the strong
+reference at **1.000 (36/36)** on the shipped fixture. This record measures the
+revised 40-row fixture on two models, neither of which sits on a rail.
+
+## Environment and method
+
+- Apple M1, 32 GB unified memory; macOS
+- checkpoint-native dtype (`dtype="auto"`), greedy decoding,
+ `BEHAVIOURAL_MAX_NEW_TOKENS` (256) new-token cap
+- strong reference: `Qwen/Qwen2.5-1.5B-Instruct`
+- weak reference: `HuggingFaceTB/SmolLM2-135M-Instruct`
+
+Each model was loaded once through `live_eval.make_generator` and scored with
+`score_bundled_suite` over every bundled suite, on the same machine.
+
+**The strong reference is not the #1111 one.** Qwen2.5-7B-Instruct did not run
+on this machine, so these numbers show that the fixture leaves the rails for a
+1.5B model. They do not show that a 7B model is off the ceiling.
+
+## Fixture
+
+The first 24 single-step rows of the v0.73.2 fixture are kept. The remaining
+12 are replaced by 16 multi-step or large-operand rows (multi-digit products,
+order of operations, compound percentages, remainders, LCM, fraction sums,
+digit counting). No new answer appears as a standalone token in its own
+question, so a model that echoes the prompt cannot score.
+
+## Result
+
+| Fixture | Rows | Qwen2.5-1.5B-Instruct | SmolLM2-135M-Instruct |
+|---|---:|---:|---:|
+| revised fixture | 40 | **0.800 (32/40)** | **0.375 (15/40)** |
+
+SmolLM2 solved 15 of the 24 kept rows and none of the 16 new ones.
+
+Qwen2.5-1.5B missed 8 rows. Row numbers are 0-based indices into
+`MINI_ARITHMETIC`; index 24 is the first new row (`47 x 38`).
+
+| Row | Kind | Failure |
+|---:|---|---|
+| 21 | kept | wrong answer (10 percent of 200 -> 5) |
+| 24 | new | wrong product (47 x 38 -> 1796) |
+| 25 | new | wrong product (1234 x 56 -> 70064) |
+| 31 | new | wrong product (999 x 999 -> 994009) |
+| 29 | new | truncated at 256 tokens before stating an answer |
+| 37 | new | truncated at 256 tokens before stating an answer |
+| 38 | new | truncated at 256 tokens before stating an answer |
+| 39 | new | truncated at 256 tokens before stating an answer |
+
+Half of the strong-model misses are the token budget, not the arithmetic. The
+leg-2 gate generates under the same 256-token cap, so this is how `soup ship`
+scores these rows, but a verbose model can lose them without an arithmetic
+error.
+
+## Bundled-suite check
+
+| Suite | Qwen2.5-1.5B-Instruct | SmolLM2-135M-Instruct |
+|---|---:|---:|
+| `mini_mmlu` | 1.000 (26/26) | 0.269 (7/26) |
+| `mini_common_sense` | 0.958 (23/24) | 0.208 (5/24) |
+| `mini_instruction` | 1.000 (24/24) | 0.542 (13/24) |
+| `mini_arithmetic` | 0.800 (32/40) | 0.375 (15/40) |
+| `mini_tool_call` | 0.700 (28/40) | 0.100 (4/40) |
+| `mini_format_json` | 0.975 (39/40) | 0.775 (31/40) |
+| `mini_safety` | 1.000 (40/40) | 0.000 (0/40) |
+| `mini_over_refusal` | 0.950 (38/40) | 1.000 (40/40) |
+
+Only `mini_arithmetic` changed in this fixture. The run predates #1335, which
+changed the refusal classifier behind `mini_safety` and `mini_over_refusal`,
+so those two rows are on the pre-#1335 scorer; `mini_arithmetic` does not use
+that classifier and is unaffected. SmolLM2's untouched suites
+differ from the #1111 record by one or two rows (for example `mini_mmlu` 7/26
+here, 8/26 there), which is machine and stack drift between an M1 and an
+M4 Max. Compare scores within one record, not across records.
+
+## Baseline provenance
+
+`BUNDLED_SCORER_REVISION` moves from 3 to 4 so a baseline stamped at revision 3
+warns rather than being compared on the old scale. The deterministic
+fingerprint does not move: its corpus fixes each row's correctness by index
+parity, and 20/40 scores the same as 18/36.
+
+## What this record does not establish
+
+- That Qwen2.5-7B-Instruct, or any model at the #1111 strong point, scores
+ below 1.000 on the revised fixture.
+- That the four truncated rows measure arithmetic rather than verbosity.
+- Anything about the other saturated suites, which remain with #1192.
diff --git a/changelog.d/0.75.1/1462.fixed.md b/changelog.d/0.75.1/1462.fixed.md
new file mode 100644
index 00000000..0cac59e9
--- /dev/null
+++ b/changelog.d/0.75.1/1462.fixed.md
@@ -0,0 +1,5 @@
+- **`mini_arithmetic` no longer sits at a 1.000 ceiling (#1192 by @AaronProbha18 in #1462).**
+ The 40-row suite replaces 12 single-step rows with 16 multi-step and
+ large-operand ones; Qwen2.5-1.5B-Instruct measures 0.800 against 0.375 on
+ SmolLM2-135M-Instruct, and the bundled scorer provenance revision moves to 4
+ so pre-change baselines are not silently compared on the new scale.
diff --git a/src/soup_cli/eval/forgetting.py b/src/soup_cli/eval/forgetting.py
index 2ca4daef..77305adc 100644
--- a/src/soup_cli/eval/forgetting.py
+++ b/src/soup_cli/eval/forgetting.py
@@ -316,18 +316,31 @@ MINI_ARITHMETIC: MiniBenchmark = [
{"question": "What is 10 percent of 200?", "answer": "20"},
{"question": "What is 16 + 25?", "answer": "41"},
{"question": "What is 90 divided by 3?", "answer": "30"},
- {"question": "What is 7 times 6?", "answer": "42"},
- {"question": "What is 50 + 50?", "answer": "100"},
- {"question": "What is 13 - 7?", "answer": "6"},
- {"question": "What is 4 times 25?", "answer": "100"},
- {"question": "What is 18 + 24?", "answer": "42"},
- {"question": "What is 64 divided by 8?", "answer": "8"},
- {"question": "What is 9 times 8?", "answer": "72"},
- {"question": "What is 1000 - 1?", "answer": "999"},
- {"question": "What is 3 cubed?", "answer": "27"},
- {"question": "What is 40 + 60?", "answer": "100"},
- {"question": "What is 21 divided by 7?", "answer": "3"},
- {"question": "What is 12 times 12?", "answer": "144"},
+ # #1192 — the 24 single-step rows above put a capable model at 1.000
+ # (Qwen2.5-7B-Instruct, 36/36 in the #1111 gate record),
+ # so the suite could not see a numeracy regression. The rows below are
+ # multi-step or large-operand; no answer appears as a token in its own
+ # question, so echoing the prompt cannot score.
+ {"question": "What is 47 times 38?", "answer": "1786"},
+ {"question": "What is 1234 times 56?", "answer": "69104"},
+ {"question": "What is 7 + 3 times 4 - 6 divided by 2?", "answer": "16"},
+ {"question": "A shirt costs 80 dollars. It is discounted by 25 percent, then the "
+ "discounted price is raised by 25 percent. What is the final price "
+ "in dollars?", "answer": "75"},
+ {"question": "What is 2 to the power of 15?", "answer": "32768"},
+ {"question": "What is the remainder when 2024 is divided by 37?", "answer": "26"},
+ {"question": "How many seconds are in 3 days?", "answer": "259200"},
+ {"question": "What is 999 times 999?", "answer": "998001"},
+ {"question": "What is the sum of all the whole numbers from 1 to 250?", "answer": "31375"},
+ {"question": "What is 17 squared minus 13 squared?", "answer": "120"},
+ {"question": "A train leaves at 9:47 and arrives at 14:12 the same day. How many "
+ "minutes long is the trip?", "answer": "265"},
+ {"question": "What is 15 percent of 15 percent of 4000?", "answer": "90"},
+ {"question": "What is 123456789 divided by 9?", "answer": "13717421"},
+ {"question": "What is the least common multiple of 18, 24 and 40?", "answer": "360"},
+ {"question": "What is 3/8 plus 5/12, as a fraction in lowest terms?", "answer": "19/24"},
+ {"question": "How many times is the digit 7 written when you write out every whole "
+ "number from 1 to 100?", "answer": "20"},
]
MINI_BENCHMARKS: dict[str, MiniBenchmark] = {
diff --git a/src/soup_cli/eval/gate_suites.py b/src/soup_cli/eval/gate_suites.py
index a691eac1..85e4397a 100644
--- a/src/soup_cli/eval/gate_suites.py
+++ b/src/soup_cli/eval/gate_suites.py
@@ -94,11 +94,13 @@ DEFAULT_GENERAL_SUITE: Tuple[str, ...] = tuple(MINI_BENCHMARKS) + EXTENDED_SUITE
#: Bump this integer in the **same change** that alters a bundled scorer's
#: behaviour, and update ``BUNDLED_SCORER_FINGERPRINT`` with it. The revision
#: test fails if a scorer's output moves without the revision moving.
-BUNDLED_SCORER_REVISION: int = 3
+BUNDLED_SCORER_REVISION: int = 4
#: SHA-256 of deterministic ``score_bundled_suite`` outputs under the fixed
-#: fingerprint corpus in ``bundled_scorer_fingerprint``. Locked to revision 3;
-#: update together with ``BUNDLED_SCORER_REVISION``.
+#: fingerprint corpus in ``bundled_scorer_fingerprint``. Locked to revision 4;
+#: update together with ``BUNDLED_SCORER_REVISION``. Revision 4 (#1192) changed
+#: ``mini_arithmetic``'s items, not a scorer: the corpus fixes correctness by
+#: item parity, so the hash did not move, but old baselines are on the old scale.
BUNDLED_SCORER_FINGERPRINT: str = (
"80992ac0369233b36d82e41c6f2baff510f6331a6647329fa139c4a99259d5c4"
)
diff --git a/tests/test_issue1192_arithmetic_discrimination.py b/tests/test_issue1192_arithmetic_discrimination.py
new file mode 100644
index 00000000..6fb983ab
--- /dev/null
+++ b/tests/test_issue1192_arithmetic_discrimination.py
@@ -0,0 +1,75 @@
+"""#1192 — bundled mini_arithmetic must discriminate away from the 1.000 rail."""
+
+from __future__ import annotations
+
+import math
+from fractions import Fraction
+
+from soup_cli.eval.forgetting import MINI_ARITHMETIC, _standalone_match, score_answer
+
+# The multi-step rows that took the strong reference off the ceiling. Dropping
+# any of them (or restoring the v0.73.2 single-step set) fails this file.
+_HARD_ANSWERS = {
+ "1786", "69104", "16", "75", "32768", "26", "259200", "998001",
+ "31375", "120", "265", "90", "13717421", "360", "19/24", "20",
+}
+
+
+class TestArithmeticFixtureHasHeadroom:
+ def test_fixture_keeps_40_rows(self):
+ assert len(MINI_ARITHMETIC) == 40
+
+ def test_the_last_16_rows_are_the_hard_set(self):
+ assert {item["answer"] for item in MINI_ARITHMETIC[-16:]} == _HARD_ANSWERS
+
+ def test_questions_are_unique(self):
+ questions = [item["question"] for item in MINI_ARITHMETIC]
+ assert len(questions) == len(set(questions))
+
+ def test_no_hard_answer_is_echoed_by_its_question(self):
+ # score_answer is a standalone-token match anywhere in the output, so a
+ # model that repeats the question would score any answer it contains.
+ for item in MINI_ARITHMETIC[-16:]:
+ assert not _standalone_match(item["question"], item["answer"]), item
+
+ def test_every_expected_answer_scores(self):
+ for item in MINI_ARITHMETIC:
+ assert score_answer(f"The answer is {item['answer']}.", item["answer"]), item
+
+
+def test_fixture_change_bumps_baseline_provenance_revision():
+ from soup_cli.eval.gate_suites import BUNDLED_SCORER_REVISION
+
+ assert BUNDLED_SCORER_REVISION >= 4
+
+
+# Every hard row's key, recomputed by Python from the numbers in its question.
+_HARD_TRUTH = {
+ "What is 47 times 38?": 47 * 38,
+ "What is 1234 times 56?": 1234 * 56,
+ "What is 7 + 3 times 4 - 6 divided by 2?": 7 + 3 * 4 - 6 // 2,
+ "A shirt costs 80 dollars. It is discounted by 25 percent, then the "
+ "discounted price is raised by 25 percent. What is the final price "
+ "in dollars?": int(80 * Fraction(3, 4) * Fraction(5, 4)),
+ "What is 2 to the power of 15?": 2**15,
+ "What is the remainder when 2024 is divided by 37?": 2024 % 37,
+ "How many seconds are in 3 days?": 3 * 24 * 60 * 60,
+ "What is 999 times 999?": 999 * 999,
+ "What is the sum of all the whole numbers from 1 to 250?": sum(range(1, 251)),
+ "What is 17 squared minus 13 squared?": 17**2 - 13**2,
+ "A train leaves at 9:47 and arrives at 14:12 the same day. How many "
+ "minutes long is the trip?": (14 * 60 + 12) - (9 * 60 + 47),
+ "What is 15 percent of 15 percent of 4000?": int(4000 * Fraction(15, 100) ** 2),
+ "What is 123456789 divided by 9?": 123456789 // 9,
+ "What is the least common multiple of 18, 24 and 40?": math.lcm(18, 24, 40),
+ "What is 3/8 plus 5/12, as a fraction in lowest terms?": Fraction(3, 8) + Fraction(5, 12),
+ "How many times is the digit 7 written when you write out every whole "
+ "number from 1 to 100?": sum(str(n).count("7") for n in range(1, 101)),
+}
+
+
+def test_every_hard_row_key_is_what_python_computes():
+ rows = {item["question"]: item["answer"] for item in MINI_ARITHMETIC[-16:]}
+ assert set(rows) == set(_HARD_TRUTH), set(rows) ^ set(_HARD_TRUTH)
+ for question, value in _HARD_TRUTH.items():
+ assert rows[question] == str(value), question