From the course: Hands-On AI: RAG using LlamaIndex

Unlock the full course today

Join today to access over 24,700 courses taught by industry experts.

Small to big retrieval

Small to big retrieval

- [Instructor] Ever felt like finding a needle in a haystack? That's what basic RAG pipelines can feel like when they embed and retrieve huge chunks of text. You end up using the same big chunks for synthesis. This isn't always ideal, because there's often a lot of filler text that muddles the important parts, which makes retrieval less effective. Now imagine instead of searching through the whole haystack, you can find the first few needles and then pull out only the relevant bits of straw around them. That's what small to big retrieval does. We start by fetching the smaller more focused chunks of text that directly answer your query. Then, we use those chunks to guide us to larger parent chunks, which provide a broader context that can be used for synthesis. That way, you get the best of both worlds. Precise retrieval and comprehensive context. Let's go ahead and get right into it with our code. This is stuff that you are hopefully familiar with by now. It's stuff that we've done…

Contents