Abstract
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.
Keywords
Subject
Publication details
- Journal
- Not available
- Open access
- Green open access
Cite this article
APA 7
Jedidi, N., Ali, A. B., Li, H., & Lin, J. (2026). Effective Dense Retrieval using Only In-Context Examples. https://omanscience.com/en/articles/effective-dense-retrieval-using-only-in-context-examples
MLA 9
Jedidi, Nour, et al. "Effective Dense Retrieval using Only In-Context Examples." https://omanscience.com/en/articles/effective-dense-retrieval-using-only-in-context-examples.
Chicago (author–date)
Jedidi, Nour, Abdul Basit Ali, Hang Li, and Jimmy Lin. 2026. "Effective Dense Retrieval using Only In-Context Examples." https://omanscience.com/en/articles/effective-dense-retrieval-using-only-in-context-examples.
Harvard
Jedidi, N., Ali, A. B., Li, H. and Lin, J. (2026) 'Effective Dense Retrieval using Only In-Context Examples', Available at: https://omanscience.com/en/articles/effective-dense-retrieval-using-only-in-context-examples.
Vancouver
Jedidi N, Ali AB, Li H, Lin J. Effective Dense Retrieval using Only In-Context Examples. https://omanscience.com/en/articles/effective-dense-retrieval-using-only-in-context-examples
IEEE
N. Jedidi, A. B. Ali, H. Li, and J. Lin, "Effective Dense Retrieval using Only In-Context Examples," https://omanscience.com/en/articles/effective-dense-retrieval-using-only-in-context-examples.