Find answers from the community

Updated 2 months ago

are there any best practices on formatting text to optimise retrieval

are there any best practices on formatting text to optimise retrieval
k
3 comments
Please stand by @thomoliverz as I search the knowledge base. I normally take about 20 seconds or so. :wave:
----------------------
Yes, there are several best practices and techniques to optimize retrieval in LlamaIndex. Here are some of them:

  1. Decoupling Chunks Used for Retrieval vs. Chunks Used for Synthesis: This technique involves separating the chunks of data used for retrieval from those used for synthesis. The optimal chunk representation for retrieval might be different than the optimal consideration used for synthesis. There are two main ways to take advantage of this idea:
    • Embed a document summary, which links to chunks associated with the document. This can help retrieve relevant documents at a high-level before retrieving chunks vs. retrieving chunks directly (that might be in irrelevant documents).
    • Embed a sentence, which then links to a window around the sentence. This allows for finer-grained retrieval of relevant context, but also ensures enough context for LLM synthesis. Source ()
  1. Optimize Context Embeddings: You can try finetuning the embedding model over an unstructured text corpus, in a label-free way. Source ()
  1. Dynamically Retrieve Chunks Depending on your Task: RAG isn’t just about question-answering about specific facts, which top-k similarity is optimized for. There can be a broad range of queries that a user might ask. All of these use cases may require different retrieval techniques. Source ()
  1. Structured Retrieval for Larger Document Sets: This involves using structured information to help with more precise retrieval. There are a few ways of performing more structured tagging/retrieval for production-quality RAG systems, each with their own pros/cons. Source ()
  1. Advanced Retrieval Strategies: There are a variety of more advanced retrieval strategies you may wish to try, each with different benefits. These include Reranking, Recursive retrieval, Embedded tables, Small-to-big retrieval, and more. Source ()
Remember, the end goal is to optimize your retrieval and generation performance to answer more queries over more complex datasets accurately and without hallucinations.
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------
Add a reply
Sign up and join the conversation on Discord