Introduction
As Large Language Models (LLMs) are increasingly deployed for complex tasks such as analyzing massive legal documents, summarizing entire books, and multi-hop reasoning, their "context window" has become a critical bottleneck. Despite theoretical expansions in context length, existing models often suffer from two primary internal issues: information decay and semantic fragmentation. Information decay occurs because neural activations in Feed-Forward Networks (FFNs) are transient; once a token is processed, its specific neural signature fades, making it difficult to maintain a coherent "working memory." Semantic fragmentation arises from the unstructured nature of FFN weights, where related concepts are scattered across the network, disrupting semantic continuity.
To address these challenges, we introduce PaceLLM, a novel framework that mimics the human brain's mechanisms for managing working memory and specialized neural regions. PaceLLM is a "plug-and-play," training-free solution that significantly boosts long-context performance and extends usable context length to 200K tokens.
Methodology: Mimicking the Human Brain
PaceLLM incorporates two primary innovations inspired by neuroscience to enhance the internal processing of LLMs:
Persistent Activity (PA) via Activation Memory Bank
This mechanism mimics the prefrontal cortex (PFC), where neurons exhibit persistent firing even after a stimulus is removed to maintain working memory. PaceLLM implements an external Activation Memory Bank (AMB) that stores, retrieves, and updates FFN activations. By looking up similar historical activations to "re-activate" relevant past knowledge, the model effectively counteracts information decay over long sequences.
Cortical Expert (CE) Clustering
Inspired by the modularity of the cerebral cortex, where specific regions specialize in different cognitive tasks, PaceLLM utilizes constrained K-Means clustering to reorganize FFN weights. By grouping neurons with similar activation patterns into "semantic modules" or experts, the framework establishes clearer cross-token dependencies and prevents semantic fragmentation without altering the underlying weight values.
Experimental Evaluation
The performance of PaceLLM was evaluated across several rigorous long-context benchmarks, including LongBench (multi-task understanding), $\infty$-Bench (sequences exceeding 100K tokens), and the Needle-In-A-Haystack (NIAH) test. General reasoning capabilities were monitored via MMLU to ensure that long-context optimization did not degrade the model's foundational knowledge.
Key Results and Discussion
PaceLLM demonstrates substantial improvements over vanilla baselines and existing state-of-the-art methods:
- Performance Gains: The framework achieved a 6% improvement on LongBench’s Multi-document QA and significant gains of 12.5–17.5% on $\infty$-Bench tasks.
- Context Extension: In the Needle-In-A-Haystack test, PaceLLM successfully retrieved information at a context length of 200K tokens, outperforming previous methods like Activation Beacon, which typically cap at 128K.
- Efficiency and Interpretability: Despite the addition of a memory bank, PaceLLM remains efficient, showing a ~13% speedup on certain tasks when paired with FlashAttention. Furthermore, clustering neurons into experts allows for better visualization of how the model re-activates specific semantic clusters over time.
Conclusion
PaceLLM offers a robust, model-agnostic approach to solving the forgetting problem in LLMs. By drawing inspiration from the persistent activity of the prefrontal cortex and the modular structure of the cerebral cortex, it provides a scalable path toward processing extremely long documents with high fidelity. Future work will explore extending these brain-inspired mechanisms to multi-modal models and embodied AI systems.
Summary updated