Effective Dense Retrieval using Only In-Context Examples
RICE turns decoder-only LLMs into training-free dense retrievers by conditioning embeddings on shared in-context examples.
The paper introduces RICE (Representations from In-Context Examples), a training-free way to turn decoder-only LLMs into dense retrievers. RICE prompts the model with examples that give queries and documents a shared encoding context, then extracts embeddings from the LLM. The authors report substantial accuracy gains over ordinary prompt-based LLM embeddings and release code.
- RICE extracts dense embeddings from decoder-only LLMs using only in-context examples.
- A shared example context conditions both query and document encoding.
- The method needs no retriever training, and the authors release code.
Full article118 words · extracted from arxiv.org · click to collapse
Turning decoder-only large language models (LLMs) into strong dense retrievers typically requires some form of retriever training. In this paper, we ask whether LLMs can instead be prompted to produce effective representations for dense retrieval given only a few in-context examples. To answer this, we introduce RICE (Representations from In-Context Examples), a simple "training-free" approach that extracts high-quality dense representations from LLMs. To do so, RICE conditions the LLM on examples that provide a shared context for query and document encoding. Our results demonstrate that RICE embeddings can substantially improve the accuracy of prompt-based LLM embeddings, establishing it as a simple method to build LLM-based dense retrievers that do not require training. We release our code at https://github.com/nourj98/RICE.
Text extracted automatically; images, tables and formatting may be missing. Original: https://arxiv.org/abs/2609.38099