AI for AWS Documentation
RAG is very difficult to do right. I am experimenting with various RAG projects from [1]. The main problems are:- Chunking can interfer with context boundaries- Content vectors can differ vastly from question vectors, for this you have to use hypothetical embeddings (they generate artificial questions and store them)- Instead of saving just one embedding per text-chuck you should store various (text chunk, hypothetical embedding questions, meta data)- RAG will miserably fail with requests like "summarize the whole document"- to my knowledge, openAI embeddings aren't performing well, use a embedding that is optimized for question answering or information retrieval and supports multi language. SOTA textual embedding models can be found on the MTEB Leaderboard [2]. Also look into instructorEmbeddings- the LLM used for the Q&A using your context should be fine-tuned for this task. There are several open (source?) LLMs based on openllama and others, that are fine tuned for information retrieval. They hallucinate less and are sticking to the context given.1 https://github.com/underlines/awesome-marketing-datascience/...2 https://github.com/embeddings-benchmark/mteb