SAG-Mem

Retrieve the details an agent needs from conversations across sessions.

First page of the SAG-Mem technical report
arXiv:2611.33124

Long-term memory from conversation history

SAG-Mem applies SAG2 retrieval to conversations. Each message keeps its original wording, speaker and date. A keyword search finds the first passages. Names and terms from those passages guide a second search across sessions.

Keep the decision and its context
A meeting moves from Wednesday to Thursday because a colleague is travelling. Keeping the message preserves both the new date and the reason, even if nobody asks why until months later.
Keep each message intact
Consecutive messages are grouped within each session, aiming for 512 tokens per passage. A long message gets its own passage. Each retains speaker names, dates and references to the original messages.
Preserve corrections in sequence
New sessions are appended to the index. An earlier plan and a later correction each retain their date, so the reader can establish their order when both are retrieved.

Where does Maya’s mentor live?

In the paper’s example, the question names Maya. To find the city, the system first has to discover whom to look for.

Cross-session retrieval1 / 4

Search termsMaya · mentor

Session 1 · Maya

My mentor is Leo.

Search the question

BM25 searches the original dialogue. Both Maya and mentor occur in the first session.

How SAG-Mem and Lite select evidence

Both versions start with a BM25 keyword search, take new terms from highly ranked passages and return up to 20 passages to the reader. They differ in how they score the passages and how far they search.

SAG-Mem

Indexing requires no model calls. At query time, JEV scores the initial candidates against the question. In the next round it can consider evidence already found, giving an otherwise weak match a reason to rank highly.

Candidates per round
50
Expansion rounds
1

SAG-Mem-Lite

Lite computes a vector for each passage when indexing and one for the question when searching. It compares the question with the keyword candidates, so it needs no separate vector database.

Candidates per round
100
Maximum expansion rounds
2

With prebuilt LoCoMo indexes, a complete query and answer averaged 3.282 seconds for SAG-Mem and 0.906 seconds for Lite. Retrieval, including JEV scoring, took 2.059 seconds for SAG-Mem.

Table 6 · Retrieval and answer latency

Months later, what date does “yesterday” refer to?

Message sent on May 12, 2025

I moved yesterday and signed the lease last month.

Passage sent to the reader

I moved yesterday (2025/05/11) and signed the lease last month (2025/04).

Dates are calculated relative to the message, using the session date if the message has none. A month stays a month, and vague phrases such as “recently” stay as written. Annotations are added after retrieval, leaving the stored dialogue intact.

Answer accuracy and total cost

Across 500 LongMemEval-S questions, Lite reached 77.20% accuracy at a total cost of $0.95. Passing the full conversation history to the model cost $9.80 and reached 68.88%.

Accuracy against total cost for nine methods on both datasets. Values follow in the tables.
Higher points indicate greater accuracy. Further right means higher total cost on a logarithmic scale. Methods below and to the right of the green Lite marker cost more and answer fewer questions correctly.
LoCoMo
MethodAccuracyTotal cost
SAG-Mem83.08%$2.86
SAG-Mem-Lite77.09%$0.70
Full Context80.46%$6.20
BM25-only72.60%$0.67
Dense RAG76.20%$0.71
Mem073.91%$0.71
MemOS65.06%$0.95
Zep58.25%$9.18
TDAM53.67%$3.53
LongMemEval-S
MethodAccuracyTotal cost
SAG-Mem80.20%$1.91
SAG-Mem-Lite77.20%$0.95
Full Context68.88%$9.80
BM25-only67.60%$0.40
Dense RAG73.00%$0.79
Mem068.80%$189.86
MemOS69.00%$40.07
Zep57.77%$687.49
TDAM54.70%$253.41

LoCoMo has 1,986 text-only questions and LongMemEval-S has 500. Qwen3.6-35B-A3B-FP8 served as reader and judge. Costs in US dollars cover indexing, retrieval and answer generation for the entire dataset, excluding offline judging.

Tables 3 and 5 · Accuracy and total cost

Which design choices improve answers?

The paper isolates two decisions. Turning off expansion tests the value of a second search. Keeping the passages fixed and changing only how dates appear tests the value of calendar annotations.

Accuracy with and without expansion

LoCoMo

Initial search only78.15%
One expansion round83.08%

LongMemEval-S

Initial search only75.20%
One expansion round80.20%

Where calendar dates helped

On 321 LoCoMo temporal questions, accuracy rose from 63.55% with raw dates to 79.44% with date annotations, a gain of 15.89 percentage points. On 133 LongMemEval-S temporal questions, both settings scored 76.69%.

Finding a relevant message can still yield a wrong answer

With default settings, SAG-Mem answered 214 of 282 LoCoMo multi-hop questions correctly. Of the 68 errors, only 4 missed all annotated evidence. In 64 cases some evidence was present, leaving both its completeness and the reader’s interpretation to examine.

Tables 7, 9 and 12 · Ablations and error analysis

Trace an answer in the benchmark

The official repository includes both methods. After installing the dependencies and preparing the data, check loading and chunking with two LoCoMo questions. This preflight makes no model calls.

python reproduction/run.py --method sag-mem --dataset locomo --limit 2 --preflight

For a full run, configure the reader and judge, plus JEV for SAG-Mem or an embedding model for Lite. Each run.jsonl record includes the retrieved evidence, answer, grade, timing and usage, so individual questions can be checked.