passdrill
AI & LLM Engineering · RAG & Embeddings · Card 029/032 medium

A RAG pipeline retrieves passages once, before generation begins, and then generates the entire answer from that single retrieved set. For a long, multi-part answer, the passages relevant to the answer's later sentences may be completely different from what was relevant to its first sentence, but the pipeline never retrieves again after that first pass. FLARE (Jiang et al., 2023) is designed to address this. How does it decide when to trigger a new retrieval step during generation?

  1. It retrieves again after every single generated token, regardless of how confident the model is in that token, to guarantee the freshest possible context throughout generation
  2. It waits until generation is completely finished, then retrieves once more to double check the finished answer, replacing the answer entirely if the second retrieval turns up different passages
  3. It asks a human reviewer to manually flag which sentences need additional retrieval before generation is allowed to continue past that point
  4. It uses its own prediction of the upcoming sentence to anticipate what that sentence will need, and if that anticipated sentence contains low-confidence tokens, it uses the anticipated content as a query to retrieve relevant documents and regenerates the sentence with that retrieved context, repeating this check throughout generation rather than retrieving only once upfront
Next card → Shuffle