← All notes

RAG is not retrieval

The 'retrieval' in RAG is often the least important part of the system.

Vector similarity search is a solved problem. You embed your documents, embed your query, find the nearest neighbours. There are a hundred libraries that do this well.

The actual hard problems:

  • Chunking strategy: how you split documents determines what you can retrieve. Most people use naive character splits. This is almost always wrong.
  • Grounding verification: how do you know the retrieved context is actually relevant to the question, and not just lexically similar?
  • When NOT to retrieve: sometimes the model knows the answer. Retrieval adds latency and can distract the model with irrelevant context. You need a routing layer.
  • Context window management: you have 128k tokens, but that doesn't mean you should use all of them.

Still thinking about this. More to come.

This note represents thinking in progress. I refine these notes as I test ideas against production systems.

← Back to Notes