NEAR: Neighborhood-Aware Residuals for Memory Retrieval

Han Luo, Zhan Zhuang, Xu He, Jujia Zhao, Yu Li, Suqin Yuan, Dong Li, Lei FengarXiv 2026

TL;DR

NEAR (NEighborhood-Aware Residuals) is a training-free framework that boosts memory retrieval by focusing on the unique factual details that distinguish correct evidence from similar-looking "distractors." By subtracting a local "neighborhood reference" from embeddings, it creates residual representations that significantly improve retrieval accuracy and downstream question-answering performance across a wide range of models.

What Problem Does This Paper Address?

In long-term memory systems (like AI assistants managing years of chat history), standard embedding-based retrieval often struggles with "topic overlap." Imagine asking an assistant, "What advice did Tim give John about picking endorsements?" If the memory bank contains dozens of conversations about Tim, John, and various business deals, a standard vector search might rank many irrelevant "distractor" records highly just because they share the same entities and topics.

The authors argue that these distractors are actually a valuable source of information. Instead of letting them cause confusion, we can use them to define a "local neighborhood" for each memory. By identifying what is common to a neighborhood, we can better isolate the unique factual signal that makes a specific record the correct answer to a query.

Turning distractors into local references to distinguish evidence from similar-looking records.

Methods

NEAR introduces a training-free approach to construct residual representations that complement original embeddings. The process works in three main stages:

  1. Neighborhood-Based Memory Representations (Offline): For every record in the memory bank, NEAR identifies its $k$ nearest neighbors. It computes a "mean direction" (the local reference) for this neighborhood. The memory's representation is then updated by removing the component projected onto this reference direction, leaving behind a "residual" that highlights its unique features.
  2. Precomputed Query References: A challenge with residuals is that you don't know a query's neighbors until after you've retrieved them. NEAR solves this by precomputing a small "anchor table" using Spherical K-means on the memory bank. At query time, the query vector combines reference directions from its nearest anchors to form its own residual.
  3. Single-Index Retrieval: To keep retrieval efficient, NEAR concatenates the original embeddings with these residuals into a single, longer vector. This allows for a single Approximate Nearest Neighbor (ANN) search over a fixed index, meaning no complex multi-stage re-ranking is required.
Figure 2: Overview of NEAR. Memory neighborhoods yield local references, while a table supplies query references. Original and residual views form static keys for one ANN search.

Datasets

The authors evaluated NEAR on eight diverse long-context retrieval benchmarks:

  • Conversational Memory: LoCoMo, LongMemEval, and REALTALK.
  • Document Retrieval: ESG-Reports (financial), QASPER (scientific), PeerQA (scientific), CovidQA (biomedical), and MLDR (long documents).

These benchmarks cover a total of 5,873 queries and vary significantly in terms of document length and the number of "distractor" records.

Key Insights and Ideas

  • Distractors as a Signal, Not Just Noise: The core "aha moment" is realizing that the records causing the most confusion are the best ones to use as a reference frame. Subtracting the "average" of a local cluster effectively "de-biases" the search toward specific facts.
  • Locality is Crucial: The paper shows that using a local neighborhood reference is far superior to using a global mean. Retrieval gains depend on the specific correspondence between a memory and its immediate neighbors.
  • Training-Free Versatility: Because NEAR doesn't require training a new model or fine-tuning an encoder, it can be "plugged in" to almost any existing embedding model (the authors tested nine, including Qwen, Llama, and Gemma).
  • Residual Stacking: The method can be applied recursively (multiple layers of residuals), though the authors found that 1-2 layers usually provide the best balance.

Key Results

NEAR consistently outperformed standard "Base" retrieval and several strong baselines (like LC, InvGC, and DBSN) across all nine embedding models tested.

  • Retrieval Accuracy: On the Qwen-4B model, average Recall@10 jumped from 62.67 to 69.76, and NDCG@10 rose from 47.88 to 55.33.
  • Downstream QA: Better retrieval led to better answers. On the LoCoMo benchmark, NEAR improved question-answering accuracy by 9.6 percentage points when using Qwen-4B.
  • Cross-Model Gains: The improvements were universal, with models like KaLM-Embedding-Gemma3-12B and ModernBERT-Embed-Base also seeing significant boosts.
  • Efficiency: While NEAR doubles the storage requirements (due to vector concatenation), using 4-bit scalar quantization (SQ4) reduces the storage footprint by ~82% while maintaining nearly all the retrieval gains.

Limitations and Future Work

  • Storage and Latency Trade-off: Concatenating residuals increases the index size and query latency (roughly 2.4x slower than base retrieval in the authors' tests). While quantization helps, it remains a heavier solution than standard vector search.
  • Static Memory Banks: The current query-reference table is precomputed based on a fixed memory bank. The authors note that extending NEAR to frequently updated or streaming memory banks is an important direction for future work.
  • Reference Representation: Exploring even more compact ways to represent neighborhood references could further reduce the storage overhead.

Summary updated

BibTeX
@misc{luo2026near,
  author = {Han Luo and Zhan Zhuang and Xu He and Jujia Zhao and Yu Li and Suqin Yuan and Dong Li and Lei Feng},
  title = {{NEAR: Neighborhood-Aware Residuals for Memory Retrieval}},
  year = {2026},
  eprint = {2610.13314},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2610.13314},
}
Figure