Attention in Large Language Models Yields Efficient Zero-Shot Re-Rankers

Shijie Chen, Bernal Jim'enez Guti'errez, Yu Su
2/12/2026

No official code found. Best implementation: OSU-NLP-Group/In-Context-Reranking (44 stars, MIT, last commit 2025-03-31).

Abstract

Information retrieval (IR) systems have played a vital role in modern digital life and have cemented their continued usefulness in this new era of generative AI via retrieval-augmented generation. With strong language processing capabilities and remarkable versatility, large language models (LLMs) have become popular choices for zero-shot re-ranking in IR systems. So far, LLM-based re-ranking methods rely on strong generative capabilities, which restricts their use to either specialized or powerful proprietary models. Given these restrictions, we ask: is autoregressive generation necessary and optimal for LLMs to perform re-ranking? We hypothesize that there are abundant signals relevant to re-ranking within LLMs that might not be used to their full potential via generation. To more directly leverage such signals, we propose in-context re-ranking (ICR), a novel method that leverages the change in attention pattern caused by the search query for accurate and efficient re-ranking. To mitigate the intrinsic biases in LLMs, we propose a calibration method using a content-free query. Due to the absence of generation, ICR only requires two ($O(1)$) forward passes to re-rank $N$ documents, making it substantially more efficient than generative re-ranking methods that require at least $O(N)$ forward passes. Our novel design also enables ICR to be applied to any LLM without specialized training while guaranteeing a well-formed ranking. Extensive experiments with two popular open-weight LLMs on standard single-hop and multi-hop information retrieval benchmarks show that ICR outperforms RankGPT while cutting the latency by more than 60% in practice. Through detailed analyses, we show that ICR's performance is specially strong on tasks that require more complex re-ranking signals. Our findings call for further exploration on novel ways of utilizing open-weight LLMs beyond text generation.

View on arXivView PDF

Code Implementations(1)

MIT

[ICLR'25] "Attention in Large Language Models Yields Efficient Zero-Shot Re-Rankers"

442Shell, PythonOct 2, 20241 years agoMIT

Similar Papers

Cite this paper

@article{chen2026attention,
  title  = {Attention in Large Language Models Yields Efficient Zero-Shot Re-Rankers},
  author = {Shijie Chen and Bernal Jim'enez Guti'errez and Yu Su},
  year   = {2026},
  eprint = {2410.02642},
  archivePrefix = {arXiv},
  url    = {https://arxiv.org/abs/2410.02642},
  journal = {ICLR 2024 2024}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2410.02642.svg)](https://codeofpaper.com/paper/2410.02642)

Discussion