A Conditional Small-State Memory Architecture for Efficient Long-Context Reasoning

This deposit contains the official PyTorch research scaffold, unit test suites, and formal mathematical proofs for Anamnesis—a resource-rational, budgeted long-context memory architecture combining Retentive Networks (RetNet), Block Attention Residuals (AttnRes), and Hashed N-gram Engram memory. Long-context language models must balance the low marginal cost of sequence streaming with high-fidelity exact recall of decision-critical states. This repository presents a complete proof-aligned implementation designed to explore budgeted memory boundaries without relying on a full Transformer Key- Value (KV) cache. Core Architectural Components 1. Time Axis (RetNet Streaming + Bounded Snapshots): Default sequence streaming handled by contractive recurrent states, augmented with a capped snapshot cache ($K_{\max}$) and an output-side vocabulary-logit projection readout to prevent recurrent decay and superposition noise. 2. Depth Axis (Zero-Parameter Block Attention Residuals): Replaces traditional heavily-parameterized cross-layer projections with pure softmax attention over preceding raw block states using a single learned pseudo-query parameter $w_l \in \mathbb{R}^d$ and an age-based distance penalty. 3. Local Pattern Axis (Hashed N-gram Engram): High-entropy, deterministic local pattern memory built with multi-head N-gram hash tables, isotropic scalar gating, and a dilated causal 1D convolution layer to expand the local receptive field.

Authors

Publication Details

Journal
Zenodo (CERN European Organization for Nuclear Research)
Published
2026-05-27
DOI
https://doi.org/10.5281/zenodo.20041183
Primary Topic
Constraint Satisfaction and Optimization
Type
article
Field-Weighted Citation Impact
0.00
Controls
|||
ALL TIME
JAN
FEB
MAR
APR
MAY
JUN
JUL
AUG
SEP
OCT
article

A Conditional Small-State Memory Architecture for Efficient Long-Context Reasoning

Xingyu Xie
Zenodo (CERN European Organization for Nuclear Research)
Constraint Satisfaction and Optimization
article

A Conditional Small-State Memory Architecture for Efficient Long-Context Reasoning

Xingyu Xie
article en

Abstract

This deposit contains the official PyTorch research scaffold, unit test suites, and formal mathematical proofs for Anamnesis—a resource-rational, budgeted long-context memory architecture combining Retentive Networks (RetNet), Block Attention Residuals (AttnRes), and Hashed N-gram Engram memory. Long-context language models must balance the low marginal cost of sequence streaming with high-fidelity exact recall of decision-critical states. This repository presents a complete proof-aligned implementation designed to explore budgeted memory boundaries without relying on a full Transformer Key- Value (KV) cache. Core Architectural Components 1. Time Axis (RetNet Streaming + Bounded Snapshots): Default sequence streaming handled by contractive recurrent states, augmented with a capped snapshot cache ($K_{\max}$) and an output-side vocabulary-logit projection readout to prevent recurrent decay and superposition noise. 2. Depth Axis (Zero-Parameter Block Attention Residuals): Replaces traditional heavily-parameterized cross-layer projections with pure softmax attention over preceding raw block states using a single learned pseudo-query parameter $w_l \in \mathbb{R}^d$ and an age-based distance penalty. 3. Local Pattern Axis (Hashed N-gram Engram): High-entropy, deterministic local pattern memory built with multi-head N-gram hash tables, isotropic scalar gating, and a dilated causal 1D convolution layer to expand the local receptive field.

Zenodo (CERN European Organization for Nuclear Research)
Openalex Percentile: Top 23%
Constraint Satisfaction and Optimization
AI Navigator

Ask Laika to Summarize, Analyze, and Connect papers live on the map.

Summarize Papers & Methodologies

Extract key findings, datasets, and comparative methods across publications.

Benchmark Rankings & Visual Analytics

Rank top research institutions, authors, funders, topics, and journals by Field-Weighted Citation Impact (FWCI) and paper volume with instant charts.

Connect Distant Disciplines

Bridge topological clusters on the map to find hidden collaborative intersections.