Manuscript Offprint

arXiv:2611.08341

Enhancing Local and Global Structure in Compressed AI Agent Memory

Henry Han

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

Henry Han

Abstract—AI agents store text as embedding vectors and compress them at scale. A compression is accepted when each item's nearest neighbors survive, but agents also consolidate, delete, and compare memories, tasks that depend on which items lie far apart. We evaluate both ends with two label-free fidelities from our prior work: the local fidelity LL at 10 neighbors and the global fidelity GG at 30 to 50 percent of the memory. At 96 bytes per passage, rescored binary codes reach an LL of 0.97 yet move 10.1 percent of passages to another theme; PCA with 8-bit codes, at an LL of 0.77, moves 1.7 percent. Rescoring leaves the stored codes, and thus GG, unchanged. We prove that across the GG band, 1−νk1 - \nu_k is at most 2 to 2.18 times the square root of the near-far rank-violation rate, and that this rate follows the distance noise of the compression (correlation 0.979). Our locality-aware quantization (LAQ) turns the bound into a hinge objective on the codebooks of an OPQ index, keeping its bytes, rotation, and search. To our knowledge, LAQ is the first quantizer whose objective comes from a proven bound on the far end. Reconstruction alone raises GG in 0 of 52 held-out runs; the far hinge raises it in all 52. LAQ raises GG in all 52 (p=8.5×10−4p = 8.5 \times 10^{-4} over 13 memory-encoder groups), including the external FinDER memory, has the highest GG of seven equal-size quantizers in all 12 Multi-Doc-2025 runs, scales to a million passages, and keeps evidence recall.

Index Terms—Vector quantization, embedding compression, agent memory, neighborhood preservation, rank correlation, product quantization, label-free evaluation.

1 INTRODUCTION

LANGUAGE-MODEL agents remember by embedding what they read, say, and do. When they need an item, they recall the nearest embeddings [1]. Managed agent memories extract records from conversations, retrieve them by semantic search, and consolidate them over time [2]. At millions of vectors, every byte per vector costs memory, latency, and money. The vectors are therefore compressed: by truncating Matryoshka embeddings [3], by projection, by scalar or binary codes, or by product quantization [4]. Cloud services offer each of these as a switch [5, 6].

How should an agent memory be compressed so that it keeps both what lies near and what lies far? Today, a compression is accepted by its nearest neighbors. Vendors report that binary embeddings retain 97 to 98.5 percent of retrieval accuracy [5] and evaluate quantized indexes by recall@100 [6]. At 96 bytes per passage on FinQA, rescored binary codes keep LL at 0.97 and top-10 agreement at 0.87, yet move 10.1 percent of passages to another theme (Section 6). Embedding compression studies report nDCG@10 [7] or benchmark task scores [8]. Yet an agent also acts on what lies far apart: it consolidates a year of filings into themes [9, 10], deletes every item of a client or a session on request, and maps how companies and sectors relate. Because these operations compare each item with the whole memory, they decide what a sector brief says and what a deletion removes. Keeping this far end is difficult for two reasons: a private agent memory has no labels to test it with, and quantizers are trained for reconstruction, nearest neighbors, or query relevance. Our idea is to measure the far end with the same

statistic that measures the near end, prove which pairwise order controls it, and train the codebooks on that order.

At the same bytes and search, our proposed locality-aware quantization (LAQ) keeps the nearest neighbors of a held-out financial memory while moving far fewer passages to another theme (Figure 1a–c). In such a memory, passages from a single company form islands: in the outer fifth of the map, all 10 nearest neighbors of each passage belong to its own company. Passages from different banks meet in shared themes. At 128 bytes per passage, an optimized product quantization (OPQ) index [16] keeps local fidelity LL at 0.85 but moves 224 of the 2,688 passages to another theme. LAQ keeps the bytes, the search, and LL at 0.85, while moving only 94 passages.

Measurement. One label-free profile reads both ends of a compressed memory. Following our earlier work [17], we evaluate the two ends of a chance-corrected locality profile [18]: the near end (local structure) and the far end (global structure). Local fidelity LL is chance-corrected recall@10. Global fidelity GG averages, over 30 to 50 percent of the memory, the agreement on which items lie in each item's nearer part. At its upper edge, the profile measures agreement on the near and far halves, which under a Gaussian copula equals Kendall's τ\tau of the distances. Both fidelities require only the vectors before and after compression, and GG is estimated from a subsample of 2,000 items, however large the memory.

Learning. We prove that rank violations among cross pairs control the profile at every scale. A cross pair consists of one near item and one far item relative to an anchor. Let νk\nu_k be the profile at scale kk and N=n−1N = n - 1 for a memory of nn items. Then 1−νk1 - \nu_k is at most N/k(N−k)N/\sqrt{k(N-k)} times the square root of the cross-pair violation rate. The leading factor

  • H. Han is with the Department of Computer Science, Baylor University, Waco, TX 76798, USA. E-mail: Henry_Han@baylor.edu

References (61)