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

AuthorsAojie Yuan, Haiyue Zhang, Shahin Nazarian

arXiv 20262026

TL;DR

AgentIR uses a workload-adaptive cascade over SIMD BM25, dense HNSW, and a temporal index to reach 1769× speedup at 5M records and 2.67× faster hybrid retrieval at parity LLM accuracy.

SharePost on XLinkedIn

Read our summary here, or open the publisher PDF on the next tab.

THE PROBLEM

Agents Need Sub 10 ms Retrieval on Millions of Growing Memories

Long-term conversational agents must issue 5–20 retrievals per step, and any one blocking for 50 ms makes users feel a stall.

Existing Lucene-class engines assume a static index and serve queries at 2–10 ms, so they cannot meet sub-millisecond p99 latency while the corpus grows to 5M records inside a single agent session.

HOW IT WORKS

AgentIR — A Cascade Retrieval Substrate for Agent Memory

AgentIR’s core mechanism keeps SIMD-Accelerated BM25, a Temporal Partitioned Index, Agent-Aware Fusion, and a Cascade Router live over one CSR substrate, choosing the fusion and dense usage per query.

You can think of AgentIR like a memory hierarchy: BM25 and the temporal index are the fast cache, dense HNSW is slower RAM, and the cascade router decides when to hit RAM.

This workload-adaptive design lets AgentIR deliver sub-100 µs p50 retrieval at 5M records and skip the 52 ms dense channel on easy queries, something a fixed context window or static IR stack cannot do.

DIAGRAM

AgentIR Query-Time Cascade Retrieval Flow

This diagram shows how AgentIR routes each query through BM25, the temporal index, and optionally the dense channel using a confidence-triggered cascade.

DIAGRAM

AgentIR Evaluation and Scaling Pipeline

This diagram summarizes how AgentIR is evaluated on BEIR, LongMemEval, and synthetic scaling workloads, including baselines and metrics.

PROCESS

How AgentIR Handles a Long-Term Agent Session

  1. 01

    Agent Memory Workload Characterization

    AgentIR first models agent memory as tuples with dense embedding, role, session, agent, tool type, timestamp, and importance weight to capture recency and heterogeneity.

  2. 02

    Temporal Partitioned Index Construction

    AgentIR builds a time-partitioned sparse index in 7 day windows so that recency biased queries only touch a few recent partitions with O(log 1/ε) work.

  3. 03

    Agent Aware Fusion and Routing

    At query time, AgentIR runs SIMD BM25, optionally dense HNSW, and applies agent aware RRF with recency and importance bonuses chosen by the Cascade Router.

  4. 04

    Workload Conditional Cascade Execution

    AgentIR’s cascade router uses BM25 confidence or a TF IDF classifier to skip the 52 ms dense channel on easy queries, adapting thresholds per workload like LongMemEval or LoCoMo.

KEY CONTRIBUTIONS

Key Contributions

  • 01

    Sub Linear Temporal Partitioned Index

    AgentIR’s temporal partitioned index achieves O(log 1/ε) expected work, so 1234× corpus growth from 4,052 to 4,998,640 records costs only 3.6× latency growth and yields 1769× speedup over sequential at 5M records.

  • 02

    Heterogeneous CPU GPU BM25 Pipeline

    AgentIR’s SIMD Accelerated BM25 with GPU CSR scoring matches Lucene quality within ±0.020 nDCG@10 and runs 1.8–29× faster than Pyserini 8T and 11× faster than PISA 1T BlockMax WAND on BEIR.

  • 03

    Workload Conditional Fusion and Cascade Router

    AgentIR’s agent aware fusion and cascade router pick BM25, Dense, RRF, or agent_rrf per query, skipping dense on 63% of LongMemEval queries for 2.67× speedup and auto tuning to 100% skips on LoCoMo for 132× speedup and +0.089 Hit@5.

RESULTS

By the Numbers

nDCG@10 (NFCorpus)

0.3267

+0.0029 over Pyserini Lucene (0.3238)

Latency 8T (NFCorpus)

0.04 ms

29× faster than Pyserini 8T (1.16 ms)

R@10 (LongMemEval agent_rrf)

0.978

+0.032 over BM25 (0.946) on session recall

Cascade Latency (LongMemEval)

19.9 ms

2.67× faster than always hybrid 53.2 ms at parity LLM Acc 0.302

On BEIR, AgentIR’s BM25 core matches or beats Pyserini Lucene quality while being up to 29× faster, and on LongMemEval AgentIR’s agent aware fusion reaches R@10=0.978 with a cascade router that cuts hybrid latency by 2.67× without losing LLM judged accuracy.

BENCHMARK

By the Numbers

On BEIR, AgentIR’s BM25 core matches or beats Pyserini Lucene quality while being up to 29× faster, and on LongMemEval AgentIR’s agent aware fusion reaches R@10=0.978 with a cascade router that cuts hybrid latency by 2.67× without losing LLM judged accuracy.

BENCHMARK

LongMemEval LLM Judged Strict Accuracy with Different Fusion Strategies

Strict LLM judged accuracy on LongMemEval using gpt-4o-mini as both answerer and judge.

BENCHMARK

BEIR BM25 Latency Comparison on NFCorpus

Average per query latency on NFCorpus comparing AgentIR to Pyserini and PISA.

KEY INSIGHT

The Counterintuitive Finding

On LoCoMo, the same AgentIR cascade trigger that helps on LongMemEval auto tunes to a 100% skip rate, making BM25 alone optimal with 132× speedup and +0.089 Hit@5.

This is surprising because dense retrieval and hybrid fusion are often assumed to always help, but AgentIR shows that for short conversational turns a pure BM25 channel is both faster and more accurate.

WHY IT MATTERS

What this unlocks for the field

AgentIR makes it practical to serve 5M record agent memories with sub 100 µs p50 retrieval and sub 10 ms amortized latency per agent step on commodity 8 core hardware.

With AgentIR, builders can deploy long running LLM agents that continuously grow their memory, adapt retrieval strategy per query and workload, and still meet tight interactive latency budgets without overprovisioned clusters.

~14 min read← Back to papers

Related papers

Memory Architecture

A Control Architecture for Training-Free Memory Use

Yanzhen Lu, Muchen Jiang et al.

· 2026

TAG routes low-confidence steps to uncertainty-based routing, filters them with guarded acceptance with rollback, chooses between bank selection across rule and exemplar memory, and prunes via evidence-based retirement inside a unified control loop. On SVAMP and ASDiv, TAG reaches 81.0% and 85.2% accuracy, improving over the 74.0% and 77.5% no-memory baselines while a compute-matched Retry baseline stays flat.

Questions about this paper?

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

Answers use this explainer on Memory Papers.

Checking…