TopoMemory: Hysteretic Self-Locking for Long-Context Sequence Modeling
This work presents TopoMemory, a first-principles memory mechanism built from dynamical systems theory, targeting two core bottlenecks of long-context sequence modeling: the superlinear computational cost of standard full attention, and the uniform dilution of critical event signals across all positional weights. Rather than treating memory as a flat key-value cache, we reformulate it as a threshold-governed state evolution process with three defining components: a topological strength gate for selective event inscription, a path-dependent continuous memory field, and a dual-threshold hysteresis regime that creates self-locking stability, allowing retained critical events to persist through sustained noise without catastrophic dilution. We validate the proposal at both the dynamical and engineering levels. The architecture maintains strict linear time complexity with respect to sequence length. Implemented as an end-to-end trainable PyTorch module, the fully vectorized closed-form version delivers over 200× speedup relative to full attention at 10,000 tokens, with numerical alignment error below 10⁻⁷ compared to the reference pure-Python dynamical implementation. The code implementations accompanying this paper are available upon request from the author.
Authors
- Lei Zhang
Publication Details
- Journal
- Zenodo (CERN European Organization for Nuclear Research)
- Published
- 2026-11-25
- DOI
- https://doi.org/10.5281/zenodo.24529582
- Primary Topic
- Topic Modeling
- Type
- article
- Field-Weighted Citation Impact
- 0.00