Skip to content

router: e-detector threshold with run-length meaning; benches at real sizes - #5

Merged
SMC17 merged 1 commit into
mainfrom
fix/router-detector-and-bench
Nov 20, 2026
Merged

SMC17 merged 1 commit into
mainfrom
fix/router-detector-and-bench

Conversation

@SMC17

@SMC17 SMC17 commented Nov 20, 2026

Copy link
Copy Markdown
Owner

Fixes #3.

  • Router. The Bernoulli likelihood ratio is an e-value at failure rate p0, so the CUSUM threshold is a mean-run-length bound, not an α. The default threshold is raised from 20 to 1000, and a new test checks that E[LR] = 1 and where it trips.
  • Pruner bench. buildLogitMask is now also measured on a 32,000-token vocabulary: 419–467 µs/step. The 8-token case is 82–88 ns, and that was the old headline.
  • Mask bench. NumPy is now the comparator: ctypes is ~14× faster than NumPy (0.0177 vs 0.25 ms/step on 128,256 logits). The pure-Python loop is labelled a strawman.

Checked on Zig 0.16.0, M2 Max: 7/7 tests; Node WASM and Python ctypes smoke tests pass. README and llms.txt updated.

🤖 Generated with Claude Code

…asure real sizes

- CascadeRouter: the Bernoulli LR is an e-value at failure rate p0, so the CUSUM
  threshold is a mean-run-length bound. Default 20 -> 1000; comments no longer claim
  alpha. New test checks E[LR] = 1 and the trip point.
- bench: adds buildLogitMask on a 32,000-token vocabulary (~0.45 ms/step) next
  to the 8-token case.
- bench_128k.py: adds the NumPy comparator (~14x slower than ctypes) and labels
  the pure-Python loop as a strawman.

Fixes #3.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@SMC17

SMC17 commented Nov 20, 2026

Copy link
Copy Markdown
Owner Author

Gate report: PASS

PR head main
commit 360c4f8 2dca694
gate pass pass
tests passed 7 6
tests failed 0 0
tests skipped 0 0
  • zig build test --summary all exit 0

Run with python3 ops/pr_gate.py specdecode 5 from SMC17/SMC17 (8 s for the PR head).

@SMC17
SMC17 merged commit 1e7337f into main Nov 20, 2026
1 check failed
@SMC17
SMC17 deleted the fix/router-detector-and-bench branch November 20, 2026 05:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Cascade router is CUSUM, not SPRT/e-process; bench numbers do not measure what README says

1 participant