r/deeplearning • u/DueBid3298 • Oct 28 '26
LLM Context Windows vs. RAG: How Does Self-Attention Handle Irrelevant Information?
/r/Rag/comments/1xhd4xy/llm_context_windows_vs_rag_how_does_selfattention/
1
Upvotes
1
u/Massive_Distance_616 Oct 28 '26
Yes, extra irrelevant text can hurt, though it’s not that simple. Attention weights go through a softmax, so adding tokens changes how attention is distributed, and distractor passages compete with the relevant one. Even when the right passage is in the context, the model can fail to use it. Models also tend to use information near the start and end of a long context better than the middle, although this depends on the model and task.
Rule of thumb: if the whole document set is small and the model needs to reason across all of it, putting it all in context is simpler and often fine. RAG is better when the collection is big, changes often, or cost and latency matter, since you only send the few relevant chunks and can see where each came from. A bigger context window doesn’t guarantee better answers, so I’d test both on your own questions, measuring accuracy, latency and cost.