bench: kernel-level SC MSE profiling + ablation tooling#21
Open
heroarmor wants to merge 1 commit into
Open
Conversation
Adds bench/ with a unit-level error harness for sc_matmul vs exact a @ b.T on real operand tensors captured from a model: * capture_real_tensors.py - hook a HF model's Linears, dump (a, b) pairs * mse_profile.py - per-config error sweep (MSE/RMSE/maxabs/rel_fro/cos) * ablation.py - stoc_len x halve x scramble grid, mean MSE + summaries * README.md - method, usage, results table, findings Findings (Llama-3.1-8B operands): scramble (bitrev>=counter>>off) is increasingly essential as the stream shortens (+1063% MSE @ stoc_len=16 if removed); halve (RNG grid 256->128) is free/net-win for bipolar; best config is halve+bitrev across the grid. Captured .pt and run logs are gitignored (regenerable). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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.
Adds a
bench/directory with a unit-level error harness forsc_matmulvs the exacta @ b.T, on real operand tensors captured from a model (no model forward in the sweep loop).Contents
capture_real_tensors.py(a,b)operand pairsmse_profile.pyablation.pystoc_len × halve × scramblegrid, mean MSE + scramble-effect / halve-cost summariesREADME.mdFixed:
per_row,bipolar,sc_prec=8,chunk_d=128. Callsclear_rng_cache()before every measured matmul (cache isn't keyed by scramble mode).Findings (Llama-3.1-8B operands, mean MSE over 21 tensors)
bitrev ≳ counter ≫ off) is increasingly essential as the stream shortens: +0% @256 → +378% @64 → +1063% @16 MSE if removed. No-op at 256 (sanity control).2^(prec-1)levels.Captured
.pt(1.3 GB) and run logs are.gitignored — regenerate withcapture_real_tensors.py.🤖 Generated with Claude Code