← Latest papers
🤖 AI

Learning What to Remember: Observability-Safe Memory Retention via Constrained Optimization for Long-Horizon Language Agents

This paper introduces OSL-MR, a novel framework that formulates memory retention for long-horizon language agents as a constrained stochastic optimization problem to learn query-conditioned evidence value under strict observability constraints, demonstrating superior performance over existing heuristic and recency-based methods on benchmarks like LOCOMO and LongMemEval.

Original authors: Qingcan Kang, Liu Mingyang, Shixiong Kai, Kaichao Liang, Tao Zhong, Mingxuan Yuan

Published 2026-06-10
📖 5 min read🧠 Deep dive

Original authors: Qingcan Kang, Liu Mingyang, Shixiong Kai, Kaichao Liang, Tao Zhong, Mingxuan Yuan

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

Imagine you are a detective trying to solve a massive, multi-day mystery. You have a limited amount of space in your notebook to write down clues, witness statements, and facts. Every time you write something new, you might have to erase something old. If you erase the wrong thing, you might miss a crucial clue later. If you keep too much junk, your notebook gets full, and you can't write down the new, important stuff.

This is the exact problem OSL-MR solves for AI agents (computer programs that talk and think like humans) when they have long conversations.

Here is the breakdown of the paper's ideas using simple analogies:

1. The Problem: The "Too Much Stuff" Dilemma

Current AI agents are like detectives who try to keep everything in their notebook, or they just keep the most recent notes and throw away the rest.

  • The Issue: If the conversation is very long, the notebook (called the "context window") runs out of space.
  • The Mistake: Old methods decide what to keep based on simple rules, like "keep the newest note" or "keep the note that sounds most important right now." But this is like a detective keeping a note about the weather because it was written yesterday, while throwing away a note about a suspect's alibi because it was written three days ago. The old note might be useless, but the old alibi might be the key to solving the case later.

2. The Solution: A "Smart Budget Manager"

The authors created a new system called OSL-MR. Think of it as a super-smart budget manager for your detective's notebook.

Instead of just guessing, OSL-MR treats memory retention as a math puzzle. It asks: "If I keep this note now, will it help me solve the mystery later? If I throw it away, will I have to pay a heavy price to find it again?"

It considers three main costs:

  • The "Miss" Penalty: If I throw away a clue and can't find it later, I fail the case.
  • The "Re-acquisition" Cost: If I throw it away but need it later, I have to spend time and energy searching for it again.
  • The "Stale" Risk: If I keep a note that is outdated (like an old map of a city that has changed), it might mislead me.

3. The "No Crystal Ball" Rule (Observability)

This is the most important part of the paper.

  • The Trap: In a perfect world, the detective could look into a crystal ball to see exactly which clues will be needed tomorrow. But in the real world, you cannot see the future.
  • The Rule: The OSL-MR system is designed so that the AI never uses "future knowledge" to make decisions. It only uses what it can see right now (the current question, the memory's age, and the topic).
  • Why it matters: Many other AI systems cheat by using "gold labels" (knowing the answer beforehand) to train. OSL-MR strictly separates "what we know now" from "what we know after the fact." This ensures the AI can actually be used in real life, where it doesn't have a crystal ball.

4. How It Learns: The "Apprentice and the Master"

Since the AI can't see the future, how does it learn to make good choices? The paper uses a two-step training process:

  • Step 1: The "Mixed-Score" Heuristic (The Apprentice)
    Before the AI has any experience, it uses a simple, safe rulebook (the "Mixed-Score"). It's like a junior detective who keeps notes based on a checklist: "Is it recent? Is it relevant? Is it too big?" This ensures the system works immediately, even with zero data. It logs every interaction to learn from.

  • Step 2: The "Evidence Learner" (The Master)
    Once the system has collected enough logs of real conversations, it trains a smarter model. This model looks at the logs and learns: "Hey, in this specific situation, keeping that old note actually helped solve the problem later."

    • It learns directly from gold evidence (the correct answers) to understand what actually mattered.
    • Crucially, it still only uses the "Apprentice's" safe inputs (no future knowledge) when making decisions in the real world.

5. The Results: Better Memory, Less Waste

The authors tested this on two big datasets (LoCoMo and LongMemEval) where AI agents had to handle long, complex conversations.

  • The Winner: OSL-MR consistently beat the other methods (like "Recency" or "Generative Agents").
  • The "Tight Budget" Test: When the notebook space was very small (a tight budget), OSL-MR shined the brightest. While other methods filled their notebooks with useless junk, OSL-MR carefully selected only the most valuable clues.
  • Precision vs. Recall: It didn't just keep more stuff; it kept the right stuff. It was better at knowing exactly what to keep to get the right answer, without wasting space on irrelevant details.

Summary

OSL-MR is a new way for AI to manage its memory. It stops the AI from guessing or cheating with future knowledge. Instead, it teaches the AI to act like a smart resource manager: it learns from past experiences what clues are truly valuable, ensuring that when the AI has a limited amount of space, it fills that space with the most important information possible to solve the problem at hand.

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 →