TL;DR
State Space Models (SSMs) like Mamba-3 process text in blazing-fast linear time, but their fixed-size memory acts like a tiny whiteboard that struggles with exact "lookup" tasks compared to Transformers. GEAR fixes a large part of this memory gap without touching Mamba-3’s fast recurrent core: it adds a lightweight, "slow" background network that watches the broader context and dynamically tweaks how each new token writes to and reads from memory. The result is a model that retains Mamba-3’s linear-time elegance while getting much better at recalling specific facts from earlier in a prompt.
What Problem Does This Paper Address?
Transformers are fantastic at associative recall—if you tell a Transformer early on that Key A = Value B, its attention mechanism can look directly back at that exact token pair thousands of words later. The catch, of course, is that attention scales quadratically with sequence length.
Selective State Space Models (SSMs) like Mamba-3 ditch attention for linear-time recurrences, compressing everything they read into a fixed-size hidden state. While they match Transformers on general language fluency (perplexity), you cannot stuff an unbounded list of key-value pairs into a fixed-size vector without things getting blurry. In fact, prior work showed that over 80% of the remaining performance gap between recurrent models and Transformers comes down to this exact recall bottleneck.
Instead of bolting expensive attention layers back onto Mamba, the authors ask a surgical question: if we keep Mamba-3’s core memory scan completely frozen in structure, can we improve recall just by making the "input projection"—the gatekeeper that decides what to write and read—adapt to the surrounding context?
Methods
In standard Mamba-3, a static weight matrix ($W_{\text{in}}$) looks at the current token and generates the control signals (write, read, retention, and gating) fed into the fast recurrent scan. Because $W_{\text{in}}$ is fixed after training, it applies the exact same rules regardless of what happened earlier in the document.
GEAR (GEnerator-Adaptive State Space Models for Associative Recall) leaves the Mamba-3 scan untouched and introduces a causal Slow Path alongside the main Fast Path:
- Chunk Summarization: Text is divided into chunks of $S = 64$ tokens. Once a chunk is processed, its token embeddings are averaged into a compact summary.
- Gated Slow State: A learned gate decides how much of this new chunk summary should be mixed into a persistent, low-dimensional "slow state" ($s_m$), filtering out noise while preserving causal order.
- Slow Hypernetwork + LoRA: Before processing the next chunk, a tiny 2-layer MLP ($H_{\text{slow}}$) reads the slow state and outputs $R = 8$ coefficients. These coefficients dynamically scale a Low-Rank Adaptation (LoRA) update to $W_{\text{in}}$.
Think of the Mamba scan as a tape recorder, $W_{\text{in}}$ as the recording engineer, and GEAR’s slow path as a producer whispering instructions in the engineer's ear between scenes based on how the plot is unfolding.
Datasets
- Pretraining: 2 billion tokens from FineWeb-Edu (at 180M parameter scale, context length 2048).
- Standard Language & Zero-Shot Benchmarks: LAMBADA, HellaSwag, PIQA, ARC-Easy/Challenge, WinoGrande, and OpenBookQA.
- Recall & Retrieval Benchmarks:
- Multi-Query Associative Recall (MQAR): Synthetic key-value lookup tasks across varying list lengths ($N = 16$ to $256$), binding positions, and random filler ("distractor") tokens.
- Needle-in-a-Haystack (NIAH): Single-key and multi-key retrieval of 7-digit numbers hidden inside FineWeb-Edu prose.
- FDA Document Retrieval: Natural-language information extraction from the BASED benchmark.
Key Insights and Ideas
- It’s not just extra parameters: Adding a static LoRA adapter (
Static-LoRA) or widening the feed-forward layers (Mamba-3-wide) to match GEAR's parameter count fails to improve recall—and widening actually hurts MQAR performance. Context-adaptivity is the secret sauce. - No "recency bias" illusion: Recurrent models often look good on averages simply by remembering the most recent items and forgetting the rest. When tested by position, GEAR improves recall on the oldest key-value pairs (+0.52 NLL gain) just as much as the newest ones (+0.51 NLL gain).
- Gating beats simple averaging when things get noisy: An ablation using a fixed running average (
GEAR-Pool) ties with full GEAR on clean, compact key-value lists. However, when random "filler" tokens are injected between keys, GEAR’s learned gate shines—actively blocking irrelevant filler from corrupting the slow state. - Training-time shaping: Even on very short sequences ($N=16$) where everything fits in Chunk 0—meaning the slow adapter outputs zeros at inference!—GEAR still beats Mamba-3. Having the adaptive path active during pretraining appears to guide the base model into learning better internal representations for recall.
Key Results
All models were pretrained at ~180M parameters for 2B tokens.
- General Language Modeling: GEAR matches Mamba-3 and all controls on FineWeb-Edu perplexity (26.19 vs. Mamba-3's 26.28) and zero-shot downstream accuracy (~37.4%–37.8%).
- Compact MQAR: Measuring candidate-restricted Negative Log-Likelihood (NLL, lower is better), GEAR substantially outperforms Mamba-3 across active chunk lengths:
- Real-World & Haystack Retrieval: GEAR beats a parameter-matched Mamba-3 with double the recurrent state size (
Mamba-3+2xstate) across all 8 single-key NIAH settings, all multi-key NIAH lengths, and FDA document retrieval (2.66 vs. 2.71 NLL/token; standard Mamba-3 gets 2.82). Combining GEAR with a doubled state (GEAR+2xstate) yields the strongest SSM results overall. - Efficiency: GEAR adds only 0.3 MiB to the decode cache (8.4 MiB vs. 8.1 MiB, whereas doubling Mamba's state jumps to 16.2 MiB), with an 8% pretraining overhead and 9.2% slower streaming decode (187 vs. 206 tokens/sec).
Limitations and Future Work
- Heavy Distractors Still Win: While GEAR handles moderate filler noise well (up to sequence lengths of 256 for 32 keys), under heavy random-filler interference ($T \ge 512$), all SSM variants—including GEAR—collapse back to random guessing, whereas a Transformer baseline stays strong.
- Sensitivity to Rank & Throughput Overhead: Recall gains are surprisingly sensitive to the LoRA rank ($R=8$ works great, while $R=4$ and $R=16$ lose the advantage), and the Python/MLP overhead of the slow hypernetwork slightly reduces token throughput. Optimizing kernel fusion and scaling beyond 180M parameters remain open next steps.
Summary updated