Artificial Hippocampus Networks for Efficient Long-Context Modeling

Yunhao Fang, Weihao Yu, Shu Zhong, Qinghao Ye, Xuehan Xiong +1 more
10/8/2025
cs.CLcs.AIcs.LG

Official code: ByteDance-Seed/AHN (182 stars, Apache-2.0, last commit 2025-10-17).

Abstract

Long-sequence modeling faces a fundamental trade-off between the efficiency of compressive fixed-size memory in RNN-like models and the fidelity of lossless growing memory in attention-based Transformers. Inspired by the Multi-Store Model in cognitive science, we introduce a memory framework of artificial neural networks. Our method maintains a sliding window of the Transformer's KV cache as lossless short-term memory, while a learnable module termed Artificial Hippocampus Network (AHN) recurrently compresses out-of-window information into a fixed-size compact long-term memory. To validate this framework, we instantiate AHNs using modern RNN-like architectures, including Mamba2, DeltaNet, and GatedDeltaNet to augment open-weight LLMs. We also propose an efficient self-distillation training method where the base model's all parameters are frozen and only the parameters from AHNs are optimized. For inference, our method sets a default large sliding window size of 32k for attention, and AHNs activate only when the sequence length exceeds the 32k window, addressing the quadratic-complexity issue of attention that emerges at that scale. Extensive experiments on long-context benchmarks LV-Eval and InfiniteBench demonstrate that AHN-augmented models consistently outperform sliding window baselines and achieve performance comparable or even superior to full-attention models, while substantially reducing computational and memory requirements. For instance, augmenting the Qwen2.5-3B-Instruct with AHNs reduces inference FLOPs by 40.5% and memory cache by 74.0%, while improving its average score on LV-Eval (128k sequence length) from 4.41 to 5.88. Code is available at: https://github.com/ByteDance-Seed/AHN.

View on arXivView PDF

Code Implementations(1)

ByteDance-Seed/AHNOfficial100%
Apache-2.0

AHN: Artificial Hippocampus Networks for Efficient Long-Context Modeling

1826Shell, PythonSep 28, 20251 years agoApache-2.0
neural-networkrnntransformer

Similar Papers

Cite this paper

@article{fang2025artificial,
  title  = {Artificial Hippocampus Networks for Efficient Long-Context Modeling},
  author = {Yunhao Fang and Weihao Yu and Shu Zhong and Qinghao Ye and Xuehan Xiong and Lai Wei},
  year   = {2025},
  eprint = {2510.07318},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2510.07318v2}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2510.07318.svg)](https://codeofpaper.com/paper/2510.07318)

Discussion