TL;DR
GECKO is a novel neural architecture designed to handle sequences of virtually any length—up to 4 million tokens in testing—without the need for specialized context-extension tricks. By integrating sliding chunk attention with a new adaptive working memory, GECKO-7B outperforms Llama2-7B and Megalodon-7B in data efficiency and long-context retrieval, even rivaling the performance of models twice its size.
What Problem Does This Paper Address?
Standard Transformers are the backbone of modern AI, but they have a major flaw: their computational cost grows quadratically with sequence length ($O(n^2)$). This makes processing very long documents, like entire books or long codebases, prohibitively expensive. Furthermore, Transformers often struggle with "length extrapolation"—they fail when asked to process sequences longer than what they saw during training.
Alternative architectures like MEGA and Megalodon attempted to solve this using Exponential Moving Averages (EMA) and gated attention. However, they faced two hurdles:
- Vanishing Statistics: Their normalization methods caused the influence of new data to diminish as the sequence grew longer.
- Boundary Issues: Their "chunk-wise" attention mechanisms created "blind spots" at the edges of data chunks, leading to information loss.
GECKO aims to bridge these gaps, creating a model that is both hardware-efficient and capable of maintaining a stable "memory" over millions of tokens.
Methods
GECKO builds upon the Megalodon backbone but introduces three critical technical innovations:
- Timestep Decay Normalization: In previous models, the cumulative mean and variance used for normalization would "stale" over time. GECKO introduces a decaying mechanism (similar to the momentum used in the Adam optimizer) that ensures the model maintains a consistent ratio of current vs. historical statistics, regardless of sequence length.
- Sliding Chunk Attention (SCA): Traditional sliding window attention is computationally messy on GPUs. GECKO uses SCA, which processes data in non-overlapping chunks but allows each chunk to attend to the previous chunk as well. This provides a "lossless" short-term memory that propagates context across boundaries more efficiently than per-token windows.
- Adaptive Working Memory (AWM): To capture information beyond the immediate sliding window, GECKO uses a linear attention mechanism acting as a compressed long-term memory. It employs a "position-aware online softmax kernel" and a "delta update rule" to dynamically erase redundant information and make room for new context without forgetting the distant past.
Datasets
The researchers conducted a strictly controlled comparison to ensure fair results:
- Pretraining: The 7B model was trained on 2 trillion tokens using the same data mixture as Llama2. The 1.3B version used the Dolma v1.7 dataset.
- Short-Context Benchmarks: Standard academic tests including MMLU, BoolQ, HellaSwag, and ARC.
- Long-Context Evaluation: The Scrolls benchmark (for long-context QA) and a custom validation set of 1,500 books, each containing at least 4 million tokens.
- Retrieval: Needle-in-a-Haystack (NIAH) and passkey retrieval tasks to test the model's ability to find specific facts hidden in massive contexts.
Key Insights and Ideas
- Data Efficiency is the New King: GECKO-7B reached a training loss of 1.68, which is significantly better than Llama2-7B (1.75) and nearly matches Llama2-13B (1.67). This suggests that GECKO's architecture extracts more "knowledge" per token than the standard Transformer.
- Smoothing the Boundaries: By using Sliding Chunk Attention, GECKO eliminates the "spikes" in loss that Megalodon suffered at chunk boundaries. This leads to much more stable next-token prediction across long sequences.
- Retrieval Beyond the Window: Perhaps the most impressive "aha" moment is GECKO's retrieval capability. Even with a nominal attention window of 4K tokens, the model could successfully retrieve information from contexts up to 16K tokens (4x its window) thanks to its Adaptive Working Memory.
Key Results
- Superior Scaling: As shown in the training curves, GECKO-7B consistently maintains a lower negative log-likelihood (NLL) than its direct competitors throughout the entire 2-trillion-token training run.
- 4-Million Token Stability: In perplexity tests, GECKO's performance continued to improve (lower perplexity) as context length increased all the way to 4 million tokens, showing no signs of the "breaking" typically seen in Transformers.
- Benchmark Dominance: On the Scrolls long-context QA tasks (NarrativeQA, Qasper, QMSum), GECKO-7B achieved the strongest performance among all models of similar scale, including those specifically fine-tuned for long contexts like YaRN-7B.
Limitations and Future Work
While GECKO shows remarkable retrieval capabilities, the authors note that the Adaptive Working Memory still has a bounded capacity. For "truly infinite" sequences, memory collisions—where new information overwrites old information—are inevitable.
Additionally, while GECKO-7B was compared fairly against Llama2 and Megalodon, newer models like Mistral-7B and Gemma-8B were trained on much larger datasets (up to 6T tokens), making a direct architectural comparison difficult. The authors suggest that scaling GECKO to even larger parameter counts and larger training sets is the logical next step.
Summary updated