RAG achieves its cost efficiency by retrieving only relevant document chunks (typically a few thousand tokens) before sending them to the LLM, avoiding the need to process entire large context windows (hundreds of thousands of tokens) on every single query.