passdrill
AI & LLM Engineering · RAG & Embeddings · Card 025/032 easy

A team indexes a knowledge base by embedding small, single-idea chunks (roughly one or two sentences each) so that similarity search can pinpoint the exact passage that answers a narrow question. But when they inspected the passages actually sent to the LLM, they found these tiny chunks often lacked enough surrounding context for the model to interpret them correctly on their own. Rather than switching to embedding larger chunks (which would blur the precision of the similarity search), what technique keeps the small chunks for search while fixing the context problem?

  1. Re-embed every chunk twice, once at the small size and once at a larger size, and always return whichever of the two embeddings scores higher for the query, discarding the other
  2. Increase the number of small chunks retrieved to the maximum the context window allows, without changing which chunks are retrieved or how much surrounding text accompanies each one
  3. Fine-tune the embedding model specifically on the small chunks so each one independently encodes more surrounding context inside its own vector
  4. Keep the small chunks as the unit that gets embedded and searched over, but once a small chunk is retrieved, expand it by pulling in its neighboring text, up to the surrounding paragraph, page, or even the whole source document, and pass that expanded window to the LLM instead of the bare small chunk
Next card → Shuffle