TL;DR
The Engram module, originally designed as a content-addressed memory shortcut for Large Language Models (LLMs), fails to improve sample quality when adapted to autoregressive image generation. Through a series of clever probing experiments, the authors reveal that the module doesn't actually retrieve specific visual memories; instead, it acts as a gated architectural side-pathway where the actual content of the memory table is largely incidental.
What Problem Does This Paper Address?
Autoregressive (AR) image generation models treat images as sequences of discrete tokens (patches) and predict them sequentially. In natural language processing, the "Engram" module provides a fast, $O(1)$ hash-keyed lookup table that allows the model to quickly retrieve recurring local token patterns (like common phrases), saving backbone compute.
Because visual patches—like sky, fur, or brick—are highly redundant across different images, an Engram module seems like a perfect fit for vision AR models. This paper investigates a fundamental question: Does the Engram module actually perform content-addressed memory retrieval in vision, or does its mechanism change when shifting from text to pixels?
Methods
The authors first adapt the 1D text-based Engram module to 2D vision by introducing spatial $n$-gram hashing over a causal $2 \times 2$ grid, utilizing gated fusion and making it compatible with KV-cache incremental inference.
To understand exactly how the model utilizes this memory, they build a diagnostic toolkit consisting of three novel probing techniques:
- Gate-Clamp Analysis: Forcing the learned, token-dependent gating mechanism to fixed constant values ($g \in [0.0, 1.0]$) during inference to see how heavily the model relies on the memory pathway.
- Donor Probe: Swapping the actual context tokens fed into the hash function with "donor" tokens from matched (same-class), adversarial (different-class), or random images to test if the model is sensitive to the specific semantic content being retrieved.
- Frozen-Noise Training Control: Training the entire AR model from scratch, but completely freezing the Engram memory table to random Gaussian noise $\mathcal{N}(0, 1)$, effectively destroying any learnable content while keeping the architectural pathway intact.
Datasets
- ImageNet ($256 \times 256$): The primary dataset used for training the class-conditional AR generator (1.28M images, 1000 classes).
- DINOv2: Used to extract features and stratify image pairs by semantic similarity to validate the presence of local $n$-gram structures across different tokenizers.
Key Insights and Ideas
- The "Memory" is an Illusion: In language models, Engram acts as a true retriever. In vision, it behaves purely as a gated architectural side-pathway (a parallel residual stream). The model benefits from the structure of the pathway, not the content stored in the memory slots.
- Random Noise Works Surprisingly Well: Amazingly, training a model from scratch with a memory table filled with static, unlearned Gaussian noise costs a mere $0.10$ degradation in FID and actually increases the Inception Score. This proves that the exact values in the table matter very little.
- The Gating Mechanism Over-mixes: The learned gate actually puts too much faith in the memory table. Forcing the gate to a tiny constant value ($g=0.10$) matches or beats the learned gate, showing that the model prefers a small, near-constant injection from this side-pathway rather than dynamic, content-specific routing.
- Tokenizer Dependency: For hash-based lookups to work at all, the discrete token space must exhibit recurrent local patterns. The authors show that the AliTok tokenizer maintains these patterns across semantically similar images, whereas MaskGIT-VQ collapses them to near-zero.
Key Results
- Worse Quality at Matched Parameters: Across a wide sweep of backbone-to-memory budget ratios ($\rho \in [0.17, 0.90]$), every single Engram-augmented variant achieved a worse Fréchet Inception Distance (FID) than the pure AR baseline ($2.02$). While it successfully saves backbone FLOPs, it sacrifices generation quality.
- 2D Context Doesn't Help: Extending the $n$-gram patterns from 1D to 2D spatial neighborhoods (capturing horizontal, vertical, and diagonal co-occurrences simultaneously) yielded an FID of $4.24$, virtually identical to the 1D baseline ($4.23$).
- Donor Probe Indifference: Swapping the hash keys with adversarial or random same-class tokens resulted in statistically indistinguishable next-token distributions ($\Delta\text{KL} < 0.11$). However, collapsing the table indices entirely degraded performance by orders of magnitude, proving the model needs table diversity, but not semantic matching.
- Quantitative Noise Control: The fully learned memory model achieved an FID-50K of $2.426$ and an Inception Score (IS) of $259.42$. The randomized, frozen-noise variant achieved an FID-50K of $2.527$ but boosted the IS to $284.70$.
Limitations and Future Work
- Scale Constraints: Due to computational limits, this study was restricted to a dense AR generator at a moderate scale (~177M parameters). It remains unproven whether these negative results hold for XL-size models or Mixture-of-Experts (MoE) variants.
- Standard Training Regimes: The authors note that genuine content-addressed memory retrieval might still prove useful in alternative settings not explored here, such as extreme low-data regimes, long-tail class-conditional generation, or significantly higher image resolutions.
Summary updated