Query-focused and Memory-aware Reranker for Long Context Processing

Yuqing Li, Jiangnan Li, Mo Yu, Guoxuan Ding, Yanyu Chen, Zheng Lin, Wei Zhang, Jie ZhouarXiv 2026

TL;DR

QRRanker is a lightweight, listwise reranking framework that extracts continuous document relevance scores directly from the internal attention matrices of an LLM's "Query-focused Retrieval" heads. By bypassing text generation entirely, it eliminates formatting errors and high inference costs while outperforming much larger 32B models on long-context retrieval benchmarks.

What Problem Does This Paper Address?

Retrieval-Augmented Generation (RAG) and AI agents rely heavily on embedding models to navigate massive text corpora. However, standard embeddings suffer from a "geometric bottleneck"—compressing complex query-document interactions into fixed-dimensional vectors inherently loses fine-grained information.

To fix this, researchers deploy Large Language Model (LLM) rerankers on a shortlisted set of documents. Current LLM rerankers fall into two flawed categories:

  1. Pointwise rerankers score documents independently, losing the global context of the candidate list.
  2. Listwise rerankers look at the whole list but rely on text generation (e.g., prompting the model to output a 1-to-5 Likert scale score). This approach suffers from unstable output formats, high computational overhead, and coarse-grained scoring.

This paper introduces an alternative that captures global listwise context without the baggage of text generation.

Methods

The authors present QRRanker, a listwise reranking method that processes all candidate documents in a single inference pass and derives scores purely from internal attention patterns.

  1. QR-Head Selection: Prior studies show that certain self-attention heads in LLMs naturally act as internal retrievers, focusing heavily on relevant context spans during query encoding. The authors compute a "Query-focused Retrieval" (QR) score on a small seed set to identify and select the top 16 heads.
  2. Attention-based Scoring: Instead of generating tokens, QRRanker prefills the prompt containing the query and candidate documents. It then aggregates the query-to-document attention weights across the 16 selected QR-heads to compute a continuous relevance score.
Figure 1: The retrieval score and QR score are computed based on the attention score of a (QR) attention head. In this figure, Doc2 is the gold document (chunk).
  1. Contrastive Training: The model is fine-tuned using a group-level contrastive loss optimized with a max-min normalization technique to stabilize the score ranges.
  2. Memory Augmentation: For long narratives or dialogues, QRRanker can optionally prepend global summaries (block-based for stories, event-centric for dialogues) as a prefix, allowing the model to balance coarse-grained context with fine-grained evidence.
Figure 2: The structure of QRRanker is illustrated in the middle, where the highlighted heads are QR heads for document scoring. As QRRanker can be aware of memory enhancement to capture more contextual information, we can construct memories for narratives and dialogues, which is shown on the left. The right part demonstrates the rank-rerank pipeline of qa for narratives/wiki/dialogues, which involves no sophisticated design.
  1. Layer Truncation: Because retrieval behavior stabilizes in the middle layers of the LLM, the authors introduce a truncated variant (QRRanker-middle) that cuts off the top layers of the network during inference to dramatically reduce latency.

Datasets

The framework was trained and evaluated across several diverse benchmarks:

  • Wikipedia Multi-hop QA: HotpotQA and MuSiQue (fact-based, localized retrieval).
  • Long-context Story QA: NarrativeQA (documents up to 518k tokens) and DetectiveQA (bilingual detective stories exceeding 100k tokens).
  • Long-term Dialogue Memory: LoCoMo (50 multi-session dialogues averaging 9,000 tokens).
  • Reasoning-intensive Retrieval: BRIGHT (used for out-of-domain evaluation).

Key Insights and Ideas

  • Bypassing Generation is a Win-Win: Extracting scores directly from attention weights yields fine-grained, continuous relevance metrics while completely eliminating generation-format errors and reducing inference latency.
  • The Middle Layers Suffice: Retrieval capabilities are fully activated in the middle-to-high layers of LLMs. Truncating the model after layer 24 (out of 36) yields comparable performance with a massive drop in compute and memory requirements.
  • Context Benefits are Domain-Specific: Prepending global summaries significantly boosts retrieval accuracy for long, complex narratives (like novels or multi-session dialogues) where tracking context is critical. However, it offers no benefit—or even degrades performance—for highly localized fact retrieval like Wikipedia.

Key Results

  • State-of-the-Art Reranking: Despite using a small 4B parameter backbone (Qwen3-4B-Instruct), QRRanker achieved an overall average Recall@3 of 56.64% across Wikipedia and Story QA datasets, outperforming out-of-the-box Qwen-Reranker-4B (47.91%) and even 32B models like ReasonRank (53.70%).
Retrieval and Rerank performance measured by Recall@{k} across multiple datasets
  • LoCoMo Champion: On the dialogue memory benchmark, QRRanker achieved a new state-of-the-art Overall F1 score of 57.03 (using GPT-4o-mini as a generator), beating complex graph- and tree-based memory systems while using a highly compact token budget.
  • Efficiency Gains: The truncated QRRanker (middle) reduced P50 latency from 1221.59 ms (standard Qwen3-Reranker batch=50) to 910.42 ms, while slashing peak GPU memory usage from 13.88 GB to 8.71 GB.

Limitations and Future Work

  • Scale Constraints: The framework was only validated on smaller backbones (3B and 4B parameters). Its behavior on larger scales (e.g., 14B+) remains unexplored, where more attention heads could offer a richer pool of retrieval-sensitive candidates.
  • Weak Supervision: Due to a lack of human-annotated gold evidence in long narrative datasets, part of the training relies on automatically constructed "silver" evidence, which could introduce label noise.
  • Agent Integration: The authors suggest that instead of replacing iterative retrieval agents (which are highly accurate but slow and expensive), QRRanker can serve as an efficient local search enhancer for fine-grained evidence mining.

Summary updated

BibTeX
@misc{li2026query,
  author = {Yuqing Li and Jiangnan Li and Mo Yu and Guoxuan Ding and Yanyu Chen and Zheng Lin and Wei Zhang and Jie Zhou},
  title = {{Query-focused and Memory-aware Reranker for Long Context Processing}},
  year = {2026},
  eprint = {2602.12192},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2602.12192},
}
Figure