NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

MESA:Task-Adaptive Multi-Structure Evidence Selection for Long-Horizon Agent Memory

Beidi Zhao, Yaoqi Chen, Yuru Feng, Menghao Li, Qianxi Zhang, Baotong Lu, Jianan Lu, Zhirui Wang, Xinjiang Wang, Shusen Xu, Zengzhong Li, Xiaoxiao Li, Qi ChenarXiv 2026

TL;DR

MESA (Multi-structure Evidence Selection for long-horizon Agents) is a novel framework that dynamically selects and fuses a query-adaptive subset of diverse memory structures (such as text summaries, knowledge graphs, and raw traces) to answer questions about long agent trajectories. By optimizing this selection policy using sparse, answer-level feedback, MESA outperforms the strongest baselines by up to 8.5% on AMA-Bench while reducing evidence token costs by 41%.

What Problem Does This Paper Address?

As AI agents tackle increasingly complex, long-horizon tasks—like software engineering or multi-step web navigation—they accumulate massive execution histories containing interleaved reasoning, tool outputs, and observations. Finding a critical piece of evidence buried thousands of steps back is a major challenge.

While modern Large Language Models (LLMs) boast massive context windows, feeding them raw, full trajectories is financially expensive and frequently suffers from "lost-in-the-middle" retrieval degradation. To mitigate this, external agent memory systems organize history into specific abstractions (e.g., vector databases, text summaries, or knowledge graphs).

However, each memory structure provides an incomplete view. Summaries lack exact details; vector databases discard temporal order; knowledge graphs miss step-level indexing. Existing systems either use a fixed, exhaustive combination of all structures (which introduces distracting noise and inflates token costs) or route the query to a single structure (preventing the composition of complementary evidence).

Methods

MESA introduces structure-level dynamic selection, an executable policy that determines exactly which combination of memory structures to consult for a given query.

Figure 3: Overview of MESA. (a) A long interaction trajectory is converted offline into five complementary memory structures. At inference, the learned selector ρ∗chooses a query-dependent subset, retrieves and merges its evidence, and passes it to a frozen answer model. (b) Prior-guided harness optimization evolves only the selector under prior directions and using UCB to balance exploration and exploitation. Localized proposals are evaluated using a performance–cost objective, and reflections update the policy archive. The final policy is selected on validation data.

The framework maintains five independent memory structures built offline from the agent's history:

  1. Text Summary (S): Broad episodic context highlighting major state changes.
  2. Temporal Store (T): A turn-indexed key-value store preserving chronological sequence.
  3. Knowledge Graph (G): Relational facts capturing cross-step entity connections.
  4. Vector Database (V): Dense, step-level embeddings for semantic similarity.
  5. Raw Episodic Trace (R): Overlapping windows of exact surface-form text.

To learn an effective selection policy ($\rho$) under weak supervision (where ground-truth memory subsets are unavailable and only final answer correctness is known), MESA utilizes Prior-Guided Harness Optimization. Instead of searching an unconstrained space, an LLM proposer generates candidate policies guided by 20 structured prior directions across 5 axes (e.g., demand inference, backend value estimation, and cost shaping). To balance exploration and exploitation among these directions, MESA implements an Upper Confidence Bound (UCB)-guided scheduler. Candidate policies are optimized and selected using a regularized validation objective that explicitly penalizes excessive token usage.

Datasets

The authors evaluate MESA on two primary benchmarks:

  • AMA-Bench: A long-horizon agent memory benchmark containing 208 real-world agent episodes and 2,496 expert-curated QA pairs. It spans six domains (Web, Open-World QA, Text-to-SQL, Software Engineering, Gaming, and Embodied AI) and tests four distinct memory capabilities (Recall, Causal Inference, State Updating, and State Abstraction).
  • LoCoMo: A long-term conversational memory dataset consisting of 10 multi-session conversations and 1,540 evaluated questions, used to test MESA's generalizability beyond agent trajectories.

Key Insights and Ideas

  • The "Goldilocks" Memory Subset: Through an exhaustive sweep of all 31 possible non-empty memory structure combinations, the authors discovered that intermediate subsets (combinations of 2 to 4 structures) consistently outperform both single-structure routing and all-structure fusion.
  • No Universal Configuration: The optimal memory configuration is highly task- and domain-dependent. For instance, gaming tasks might rely heavily on temporal stores, while software engineering requires a blend of summaries, raw text, and vector databases to resolve exact code identifiers.
  • Interpretable Policy Evolution: As optimization progresses, MESA's learned policy evolves from simple keyword-matching rules into nuanced, query-conditioned routing logic that balances evidence coverage against token budgets.
Figure 2: The best memory-structure combination is task- dependent. We sweep non-empty subsets of the five struc- tures (Summary-S, Temporal-T, Graph-G, Vector-V, Raw-R) on AMA-Bench and report judge accuracy (%), split (a) by domain and (b) by capability. Colored lines trace only the per- axis winners, each marked with a star. The winning subset changes on different tasks. Grey dots show all other combi- nations’ result.

Key Results

  • State-of-the-Art Accuracy: Using a Qwen3-32B backbone, MESA achieves 65.1% overall accuracy on AMA-Bench, outperforming the strongest baseline (AMA-Agent) by 8.5% and a standard long-context reader by 12.5%. Similar gains (+6.4%) were achieved using a Gemma-4-31B backbone.
  • Significant Token Savings: MESA achieves its superior accuracy while consuming 41% fewer evidence tokens than the all-structure alternative, successfully navigating the utility-redundancy dilemma.
Figure 1: Overview and motivation of MESA. (a) An SWE long-horizon agent execution example. Each single memory structure provides a distinct view of evidence. MESA dynam- ically selects and fuses a subset of complementary struc- tural memories to arrive at the correct answer. (b) Driven by adaptive memory-structure selection, MESA outperforms all single-structure baselines. (c) MESA achieves higher ac- curacy while consuming 41% fewer tokens compared to the all-structure alternative.
  • Conversational Generalization: On the LoCoMo dataset, MESA achieves an overall F1 score of 49.0%, outperforming the best specialized conversational memory baseline by 1.8%.

Limitations and Future Work

While MESA marks a substantial advancement, the authors note several limitations:

  • Decoupled Construction and Selection: Memory structures are constructed statically offline. Jointly optimizing memory construction alongside the selection policy could yield further improvements.
  • Causal Inference Bottleneck: MESA showed a slight performance drop (-1.4%) compared to AMA-Agent on explicit Causal Inference tasks, indicating a need for explicit modeling of cross-event and cross-structure dependencies.
  • Static Memory Constraints: The current framework does not address continuously updated or multimodal agent memories, which represent vital directions for future research.

Summary updated

BibTeX
@misc{zhao2026mesa,
  author = {Beidi Zhao and Yaoqi Chen and Yuru Feng and Menghao Li and Qianxi Zhang and Baotong Lu and Jianan Lu and Zhirui Wang and Xinjiang Wang and Shusen Xu and Zengzhong Li and Xiaoxiao Li and Qi Chen},
  title = {{MESA:Task-Adaptive Multi-Structure Evidence Selection for Long-Horizon Agent Memory}},
  year = {2026},
  eprint = {2608.10108},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2608.10108},
}
Figure