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 L at 10 neighbors and the global fidelity G at 30 to 50 percent of the memory. At 96 bytes per passage, rescored binary codes reach an L of 0.97 yet move 10.1 percent of passages to another theme; PCA with 8-bit codes, at an L of 0.77, moves 1.7 percent. Rescoring leaves the stored codes, and thus G, unchanged. We prove that across the G band, 1−ν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 G in 0 of 52 held-out runs; the far hinge raises it in all 52. LAQ raises G in all 52 (p=8.5×10−4 over 13 memory-encoder groups), including the external FinDER memory, has the highest G of seven equal-size quantizers in all 12 Multi-Doc-2025 runs, scales to a million passages, and keeps evidence recall.
Figures & tables
Fig. 1: At the same bytes and search, locality-aware quantization (LAQ) keeps the near end of an optimized product quantizer (OPQ) and moves fewer passages to another theme. L : local fidelity (chance-corrected recall@10); G : global fidelity (the profile averaged over 30 to 50 percent of the memory). (a) Multi-Doc-2025 [ 11 ] , BGE-large [ 12 ] : 2,688 held-out passages of 22 companies, each joined to its 10 nearest neighbors and colored by theme (t-SNE layout [ 13 ] ); companies form islands, and banks share themes. (b, c) At 128 bytes, both keep L at 0.85; OPQ moves 8.3 percent of the passages to another theme (red) and LAQ 3.5 percent, on the split where OPQ has its lowest theme agreement; over 16 runs the mean falls from 2.8 to 2.1 percent. (d, e) Locality profiles (Definition 1 ) of five compressions of FinQA [ 14 ] and LoCoMo [ 15 ] : compressions of equal size agree near k=10 and part by up to 0.30 in the G band (gray). (f) Every lost–gained neighbor pair is a violated cross pair, which bounds the profile (Theorem 1 ). (g) LAQ in four steps; gray: cost of each step (Section IV ). (h) LAQ minus OPQ on all 52 held-out runs: G rises in all 52 and L in 46.
Memory
Items
Questions
Structure used
FinQA
8,356
863
company, sector, fiscal year
Multi-Doc-2025
10,024
898
company, sector, fiscal year
LoCoMo
5,882
1,536
conversation, session
20 Newsgroups
10,000
–
topic, topic family
AG News
10,000
–
topic
TABLE I: Five memories with company, session, or topic structure, three with annotated questions.
Fig. 2: At the same bytes, a compression that keeps more nearest neighbors can displace more of the overall memory, because retrieval follows L whereas themes and deletion follow G (local and global fidelity). (a) 27 compressions of FinQA (BGE-base) alongside four nonlinear maps (rings: Isomap [ 56 ] , NPCA [ 57 ] , PHATE [ 55 ] , t-SNE); triangle: PCA to 16 dimensions. Rescored binary codes lie 0.32 below the diagonal G=L , while t-SNE, PHATE, and UMAP keep G at 0.22 or less. (b, c) Two 96-byte compressions plotted on the uncompressed memory layout; colored points mark passages moved to another theme: 1.7 percent for PCA with 8-bit codes versus 10.1 percent for rescored binary codes. (d, e) Across every compression and run, retrieval follows L (median Spearman ρ 0.99; partial 0.97 given G ), whereas themes and deletion follow G ( ρ 0.95; partial 0.79 given L ). (f, g) Rescoring the 40 nearest binary codes raises L and top-10 agreement while leaving G , themes, and deletion unchanged at the binary values (black ticks). All runs: Appendix C .
Fig. 3: At the same bytes, OPQ keeps the far end best, and LAQ raises it further on every held-out memory by lowering rank violations ( L , G : local and global fidelity). (a, b) Seven compressions at d/8 bytes on FinQA and LoCoMo with the retrieval-tuned encoders: OPQ has the highest G (0.82 to 0.91), whereas rescoring (arrows to open markers) raises L and top-10 agreement but leaves G and the far-end operations unchanged. (c–f) Held-out Multi-Doc-2025 across four splits: LAQ lies above OPQ at every scale, most notably in the G band (gray) and with Titan V2; the bound of Theorem 1 holds at all 160 points, with 1−νk at 0.49 to 0.60 of it; and LAQ lowers the violation rate at k≈0.4n by 12 to 18 percent on average (10 to 20 percent per run). (g) Change in each operation across all 40 held-out runs; right: runs in which LAQ is higher. (h) LAQ (black) has the highest G among seven quantizers in each of nine runs with the retrieval-tuned encoders. (i) The lowest theme agreement rises from 0.80 to 0.89.
Memory
higher
OPQ
LAQ
LAQ − OPQ
FinQA
G
12/12
.800
.808
+.005 to +.010
L
10/12
.861
.864
−.002 to +.008
LoCoMo
G
12/12
.845
.853
+.005 to +.012
L
8/12
.820
.822
−.002 to +.009
Multi-Doc-2025
G
12/12
.830
.842
+.007 to +.017
L
12/12
.823
.828
+.0003 to +.010
TABLE II: LAQ raises G over its OPQ start in every held-out run. d/8 bytes; runs in which LAQ is higher, means over runs, and the range of the change. Retrieval-tuned encoders (BGE-base, E5-base, BGE-large), four splits each.
Fig. 4: The far hinge carries the gain in G , and LAQ is better than OPQ and the other quantizers in paired tests. (a) Change in G from the OPQ start for each training objective on all 52 held-out runs; bars are means. (b) LAQ against reconstruction with Lfar alone, run by run. (c) Mean change in νk by scale with the retrieval-tuned encoders; shading, interquartile range; gray, the G band. (d) Reduction of the violation rate pˉk at k≈0.4n relative to OPQ. (e) Change in L against change in G ; large markers are means. (f) One-sided Wilcoxon tests of LAQ against OPQ over runs, Holm-corrected, with the runs in which LAQ is higher; evidence recall@10 is tested two-sided. (g) G of LAQ minus that of each quantizer on Multi-Doc-2025, 12 runs. (h) Paired company-bootstrap 95 percent intervals for G , LAQ minus OPQ.
BGE-base
E5-base
BGE-large
Titan V2
LAQ
.832 / .817
.830 / .807
.866 / .857
.696 / .800
OPQ
.820 / .814
.816 / .801
.857 / .852
.659 / .792
PQ
.754 / .743
.759 / .749
.769 / .771
.661 / .787
LSQ++
.759 / .725
.730 / .689
.764 / .744
.543 / .679
RQ
.693 / .582
.693 / .552
.697 / .598
.429 / .511
PCA + int8
.729 / .631
.710 / .584
.768 / .695
.521 / .578
TABLE III: LAQ has the highest G with every encoder. G / L on held-out Multi-Doc-2025 at d/8 bytes, means over the first three splits. RaBitQ uses 104 and 136 bytes. ScaNN is fitted on the held-out memory and searched with full-precision queries; we report its L .
Appendix figures & tables15 assets
Supplementary material from the paper’s appendix.
Appendix
Fig. 5: Compressions of one memory spread off a single curve, and rescored binary codes lie furthest below the diagonal, by 0.21 to 0.41. L and G of 27 compressions of the two agent memories, three retrieval-tuned encoders; Figure 6 gives the other three. Dashed line: G=L ; shaded: less of the far end kept than of the near end.
Fig. 6: With encoders of other kinds, PCA and product quantization lie on or above the diagonal, and one-bit codes of GloVe and RoBERTa keep more of the far end than of the near end. L and G of 27 compressions of the two agent memories; dashed line: G=L .
Fig. 7: Retrieval follows L ( ρ 0.99, against 0.89 with G ), and the far-end operations follow G ( ρ 0.95, against 0.87 with L ). Agreement with the uncompressed memory, every compression and run. (a, b) Retrieval on the two agent memories. (c, d) Consolidation into themes for FinQA, deletion for LoCoMo and the topic corpora. ρ : median over runs of the Spearman correlation across the 27 compressions of a run.
Fig. 8: Each operation follows the end at which it compares items: retrieval lies in the L region, consolidation and deletion in the G region. Partial rank correlation with G given L against that with L given G , across the 27 compressions of each run. (a) Agent memories, (b) topic corpora; color: operation; shape: encoder. (c) Medians and ranges over the six runs of the retrieval-tuned encoders.
Fig. 9: Rescoring raises L and retrieval and leaves G and the far-end operations at the values of the binary codes. (a, b) Binary codes before and after full-precision rescoring of the 40 nearest codes; arrows run from binary to rescored, and a marker without an arrow is unchanged. (c) Evidence recall@10 on FinQA rises with L ; dotted lines: uncompressed memories. (d) The share of right-company passages from another fiscal year stays near its uncompressed level.
Fig. 10: On the topic corpora, PCA and product quantization lie on or above the diagonal (a–f). On FinQA, rescored binary codes keep neighbors yet move up to 39 percent of a company’s passages to another theme (g). (a–f) L and G of 27 compressions, three encoders of other kinds; dotted line: G=L . (g) The two 96-byte compressions of FinQA (BGE-base) by company; diamonds: means; dotted line: 20 percent moved.
Fig. 11: At d/8 bytes, OPQ keeps the highest G of seven compressions, and rescored binary codes keep a high L with a lower G . Fidelity and agreement with the uncompressed memory, retrieval-tuned encoders; (a–c) FinQA, (d–f) LoCoMo.
Fig. 12: The normal model of Proposition 4 holds in the G band and predicts its violations and its loss of profile. All 52 held-out runs; open markers, OPQ start; filled, LAQ. (a) Median error of each anchor’s standardized distance quantile against the normal quantile, in standard deviations, at the near end and in the G band. (b) The full integral ( 8 ) against the measured violation rate at k=0.4n . (c) The leading term at k=10 against the measured rate. (d) Measured 1−νk at k=0.4n against the mean relative distance noise ω ; solid line, Corollary 2 ; dashed line, its leading term 0.64ω (Appendix A ).
Memory
Map
Bytes
L
G
Retrieval
Themes / deletion
FinQA
UMAP, 16 dims
64
0.523
0.10
0.24
0.08
PCA to 50, UMAP to 16
64
0.474
0.18
0.16
0.21
PHATE, 16 dims
64
0.537
0.15
0.19
0.08
UMAP, 2 dims
8
0.453
0.07
0.18
0.07
PHATE, 2 dims
8
0.231
0.12
0.04
0.07
t-SNE, 2 dims
8
0.585
0.13
0.07
0.09
Appendix
TABLE IV: Neighborhood-embedding maps keep G at 0.22 or less, and nonnegative PCA keeps more of the far end than of the near end. Maps fitted to the memory (BGE-base), kept in full precision; PCA to 16 dimensions is the linear reference for NPCA. Queries are mapped by the fitted transform (UMAP [ 44 ] , PHATE [ 55 ] , Isomap [ 56 ] , NPCA [ 57 ] , PCA) or placed at the inverse-distance-weighted mean of the positions of their 10 nearest stored items (t-SNE [ 13 ] , SR-tSNE [ 54 ] ). Top-10 agreement: overlap of the top-10 lists. Last column: theme agreement (FinQA) or agreement of session deletion (LoCoMo).
Memory, encoder
Operation
End
L
G
L∣G
G∣L
FinQA, BGE-base
same top-10 retrieved
near
1.00
0.89
0.99
0.30
same themes (ARI)
far
0.80
0.90
0.04
0.68
same peer groups
far
0.87
0.83
0.53
0.26
information barrier
far
0.91
0.84
0.65
0.21
company map
far
0.91
0.86
0.64
0.26
sector map
far
0.86
0.84
0.45
0.35
Appendix
TABLE V: Retrieval follows L , and consolidation and deletion follow G . Spearman correlation across 27 compressions of each operation’s agreement with the uncompressed memory (label precision for the topic corpora) with L and with G , and the partial rank correlation with each end given the other ( L∣G : with L given G ; G∣L : with G given L ). Agent memories, FinQA.
Memory, encoder
Operation
End
L
G
L∣G
G∣L
LoCoMo, BGE-base
same top-10 retrieved
near
0.99
0.89
0.95
-0.16
same memories deleted
far
0.87
0.97
-0.11
0.86
session map
far
0.89
0.97
0.10
0.82
LoCoMo, E5-base
same top-10 retrieved
near
0.99
0.89
0.96
0.18
same memories deleted
far
0.87
0.90
0.36
0.55
session map
far
0.90
0.98
0.36
0.92
Appendix
TABLE VI: The same split holds on LoCoMo and the topic corpora. Continuation of Table V .
Memory
Encoder
Compression
L
G
Retrieval
Themes / deletion
FinQA
BGE-base (96 B)
PCA + int8
0.77
0.74
0.60
0.96
PCA + int8 + rescoring
0.99
0.74
0.91
0.96
PQ
0.82
0.73
0.68
0.88
PQ + rescoring
0.99
0.73
0.95
0.88
OPQ
0.88
0.83
0.78
0.93
OPQ + rescoring
1.00
0.83
0.99
0.93
Appendix
TABLE VII: Rescoring raises L and retrieval for every code family, and G and the far-end operations keep the values of the stored codes. Code families that keep Euclidean distances, d/8 bytes per item. The 40 nearest codes are rescored with the full-precision vectors; L and retrieval come from the rescored lists, G and consolidation or deletion from the stored codes. Top-10 agreement: overlap of the top-10 lists. Last column: theme agreement (FinQA) or agreement of session deletion (LoCoMo).
Compression
Bytes
L
G
Retrieval
Evidence
Themes
Peers
Barrier
Map
float16
1536
1.00
1.00
1.00
0.50
1.00
1.00
1.00
1.00
int8
768
0.98
0.97
0.97
0.50
0.99
0.99
0.98
1.00
int4
384
0.96
0.95
0.94
0.50
0.99
0.99
0.97
1.00
binary, 1 bit
96
0.74
0.65
0.57
0.44
0.79
0.80
0.87
0.97
binary, 2 bit
192
0.83
0.65
0.70
0.48
0.90
0.83
0.89
0.97
binary, 4 bit
384
0.86
0.72
0.76
0.49
0.94
0.85
0.90
0.97
Appendix
TABLE VIII: At equal bytes, compressions of the financial memory differ most in G and theme agreement. FinQA, BGE-base, 27 compressions: bytes per item, fidelity, and agreement with the uncompressed memory. Top-10 agreement: overlap of the top-10 lists for 863 questions. Evidence: evidence recall@10 (0.50 uncompressed). Themes: theme agreement over 11 themes. Peers: overlap of five-company peer groups. Barrier: Jaccard overlap of the memories removed to wall off a company. Map: rank correlation of distances among company centroids.
Memory
Encoder
Split
G OPQ
G LAQ
L OPQ
L LAQ
FinQA
BGE-base
2026
0.7927
0.8021
0.8537
0.8566
2027
0.7930
0.8020
0.8579
0.8570
2028
0.7885
0.7951
0.8534
0.8557
2029
0.7958
0.8035
0.8489
0.8514
E5-base
2026
0.7872
0.7959
0.8413
0.8458
2027
0.7858
0.7952
0.8463
0.8544
Appendix
TABLE IX: LAQ raises G over OPQ on every held-out memory. G and L of OPQ and LAQ, four splits.
Objective
G change
range
higher
L change
Lrec
.0000
.0000 to .0000
0/52
.0000
Lrec + near hinge
+.0058
.0000 to +.0124
50/52
+.0043
Lrec+Lfar
+.0127
+.0022 to +.0453
52/52
+.0030
LAQ, Eq. ( 10 )
+.0124
+.0047 to +.0379
52/52
+.0039
Appendix
TABLE X: The far hinge Lfar carries the gain in G . Change from the OPQ start over all 52 held-out runs, each objective trained with the same recipe and checkpoint rule; means, range of the change in G , and runs in which G is higher.