Repository navigation
Round the Hopper accumulation constant up and rerun its replays - #139
Merged
Merged
Conversation
The R-stock and self-evidence replays and the divergence classification hard-coded the Hopper wgmma model's gamma as 1.19e-4. The model's value, (1 + 17 * 2^-25 + 2^-23)^160 (1 + 2^-23)^160 - 1, is 1.19216e-4, so the replays used a bound 0.18% below the one they claim. precision_reference.hopper_wgmma_gamma now computes it as an exact rational and float_up rounds it up to binary64; analyze_rstock.py, analyze_selfevidence.py (through bounds.hopper_gamma) and mechanism.py use that value. The R-stock evidence key 'gamma_1.19e-4' keeps its name, which still names the value to three digits. A test derives the constant independently and checks it is the smallest binary64 value at or above it.
Reran from their recorded commands at 0769b2b: analyze_rstock.py, the three analyze_selfevidence.py sets (plain4b, mtp4b, dflash4b) with their CCDF exports, and mechanism.py for every state summary that records the Hopper model. No share, batch share, candidate count or divergence class changed; the CSV, CCDF and history_v4 files and the per-row arrays are byte-identical. Only the recorded gamma, the Hopper gap bounds (up 0.18%) and elapsed times moved. The rerun of the current mechanism.py also records data paths relative to ~/vp-data/state, adds first_logprob_difference per case and mismatched_ids to the v3 tap checks. The READMEs record the commit, the regeneration commands, and the Hopper constant rounded up (1.1922e-4).
\ghop was 1.19e-4 against the derived 1.19216e-4, and the proof appendix disclosed that the replays used that rounded-down value. The replays now use the derived value rounded up (previous commits), so \ghop becomes 1.193e-4 and the Hopper bullet says how the replays compute it. \gcons moves from 6.1e-4 to 6.11e-4 for the same reason: gamma_2D(2^-23) is 6.1072e-4. The wgmma-only intermediate is marked as approximate. No quoted share or class count changes: the reruns left every count identical.
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
Owner
Author
|
Verdict: APPROVE Review of the exact head bdf011b: 0769b2b (code), e35258a (evidence), a main merge (122f494), and bdf011b (paper).
|
SamMausberg
added a commit
that referenced
this pull request
Oct 1, 2026
SamMausberg
added a commit
that referenced
this pull request
Oct 1, 2026
This was referenced Oct 1, 2026
This was referenced Oct 1, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The defect
The paper's Hopper accumulation model (Khattak and Mikaitis's BF16
wgmmaadder, k = 16, F = 25, truncation, plus an FP32 split-K allowance) givesgamma = (1 + u_v)^160 (1 + 2^-23)^160 - 1, u_v = 17 * 2^-25 + 2^-23,
which is 1.192163627848e-4 as an exact rational. The paper quoted it as
\ghop= 1.19e-4, and the replays hard-coded that value (analyze_rstock.py,analyze_selfevidence.pykeygamma_1.19e-4,mechanism.py'hopper': 1.19e-4). That is 0.18% below the derived value, so every share reported "under the Hopper model" was computed with a bound smaller than the one the model gives.app_proofs.texdisclosed this; a certificate's error bound has to cover the derived value instead.The fix
src/precision_reference.py:hopper_wgmma_gamma(n)computes the model's gamma exactly (Fractions) for an n-term dot product;float_up(x)rounds a Fraction up to binary64. At n = 2560 the result is 0.00011921636278483056, which here coincides with round-to-nearest.experiments/head_geometry/bounds.py:hopper_gamma(dim)wraps the two for the stock head GEMM (no scale multiply).analyze_rstock.pyandanalyze_selfevidence.pyuse it.experiments/state_safety/mechanism.py:error_modelstakes the Hopper value from the same helper (it now putssrc/onsys.path, asbounds.pydoes).gamma_1.19e-4keeps its name for stability; it still names the value to three digits, andgammas/rstock_gammasrecord it exactly. The geometry README says so.tests/test_state_safety_mechanism.py: derives the constant independently from its definition and checks that the value the analysis uses is the smallest binary64 at or above it.\ghop= 1.193e-4 (rounded up at the quoted precision). The Hopper bullet in Appendix A.2 drops the "used exactly that rounded value" disclosure and says the replays compute the value exactly and round it up to the next double; the wgmma-only intermediate (about 1.0014e-4) is now written with\approx. At the integrator's request,\gconsalso moves from 6.1e-4 to 6.11e-4, since gamma_2D(2^-23) = 6.1072e-4 and no displayed bound constant should be rounded down. The replays already used 6.1120e-4 (conservative fused-adder maximum plus one scale multiply) and 6.1072e-4 (mechanism.py), so no rerun was needed for it.What was rerun
Code first (commit
0769b2b), then each analysis from its recorded command at that commit, CPU only, undergpu_lock.sh -s(priority granted by the integrator). The branch was then merged with main rather than rebased, so0769b2bstays in its history; the generator files are identical at the head.Head geometry, from
experiments/head_geometry/:python analyze_rstock.py --device cpu --out ../../evidence/head_geometry/rstock_plain4b.json python analyze_selfevidence.py --device cpu --threads 40 --sets plain --max-rows 6000 --chunk 64 --out ../../evidence/head_geometry --tag plain4b python analyze_selfevidence.py --device cpu --threads 40 --sets verify draft --max-rows 4000 --chunk 64 --heads int8_row int8_g128 int8_g32 fp8_row int4_g128 int4_g32 --out ../../evidence/head_geometry --tag mtp4b python analyze_selfevidence.py --device cpu --threads 40 --sets dflash_verify dflash_draft --max-rows 4000 --chunk 64 --heads int8_row int8_g128 int8_g32 fp8_row int4_g128 int4_g32 --out ../../evidence/head_geometry --tag dflash4b python export_candidate_ccdf.py --tag {plain4b,mtp4b,dflash4b} --out ../../evidence/head_geometry/selfevidence_{tag}_ccdf.csvState, from
experiments/state_safety/:mechanism.pyfor all nine summaries that record the Hopper model (mechanism_plain_c1_vs_{mtp_s3_c1,c32}.json,tap_control_{down9,core13,core13_decode}.json,cachecheck_v4_*.json,history_v4_*.json). The v3 commands were not recorded anywhere; I reconstructed them from each summary's run paths and options and added them toevidence/state_safety/README.md("Regenerating the classification"). The v4 commands are the analysis lines ofrun_tap_v4.sh.Before and after
No count changed in any file. The same rows fail the gap and interval rules, and the same divergences fall in each class, so every quoted number is unchanged, not only at the quoted precision.
What did change in the regenerated files:
gammas,rstock_gammas), and every Hoppergap_bound_*in the state cases, which grew by exactly 1.19216.../1.19 = 1.0018;elapsed_s;selfevidence_plain4b.jsongainsreached_rows(6005), and the v3 state summaries now record data paths relative to~/vp-data/state, carryfirst_logprob_differenceper case, and list the five tap-changed prompts asmismatched_ids(the five already named in the README).The CSVs, CCDF files,
history_v4_*.jsonand the per-row arrays in~/vp-data/geometry/analysisare byte-identical.pools.jsonregenerated from the new summaries is identical too, andfirst_difference_by_module.csvreads only fields that did not change.Paper text that quotes Hopper-model results (Table 4's Hopper row, Section 4.4, the introduction's 0.35%, the discussion's 5.7% and 2.8%, Figure 2(b)'s
\phop, Table 14's class counts) needed no change beyond the\ghopmacro.PR #45 check (not edited)
On #45 at 647427e, every kernel-facing constant rounds upward:
KernelConstantsand the envelope coefficients usefloat_up,f32_upandround_up_f32(bounds.pyaround lines 212-226, 280-281, 343-347), andfallback_vs_model.pypassesf32_upof each gamma. Its Hopper value bounds both factors with Higham's gamma_n, giving 1.1922159e-4, 5.2e-9 above the exact product used here, so the kernel's constant covers the replays'. Fourfloat()round-to-nearest conversions remain (stock_invariance.py:127-128, reporting only;selftest.py:67andtma_candidates.py:75,239, test tolerances from the conservative model). Each converts a Higham bound n u / (1 - n u), which exceeds (1 + u)^n - 1 by far more than one ulp, so they stay sound. The kernel agent has fixed the stale "1.19e-4" infallback_vs_model.py's docstring on its branch.The same argument covers the replays' existing conservative and FP32-tree values from
bounds.accumulation_gamma, which also usefloat(): both are at or above the model's (1 + u)^d - 1.Validation
pytest tests/test_state_safety_mechanism.py: 5 passed, including the new test.pre-commit runon every changed file: passed (ruff, mypy, codespell, host-identity guard).latexmk: 0 warnings, 81 pages, main text ends on p10, References on p11.scripts/check_paper_references.py: clean.