mixle.experimental.selective_scan module¶
E5 (part 1): the selective-scan (S6 / Mamba) module – a third ContextMechanism (see
mixle/experimental/context_spine.py) alongside E1’s SlidingWindowSpine, targeting long, smooth,
low-curvature dependencies that don’t compress into a fixed local window. See notes/designs/E5.md for
the full design: why input-DEPENDENT (selective) Delta, A, B, C – not S4’s fixed, input-independent
recurrence – is the property this mechanism exists for, why mamba-ssm is not a realistic dependency on
this machine (no CUDA toolkit), and the exact S4D-real initialization this module uses.
_scan_layer is the ONE S6 recurrence implementation (a literal sequential Python loop over T, v1
per the design note’s explicit scope decision – a chunked/parallel scan is documented future work, not
attempted here); both SelectiveScan.step() and mixle.experimental.ssm_hybrid.HybridBlock’s SSM
branch call it, so there is exactly one scan, not two.
- class SelectiveScanState(h=<factory>, batch_size=0, pos=0)[source]
Bases:
objectPer-layer recurrent state
h((batch, d_inner, d_state),Noneuntil the firststep) plus the running absolute position counter – the SSM analogue ofSlidingWindowState’s KV cache, except the state is already fixed-size (no window/cache-length bookkeeping needed).