← Latest papers
💬 NLP

AgentIR: A Workload-Adaptive Cascade Retrieval Substrate for Long-Term Conversational Memory

AgentIR introduces a workload-adaptive cascade retrieval substrate for long-term conversational memory that dynamically skips expensive dense retrieval based on confidence thresholds and utilizes a time-partitioned index to achieve sub-10ms latency and up to 132x speedup while maintaining or improving retrieval accuracy across diverse benchmarks.

Original authors: Aojie Yuan, Haiyue Zhang, Shahin Nazarian

Published 2026-05-26
📖 6 min read🧠 Deep dive

Original authors: Aojie Yuan, Haiyue Zhang, Shahin Nazarian

Original paper licensed under CC BY 4.0 (http://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

The Big Picture: A Smart Librarian for AI Agents

Imagine you have a very smart AI assistant (an "agent") that helps you for months or even years. Over time, this agent accumulates a massive diary of conversations, tool uses, and plans—millions of pages of notes.

Every time the agent takes a step to solve a problem, it has to look through this diary to find the right information. If the agent takes 20 steps, it needs to search this diary 20 times in a row. If the search takes even a fraction of a second too long, the whole conversation feels "stuck" or slow to the human user.

The problem? The tools we usually use to search libraries (like standard search engines) were built for searching the entire internet, not for searching a single, constantly growing diary where the most important notes are usually the ones written just now.

AgentIR is a new, specialized search engine built specifically for these AI agents. It's faster, smarter about what to search, and scales up without slowing down.


1. The "Time-Travel" Shelves (Temporal Partitioning)

The Problem: Imagine a library where books are added every second. If you ask for a book, a standard librarian might have to check the shelves from the oldest book to the newest, one by one. As the library grows to millions of books, this search gets slower and slower.

The AgentIR Solution: AgentIR organizes the library differently. Instead of one giant row of books, it puts them on shelves based on when they were written.

  • The Analogy: Think of it like a "Time-Travel" library. The most recent books are on a special, easy-to-reach shelf right at the front. Older books are pushed further back.
  • How it works: Because AI agents usually need information from recent conversations (like "what did we just fix?"), the system only looks at the front shelves first. If it finds the answer there, it stops immediately. It doesn't waste time checking the dusty back shelves.
  • The Result: Even if the library grows 1,000 times bigger, the search time barely increases. It's like finding a needle in a haystack, but the needle is always in the top 1% of the hay.

2. The "Two-Tool" Strategy (Hybrid Search)

The Problem: Sometimes you need to search by exact words (like finding a specific error code), and sometimes you need to search by meaning (like finding a conversation about "fixing a bug" even if the word "bug" isn't used).

  • Tool A (BM25): Great at exact word matching, super fast.
  • Tool B (Dense/Vector): Great at understanding meaning, but slow and heavy.

The AgentIR Solution: AgentIR doesn't force you to use both tools for every single question. It acts like a smart traffic cop.

  • The Analogy: Imagine you are looking for a specific item in a store.
    • If you ask, "Where is the red hammer?", the system knows you just need to look at the "Hammer" aisle (Tool A). It skips the expensive, slow "Meaning" scanner.
    • If you ask, "Where is the thing that fixes the squeaky door?", the system knows it needs the "Meaning" scanner (Tool B) to understand the concept.
  • The Cascade: The system tries the fast tool first. If the fast tool is very confident it found the answer, it stops there. If it's unsure, then it calls in the slow, heavy tool. This saves a massive amount of time.

3. The "Shape-Shifting" Strategy (Workload-Adaptive)

The Problem: Different types of questions need different search strategies.

  • On one dataset (LongMemEval), mixing word-matching and meaning-matching worked best.
  • On another dataset (LoCoMo), just word-matching was actually better and faster.
  • Old systems force you to pick one strategy and stick with it forever.

The AgentIR Solution: AgentIR is a "chameleon." It has a tiny, fast classifier (a decision-maker) that looks at your question and says, "Ah, this is a 'Time' question, let's use Strategy A," or "This is a 'Facts' question, let's use Strategy B."

  • The Result: It automatically tunes itself. On one test, it skipped the slow tool 63% of the time. On another test, it skipped it 100% of the time because the fast tool was perfect. It adapts to the job at hand without needing to be retrained.

4. The "Super-Speed" Engine (GPU & CPU Optimization)

The Problem: Doing these searches on standard computer chips (CPUs) is fast, but doing them on powerful graphics cards (GPUs) is usually tricky because the math doesn't line up perfectly. Also, standard search engines often have hidden bugs that make them slightly less accurate when you try to speed them up.

The AgentIR Solution:

  • The Engine: They built a custom engine that runs on both CPUs and GPUs perfectly.
  • The "Bug Fix": The authors found three subtle "bugs" that often happen when people try to speed up search engines (like normalizing numbers wrong or forgetting to clear memory). These bugs make search results 6 to 8 times worse without anyone noticing. AgentIR fixed these, ensuring that the super-fast GPU version gives the exact same correct answers as the slower CPU version.
  • The Result: They achieved speeds up to 132 times faster than standard systems on certain tasks, while keeping the accuracy exactly the same.

Summary of Results

  • Speed: It can handle millions of records and still answer in under 100 microseconds (that's 1/10,000th of a second) for recent data.
  • Efficiency: It can serve 8 different AI agents at the same time on a single computer without slowing down.
  • Accuracy: It matches or beats the best existing search engines (like Lucene) in finding the right answers, but does it much faster.
  • Cost: Because it's so fast and efficient, it costs a tiny fraction of what commercial cloud search services charge.

In a nutshell: AgentIR is a specialized, high-speed search engine that knows when to look at recent notes, when to use simple word matching, and when to skip the heavy lifting entirely, ensuring AI agents stay fast and responsive even as their memories grow huge.

Drowning in papers in your field?

Get daily digests of the most novel papers matching your research keywords — with technical summaries, in your language.

Try Digest →