InfiniRetri: Attention-Guided Retrieval for Enhancing LLMs' Long-Context Processing
InfiniRetri is a training-free method that leverages a pre-trained LLM's intrinsic attention mechanisms to iteratively distill relevant context from arbitrarily long inputs, enabling efficient and highly accurate long-context retrieval and reasoning without the need for external embedding models or costly retraining.
Original paper licensed under CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). This is an AI-generated explanation of the paper below. It is not written or endorsed by the authors. For technical accuracy, refer to the original paper. Read full disclaimer
Modern artificial intelligence systems, known as large language models, have become remarkably capable at understanding and generating human language. They can write stories, solve math problems, and answer complex questions. However, these systems face a significant physical limitation: they can only hold a certain amount of information in their "working memory" at one time. When a user asks the model to read a very long document, such as a full novel or a collection of legal records, the system often struggles. It tends to forget details from the beginning of the text or lose track of the main point as the input grows longer. This happens because the mathematical process the model uses to connect words to one another becomes incredibly expensive and slow as the text gets bigger. To fix this, researchers have tried two main approaches. One is to force the model to learn how to handle longer texts through expensive and time-consuming retraining. The other is to use a helper system that searches for relevant parts of the text before the model reads it, but this helper often relies on simple word-matching that misses deeper meaning.
A team of researchers from WenHua College in China has proposed a different solution that requires no retraining and no external search tools. They discovered that the model already possesses the ability to find the right information within a long text; it just needs to be guided to use it. By observing how the model's internal attention mechanism works, they found that the model naturally focuses its attention on the specific sentences that contain the answers to a question, even when those sentences are buried deep within a massive document. This pattern is most visible in the final layer of the model's processing network. The researchers built a method called InfiniRetri that exploits this natural behavior. Instead of trying to compress the text into smaller, unreadable fragments or relying on a separate search engine, their method iteratively reads chunks of the long document, asks the model to identify the most relevant sentences based on its own internal focus, and saves only those complete sentences into a small, efficient memory cache.
The process works like a careful reader going through a thick book page by page. The researchers split the long text into manageable sections. For each section, they feed the text along with the user's question into the model. The model then looks at how much attention its internal mechanisms pay to different parts of that section. The researchers extract a map of this attention, specifically looking at how the question words connect to the words in the text. They found that the model's attention scores act as a precise signal, highlighting exactly which sentences hold the answer. The system then selects the top-scoring sentences and saves them into a lightweight cache. This cycle repeats for every chunk of the document. By the time the entire text has been processed, the cache contains only the most critical sentences needed to answer the question, effectively filtering out the rest of the noise. Finally, the model reads this small, curated collection of sentences and generates the final answer.
The results of this approach are striking. In tests where the model had to find a hidden fact within a massive document, a very small version of the model using this method achieved perfect accuracy even when the text contained over one million words. This is a significant improvement over previous methods, which often failed when the text exceeded 32,000 words. The method also proved highly effective at answering questions that required finding information across multiple documents, outperforming other advanced techniques that rely on complex training or external databases. Remarkably, this high level of performance was achieved using only two gigabytes of computer memory, a size small enough to run on standard consumer hardware. The researchers noted that the method works best when there is a clear question to ask, as the system relies on the question to guide its attention. While it showed less improvement on tasks like summarizing a whole book, where the goal is to condense everything rather than find a specific fact, the ability to retrieve precise information from virtually unlimited text lengths without expensive training represents a major step forward. The study suggests that by trusting the model's own internal signals, we can unlock its ability to read and reason over texts of any size.
Drowning in papers in your field?
Get daily digests of the most novel papers matching your research keywords — with technical summaries, in your language.