LAM: Efficient Lossy Agent Memory Framework With A Retrieval-Score Error Bound
Organizations: Argonne National Laboratory · University of Houston · Oregon State University · IBM Research
Abstract
Agent memory grows as agents read inputs, reason, and call tools. Longer histories increase inference cost and eventually exceed the context window. LLM-based summarization reduces this history but adds latency and provides no explicit bound on information loss. We propose LAM, a Lossy Agent Memory system with three components: a deterministic deduplication rule with a substitution bound on retrieval scores - a bound on score perturbation, not a certificate of unchanged ranking; a memory manager that preserves the cached prefix and overlaps compaction with inference; and a performance model that estimates compaction costs before deployment. On 600 agent trajectories, LAM removes 22.47% of observation tokens while retaining 99.984% of the measured gold-patch evidence. At a fixed deletion set, the performance model predicts a 71.4x-91.6x end-to-end speedup from removing records before prefill instead of deleting them from a prefilled context. That benefit comes from the schedule rather than the rule and applies to any prefix-preserving test.
Figures & tables
| symbol | quantity | value / source | |
|---|---|---|---|
| offline | prefill rate, decode step time | GB10 anchors, Table 22 | |
| encoder throughput | 71,708 tok/s | ||
| xxHash3 | 38.2 GB/s | ||
| exact verify | 13.0 M pairs/s | ||
| cuSZp | 53.3 GB/s | ||
| bytes per token | 3.68 B/tok |
| method | schedule | batch 1 | batch 32 | |
|---|---|---|---|---|
| observation masking ( ) | wall | 0.75 | 107.7 (9.4 ) | 105.1 (11.8 ) |
| LLM summarization ( ) | wall | 0.90 | 498.0 (43.6 ) | 495.5 (55.8 ) |
| SemDeDup (global -means, ) | wall | 0.32 | 647.9 (56.7 ) | 645.4 (72.7 ) |
| LLMLingua-2 (rate ) | wall | 0.24 | 790.5 (69.1 ) | 787.9 (88.7 ) |
| LAM, L0 only | admit | 0.17 | 12.0 (1.1 ) | 9.5 (1.1 ) |
| LAM, full | admit | 0.22 | 11.4 | 8.9 |
| mean | keep | R@10 | tokens removed | evidence | resolve | ||
|---|---|---|---|---|---|---|---|
| 0.1414 | 0.350 | 0.916 | 0.9978 | 18.89% | 100.000% | 75.83% | |
| 0.2000 | 0.409 | 0.896 | 0.9947 | 19.64% | 100.000% | 75.83% | |
| 0.2828 | 0.532 | 0.856 | 0.9881 | 21.53% | 100.000% | 75.83% | |
| 0.3162 | 0.559 | 0.837 | 0.9846 | 22.50% | 99.984% | 75.67% | |
| 0.4472 | 0.706 | 0.696 | 0.9518 | 32.02% | 98.709% | 70.33% |
Appendix figures & tables30 assets
Supplementary material from the paper’s appendix.
Appendix
| stage | setting |
|---|---|
| chunking | fixed 512-token windows over tool observations, no overlap |
| encoder | bge-base-en-v1.5 , unit-normalized, |
| threshold | , i.e. by equation 1 |
| candidates | banded LSH over , verified by exact |
| byte codec | cuSZp, relative error bound of |
| stubs | one line per drop, charged as input (0.69%) |
| granularity | unit | removable |
|---|---|---|
| record | one whole tool observation | 1.61% |
| paragraph | blank-line separated block | 1.61% |
| chunk-512 | fixed 512-token window | 2.61% |
| line | a single line | 18.14% |
| chunks removed (cardinality) | tokens removed | |||||
|---|---|---|---|---|---|---|
| attained | ceiling ( ) | % of ceiling | at | at | ||
| 8.42% | 14.16% | 59.48% | 6.16% | 11.47% | ||
| 15.86% | 61.19% | 25.92% | 13.13% | 62.55% | ||
| 28.35% | 91.86% | 30.87% | 26.12% | 91.63% | ||
| K | K | K | K | |
|---|---|---|---|---|
| batch 1 | 2.5% (1.03 ) | 6.4% (1.07 ) | 21.6% (1.28 ) | 52.4% (2.10 ) |
| batch 32 | 23.5% (1.31 ) | 45.0% (1.82 ) | 76.6% (4.28 ) | 92.9% (14.1 ) |
| policy | batch 1 | batch 32 | % of total |
|---|---|---|---|
| delete in place (prefill, then remove) | s | s | 98.6% |
| error-bounded (remove, then prefill) | s | s | 0.1% |
| policy gain | 71.4 | 91.6 |
| compactor | GPU server | CPU compactor | |||
|---|---|---|---|---|---|
| threads | out tok/s | TTFT p50 | TPOT p50 | ctx tok/s | vs. solo |
| fixed arrival rate, 5 req/s — server unsaturated | |||||
| none | 990.8 | 157.0 ms | 11.81 ms | — | — |
| 8 | 990.8 | 164.7 ms | 11.84 ms | 2,937 | 0.966 |
| 16 | 990.7 | 166.5 ms | 11.84 ms | 4,647 | 0.929 |
| 32 | 989.0 | 192.5 ms | 13.68 ms | 3,809 | 0.620 |
| quantity | value | note |
| gross removal | 23.19% | L1 followed by L0 |
| net of stubs | 22.50% | stubs cost 0.69% of input |
| chunks encoded | 27,986 | one encoding per chunk |
| per-turn latency | 18.1 ms mean / 115 ms p99 | a turn itself costs 306 ms–3.3 s |
| measured bound | attained, not configured | |
| online batch | byte-identical residuals | verified deletion-set equality, 600/600 pass |
| substitution distance , token-weighted | retrieval | ||||||
| bound | median | p99 | max | mean | keep | R@10 | |
| 0.1414 | 0.0376 | 0.1401 | 0.1412 | 0.350 | 0.916 | 0.9978 | |
| 0.2000 | 0.0820 | 0.1979 | 0.1999 | 0.409 | 0.896 | 0.9947 | |
| 0.3162 | 0.2103 | 0.3148 | 0.3162 | 0.559 | 0.837 | 0.9846 | |
| 0.4472 | 0.3598 | 0.4457 | 0.4472 | 0.706 | 0.696 | 0.9518 | |
| configuration | removal | vs. default |
|---|---|---|
| L0 alone (exact hashing) | 18.04% | pt |
| L1 alone (near-duplicate) | 13.81% | pt |
| A: L0 L1 | 20.52% | pt |
| B: L1 L0 (default) | 22.97% | — |
| independence estimate (rejected) | 29.35% | pt |
| stage | seconds | % of total |
|---|---|---|
| bge-base encode | 13.945508 | 99.989% |
| quantize | 0.000138 | 0.001% |
| band digests | 0.000078 | 0.001% |
| exact verify | 0.001201 | 0.009% |
| cuSZp byte layer | 0.000069 | 0.000% |
| total | 13.946994 |
| method | removal | evidence kept | trajectories intact | lines lost |
| no compaction | 0.00% | 100.000% | 100.0% | 0 |
| L0 alone (exact hashing) | 18.02% | 100.000% | 100.0% | 0 |
| ours, | 18.86% | 100.000% | 100.0% | 0 |
| ours, | 21.49% | 100.000% | 100.0% | 0 |
| ours, | 22.47% | 99.984% | 99.8% | 1 |
| ours, | 31.99% | 98.709% | 93.0% | 81 |
| method | removal | context gain | cost / event | share of turn |
|---|---|---|---|---|
| L0 alone (xxHash3) | 18.04% | 1.220 | 3.08 s | |
| L1 alone (near-duplicate) | 13.81% | 1.160 | 8.88 ms | 0.0089 |
| L1 L0, gross | 23.19% | 1.302 | 8.88 ms | 0.0089 |
| L1 L0, net | 22.50% | 1.290 | 8.88 ms | 0.0089 |
| ours hashing | pt | 1.058 | 2,883 | — |
| floor | admissible | evidence loss | binding point | RSC drop | binding point |
|---|---|---|---|---|---|
| 7 | 0.0% | (all tie) | 0.00 pp | (all tie) | |
| 10 | 0.7% | SemDeDup | 0.17 pp | ours | |
| 16 | 5.5% | SemDeDup | 1.83 pp | ours | |
| 22 | 12.0% | ours | 8.50 pp | ours |
| best | |||||
|---|---|---|---|---|---|
| method | (unconstrained) | ||||
| L0 alone | 18.02% | 18.02% | 18.02% | 18.02% | 18.02% |
| near-duplicate layer alone | 26.09% | 11.42% | 13.08% | 13.08% | 26.09% |
| observation masking | 81.44% | — | — | 4.42% | 4.42% |
| SemDeDup, 5 seeds | 47.19% | — | 19.60% | 22.84% | 33.74% |
| ours: near line | 31.99% | 21.49% | 22.47% | 22.47% | 31.99% |
| break-even vs. ours | |||||
|---|---|---|---|---|---|
| ours, | 0.2247 | 0.2246 | 0.2245 | 0.2241 | — |
| ours, | 0.3199 | 0.3141 | 0.3027 | 0.2741 | 16.9 |
| masking, | 0.3406 | 0.3097 | 0.2478 | 0.0932 | 3.8 |
| masking, | 0.6738 | 0.5884 | 0.4178 | 5.3 | |
| masking, | 0.7794 | 0.6603 | 0.4222 | 4.7 |
| K | K | K | K | |
|---|---|---|---|---|
| uncompacted | 22.0% | 67.2% | 93.2% | 99.3% |
| ours, | 23.0% | 71.5% | 94.2% | 99.8% |
| ours, | 25.2% | 75.0% | 96.7% | 100.0% |
| ours, | 33.0% | 83.7% | 99.3% | 100.0% |
| byte codec | dedup | codec | composite | recall@10 | |
| binary (sign) | 0.6204 | ||||
| cuSZp/fixed, | 0.6354 | ||||
| cuSZp/fixed, | 0.6491 | ||||
| cuSZp/fixed, | 0.6549 | ||||
| int8 (per-vector) | 0.6556 | ||||
| operating point we ship | |||||
| LHTB | SWE-bench | |||
|---|---|---|---|---|
| all context | observations | observations | ratio | |
| L0 (byte-exact) | 2.08% | 3.35% | — | — |
| 6.28% | 8.07% | — | — | |
| 14.44% | 16.78% | 6.52% | ||
| 18.71% | 20.54% | 8.39% | ||
| 33.07% | 33.39% | 13.81% | ||
| quantity | measured | benchmark |
|---|---|---|
| streaming bandwidth | 237.4 GB/s | triad , MB fp32; of the 273 GB/s spec |
| fp16 tensor matmul | 90.3 TFLOP/s | GEMM |
| machine balance | 380 FLOP/byte | derived ; everything below is bandwidth-bound |
| bge-base encode | 71,708 tok/s | 512 synthetic docs 512 tok = 262K tok, batch 64 |
| quantize | 65.4 GB/s | fp32 int16, 6 B/element moved; unfused PyTorch |
| xxHash3 (CPU) | 38.2 GB/s | 64 MB buffer, single thread |
| bits per chunk | |||||||
| tokens rm. | traj. intact | RSC | |||||
| 14.61 | 14.59 | 14.67 | 18.47% | 100.0% | 75.83% | ||
| 14.55 | 14.56 | 14.65 | 18.89% | 100.0% | 75.83% | ||
| 14.40 | 14.50 | 14.61 | 19.64% | 100.0% | 75.83% | ||
| 14.14 | 14.45 | 14.58 | 20.45% | 100.0% | 75.83% | ||
| 13.80 | 14.40 | 14.55 | 21.53% | 100.0% | 75.83% | ||
| queries with bounded-invariant top- | |||||||
| relation | parameter | bound on | |||||
| relaxed, | 0.0554 | 15.62% | 0.59% | 0.13% | 0.00% | 0.00% | |
| 0.1663 | 0.26% | 0.00% | 0.00% | 0.00% | 0.00% | ||
| 0.5543 | 0.00% | 0.00% | 0.00% | 0.00% | 0.00% | ||
| 1.6628 | 0.00% | 0.00% | 0.00% | 0.00% | 0.00% | ||
| tight, | 0.1000 | 3.71% | 0.00% | 0.00% | 0.00% | 0.00% | |
| median | p90 | p99 | max | |
|---|---|---|---|---|
| 0.0185 | 0.0702 | 0.1296 | 0.2358 | |
| 0.0056 | 0.0201 | 0.0483 | 0.0886 | |
| 0.0036 | 0.0133 | 0.0299 | 0.0698 | |
| 0.0018 | 0.0067 | 0.0148 | 0.0247 | |
| 0.0010 | 0.0034 | 0.0075 | 0.0147 |
| recall of true pairs | ||||||||
|---|---|---|---|---|---|---|---|---|
| 0.974 | 1.000 | 1.000 | 1.000 | 1.000 | 1.000 | 1.000 | 1.000 | |
| 0.581 | 0.774 | 0.885 | 0.990 | 1.000 | 1.000 | 1.000 | 1.000 | |
| 0.400 | 0.506 | 0.590 | 0.743 | 0.879 | 0.986 | 1.000 | 1.000 | |
| 0.332 | 0.398 | 0.467 | 0.537 | 0.668 | 0.779 | 0.934 | 0.992 | |
| snapshot assumption | per-arrival (correct) | |
|---|---|---|
| update rule | every event | per arrival |
| steady state | none; only eviction bounds | |
| mean context, 32K budget | 2.8K | 28K |
| speedup of L1 over L0 alone | 1.22 | 1.07 growth, 1.00 hard budget |
Agent Memory Management
Agent memory management studies how AI agents store, update, retrieve, compress, and forget information across long-running tasks.
See all 449 papers