How Retrieved Context Shapes Internal Representations in RAG

Samuel Yeh, Sharon Li


Abstract
Retrieval-augmented generation (RAG) enhances large language models (LLMs) by conditioning generation on retrieved external documents, but the effect of retrieved context is often non-trivial. In realistic retrieval settings, the retrieved document set often contains a mixture of documents that vary in relevance and usefulness. While prior work has largely examined these phenomena through output behavior, little is known about how retrieved context shapes the internal representations that mediate information integration in RAG. In this work, we study RAG through the lens of latent representations. We systematically analyze how different types of retrieved documents affect the hidden states of LLMs, and how these internal representation shifts relate to downstream generation behavior. Across four question-answering datasets and three LLMs, we analyze internal representations under controlled single- and multi-document settings. Our results reveal how context relevancy and layer-wise processing influence internal representations, providing explanations of LLMs’ output behaviors and insights for RAG system design.
Anthology ID:
2026.findings-acl.758
Volume:
Findings of the Association for Computational Linguistics: ACL 2026
Month:
July
Year:
2026
Address:
San Diego, California, United States
Editors:
Maria Liakata, Viviane P. Moreira, Jiajun Zhang, David Jurgens
Venue:
Findings
SIG:
Publisher:
Association for Computational Linguistics
Note:
Pages:
15446–15468
Language:
URL:
https://aclanthology.org/2026.findings-acl.758/
DOI:
Bibkey:
Cite (ACL):
Samuel Yeh and Sharon Li. 2026. How Retrieved Context Shapes Internal Representations in RAG. In Findings of the Association for Computational Linguistics: ACL 2026, pages 15446–15468, San Diego, California, United States. Association for Computational Linguistics.
Cite (Informal):
How Retrieved Context Shapes Internal Representations in RAG (Yeh & Li, Findings 2026)
Copy Citation:
PDF:
https://aclanthology.org/2026.findings-acl.758.pdf
Checklist:
 2026.findings-acl.758.checklist.pdf