Manuscript Offprint

arXiv:2610.23583

MARS: Memory-Aware Routing for Session-Level LLM Assistants

Minghan Wang, Jinhang Zuo, Zhongxiang Dai, Zhiyong Wang, Fang Kong

Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.

Abstract

Long-term LLM assistants must repeatedly decide what prior context to expose and which model should answer as an interaction evolves. Existing memory systems and model routers usually make these decisions separately, although memory construction changes the evidence, distractors, and difficulty of the resulting input. We introduce MARS, a memory-aware routing framework that uses session state as a shared control interface between memory construction and model selection. A Query and Topic Manager (QTM) estimates compact decision-relevant state that guides a fixed state-conditioned memory policy and an online router, enabling each turn to receive an appropriate memory view and a suitable model under a quality–memory–cost trade-off. We evaluate MARS on REALMEM and MULTICHALLENGE with 16 system configurations each, covering long-history memory-driven interaction and bounded sessions with structured context interference. On REALMEM, MARS preserves 98.2% of full-context GPT-4o's QA while using only 14.5% of its generation API cost, including both generation and controller calls for MARS, and achieves the strongest measured memory-recall and retrieval scores among compared systems. On MULTICHALLENGE, MARS trails the strongest static system overall but approaches its performance at lower recorded cost on a mechanism-focused subset. Together, these results support a favorable quality–memory–cost trade-off for long-history, memory-dependent interaction.

1 Introduction

Modern LLM assistants are no longer used only for isolated questions; they increasingly support ongoing work across many turns and sessions. In long-term use, interactions can span many turns and recur across tasks, a setting highlighted by recent work on long-term conversational and memory-driven agents (Maharana et al., 2024; Park et al., 2023; Packer et al., 2023; Bian et al., 2026). Users may resume unfinished artifacts, request revisions, refer to earlier constraints, or ask for final answers that depend on decisions made several turns or sessions earlier. Before answering such turns, an assistant must decide both what prior context to include and which model should answer. This creates a quality–memory–cost trade-off: richer memory can provide necessary evidence but also increases context length and distractors, while stronger models can better interpret complex memory views but are more expensive.

Existing systems usually handle these decisions separately. Memory systems store, update, and retrieve prior information (Lewis et al., 2020; Packer et al., 2023; Chhikara et al., 2025; Xu et al., 2025), while model routers select a generator from a candidate pool to trade off quality and cost (Chen et al., 2023; Hu et al., 2024; Ding et al., 2024; Ong et al., 2024; Nguyen et al., 2024; Poon et al., 2025; Wang et al., 2025). This separation overlooks a key dependency: memory construction determines what evidence, constraints, and distractors enter the prompt, while routing determines whether the selected model can use that context reliably and cost-effectively.

This dependency makes memory construction and model routing inherently coupled. As Figure 1 illustrates, finalizing a launch brief requires using the updated launch date (May 19, superseding May 12) while preserving an earlier constraint of exactly three paragraphs. Omitting the constraint or exposing the obsolete date can cause errors, while an unsuitable model may fail even when the relevant memory is present. Exposing all history can add distractors and increase context difficulty (Liu et al., 2024; Bai et al., 2023),

Figure

Figure 1: Illustrative motivation for memory-aware routing in a multi-turn session. MARS uses a shared QTM-derived session state to coordinate task-relevant memory construction and online model routing. The surrounding panels illustrate missing constraints, stale memory, model mismatch, and costly overuse. A–C denote candidate models; outputs are schematic and costs qualitative, with “lower” relative to the overuse configuration.

and always invoking a stronger model can incur unnecessary cost. The appropriate model depends on the selected memory view rather than the raw query alone. The key challenge is therefore to coordinate what history becomes input and which model can use that context reliably and cost-effectively.

Motivated by this coupling, we study session-level adaptive memory routing: coordinating memory exposure and model selection throughout a session under a quality-memory-cost trade-off. We formulate this as a sequential decision problem: the system estimates session state, constructs a candidate memory view, selects a model, packs the view for that model, generates a response, and updates its routing preference from turn-level feedback. Because the memory view changes the evidence, distractors, context length, and reasoning burden faced by the selected model, the system needs a shared session-state interface for both memory construction and model routing.

We introduce MARS, a memory-aware routing framework for session-level LLM assistants. MARS uses a Query and Topic Manager (QTM) to infer structured session state from the query, active thread, recent turns, and memory pool. The memory policy uses this state to build a task-relevant candidate memory view. The online router uses the same state and pre-packing view statistics to select a model; the selected model's budget then determines the final context packing. After generation, turn-level feedback updates the router, enabling lightweight adaptation without retraining the underlying LLMs. The QTM prompt, schema, guardrails, and state-to-memory mapping are fixed; the memory view varies by turn, while the router learns online. MARS achieves coordination through a shared structured session-state interface.

We evaluate MARS on two representative multi-turn benchmarks, REALMEM (Bian et al., 2026) and MULTICHALLENGE (Sirdeshmukh et al., 2025), using 16 system configurations on each. The experiments test reliability across bounded session interference and long-history memory-driven interaction. On REALMEM, MARS retains 98.2% of full-context GPT-4o's persona-macro QA with generation-controller API cost equal to 14.5% of GPT-4o's generation cost while obtaining the strongest measured memory-recall and retrieval scores. On full MULTICHALLENGE, full-context Qwen2.5 72B is strongest (67/245), followed by GPT-4o (64/245), while MARS reaches 58/245. On the two axes most aligned with state recovery and version editing, MARS reaches 44/137 versus 45/137 for Qwen2.5 72B at lower recorded cost. Together, these results support our central claim: coordinating memory exposure and model choice through shared session state provides a useful quality-memory-cost operating point in long-history, memory-dependent interaction.

Our contributions are:

• We formulate session-level adaptive memory routing as a coordinated sequential decision problem over memory exposure and model selection under a quality-memory-cost trade-off.

• We introduce MARS, which uses QTM-derived state as a shared control interface for fixed-policy memory construction, online model routing, and feedback updates.

• We provide a cross-regime evaluation on two representative multi-turn benchmarks, showing that MARS achieves a strong quality-memory-cost trade-off in long-history interaction.

References (17)