Learning When to Attend: Conditional Memory Access for Long-Context LLMs
Abstract
Lay Summary
Modern AI language models can struggle when asked to process very long inputs, such as entire books or long documents, because standard methods require the model to compare every part of the input with every other part, which becomes very slow and expensive. In this work, we introduce a more efficient way for models to handle long inputs by allowing them to selectively decide when they actually need to pay attention to distant information. Instead of always looking at the entire context, the model learns when local information is sufficient and when it is necessary to access information from far away in the input. This selective mechanism significantly reduces unnecessary computation while still preserving the model’s ability to understand and reason over long contexts. We show that this approach can extend the effective range of existing models to much longer inputs without requiring expensive retraining from scratch. It also makes training and inference more efficient by avoiding a large fraction of costly long-range computations. Overall, this work moves toward making long-context language models more practical by teaching them to focus their attention only when it is truly needed.