TL;DR
Instead of hacking transformer attention or adding complex recurrent memory modules, this paper extends context windows by preprocessing distant input tokens using a biologically inspired, logarithmically compressed memory buffer. Feeding this compressed representation alongside recent uncompressed tokens into a standard, unmodified GPT-2 architecture improves perplexity on WikiText-103 and PG-19 over uncompressed controls, covering up to 8,192 tokens with minimal computational overhead.
What Problem Does This Paper Address?
Standard transformers struggle with long sequences because self-attention incurs quadratic computational and memory costs ($O(N^2)$). To mitigate this, common approaches introduce segment-level recurrence (like Transformer-XL), external memory stores, or sparse attention approximations. However, these solutions add significant architectural complexity, complicate distributed training, and break stateless batch processing.
The authors ask: Can we dramatically extend context length simply by changing how the input is represented, without modifying the transformer architecture at all?
Methods
The paper draws directly from cognitive neuroscience models of human memory—specifically the Scale-Invariant Temporal History (SITH) framework and the Weber–Fechner law—which posit that the brain maintains a mental timeline whose temporal resolution degrades logarithmically into the past.
- Scale-Invariant Temporal Filters: The distant past of the token sequence is passed through a bank of $L$ geometrically spaced unimodal temporal filters (implemented as causal, depth-wise 1-D convolutions on token embeddings). Filter widths are controlled by a parameter $k$, producing fine temporal resolution for recent tokens and broader, smoother receptive fields for older tokens.
- Input Augmentation: Given an uncompressed window of $m$ tokens (here, $m = 256$), the preceding history of up to $M$ tokens (up to 8,192 tokens) is compressed into $L$ vector slots. These $L$ compressed slots are normalized using LayerNorm and concatenated directly with the $m$ uncompressed tokens.
- Unmodified Transformer Backbone: A standard GPT-2 Small model (12 layers, 12 heads, 768-d embedding, ~124M parameters) processes the concatenated sequence of length $m + L$.
- Training Efficiency: Multi-head attention cost scales with $O((m + L)^2 d)$ rather than $O((m + M)^2 d)$. Training loss is computed only over the $m$ recent uncompressed tokens, preserving standard stateless batching.
Datasets
The authors evaluate their method on two standard long-context language modeling benchmarks:
- WikiText-103: Over 100M tokens drawn from high-quality Wikipedia articles.
- PG-19: A long-context benchmark containing ~28,000 Project Gutenberg books (~1.9B tokens), where documents average over 100,000 words each.
No new datasets or benchmarks were introduced in this work.
Key Insights and Ideas
- Input-level rather than architecture-level memory: Compressing the input representation before the first transformer layer allows models to ingest long contexts while remaining 100% compatible with existing transformer implementations, attention kernels, and inference engines.
- Power-law decay matches language structure: Statistical dependencies and mutual information in natural language decay as a power law over long distances. The geometric spacing of filter peaks matches this decay naturally, allocating memory capacity where it matters most.
- Exponential reach with linear slots: Because filter peaks grow geometrically ($\tau_i^* = \tau_{\min}^*(1 + c)^{i-1}$), adding just 53 compressed slots ($L = 53$) provides a temporal reach spanning an 8,192-token context window.
Key Results
- WikiText-103 Performance: With $L = 53$ filters covering an 8,192-token context, the model achieved a per-word test perplexity of 23.56. This outperformed:
- An architectural control using delta-pulse shift registers (PPL 25.48).
- Transformer-XL Standard (PPL 24.00, 151M parameters).
- Recurrent Memory Transformer / RMT (PPL 24.85, 151M parameters).
- Transformer-XL + RMT hybrid (PPL 23.99, 151M parameters).
- Graceful Scaling with Context: Test perplexity steadily decreased as the number of filters $L$ increased from 5 to 53 (corresponding to temporal spans from 2 up to 8,192 tokens), demonstrating that the model actively leverages information from distant, heavily compressed tokens.
- Robustness: Performance trends held consistently across varying filter width parameters ($k \in \{100, 150, 200\}$) on both WikiText-103 and PG-19.
Limitations and Future Work
- Model Scale: Experiments were conducted exclusively at the GPT-2 Small scale (~124M parameters). Validating the approach on modern large language models (7B+ parameters) remains untested.
- PG-19 Baselines: Direct head-to-head comparisons on PG-19 against other memory architectures were omitted due to a lack of published models evaluated at comparable parameter scales using identical per-word tokenization normalization.
- Fine-Grained Retrieval: Heavy logarithmic smoothing means exact verbatim details from thousands of tokens ago cannot be retrieved; the representation favors semantic and statistical gist over fine syntactic reconstruction.
Summary updated