← Lab
scanhorizon
confirmedshipPython · PyTorch · Apple M4Inference & servingJuly 22, 2026
the question
Do the two algebraically identical forms of a selective-SSM scan diverge in floating point at an exact dtype-dependent overflow length?
what came out
The associative scan stays bounded and never overflows, while the divide-out-the-gate form overflows at exactly L*=floor(ln(realmax)/(|A|dt)), matching to the integer (fp16 hits 3 tokens at |A|dt=3). On the M4 GPU Metal's cumprod rounds hotter, so overflow arrives a few positions earlier (174 vs 177).
method & receipts
- Result: confirmed
- Tested — a correctness/benchmark suite ships alongside the code.
→ read the code and re-run it
github.com/v-code01/scanhorizon