8 Advanced indexing
This chapter covers
- Advanced RAG techniques for more effective retrieval
- Selecting the optimal chunk splitting strategy for your use case
- Using multiple embeddings to enhance coarse chunk retrieval
- Expanding granular chunks to add context during retrieval
- Indexing strategies for semi-structured and multi-modal content
In Chapter 7, you explored the fundamentals of the RAG (Retrieval-Augmented Generation) architecture—a core pattern for building LLM-powered applications. To keep things simple, we worked with a stripped-down version. That minimal setup is useful for learning, but in practice it often leads to disappointing results: inaccurate answers, overlooked data, or weak use of context, even when the vector store contains exactly what you need. These issues usually stem from vague queries, suboptimal indexing, or failing to leverage metadata effectively.
This chapter focuses on how to overcome those challenges. Building robust LLM applications with LangChain is less about wiring components together and more about refining the design—iterating on retrieval strategies, experimenting with prompts, and applying advanced RAG techniques. True proficiency comes from mastering these refinements.
We’ll begin with advanced indexing strategies, such as creating multiple embeddings for larger text chunks in the vector database. This approach improves retrieval precision and ensures richer, more accurate context for response generation.