r/learnmachinelearning • u/DueBid3298 • 29d ago
Discussion LLM Context Windows vs. RAG: How Does Self-Attention Handle Irrelevant Information?
/r/LocalLLM/comments/1xhd78l/llm_context_windows_vs_rag_how_does_selfattention/
4
Upvotes
1
u/CelebrityChess 29d ago
it doesn't really ignore irrelevant stuff in any hard way. attention is just a softmax over similarity scores, so irrelevant tokens get small weights but never exactly zero, and with a long context those small weights add up and dilute the useful signal. that's part of why models get worse at finding a fact buried in the middle of a long prompt. the model also learns during training which tokens to attend to, so a lot of it is learned, not built in. rag helps because you filter before the model sees anything, so the context is mostly relevant to begin with.