A large language model processes and generates natural language from patterns learned during training. Because it generates text rather than checking facts, it can produce convincing but incorrect information, called hallucinations. section 14.0 section 14.6
Retrieval-augmented generation improves reliability by supplying relevant external information during generation. Documents are divided into chunks, embedded, stored in a vector database, retrieved for a query, and assembled into context for the model. section 14.1
Use language models with supporting controls when accuracy matters:
- Improve training data, add real-time fact-checking, or strengthen verification systems to reduce fabricated responses. section 14.0
- Use a vector database and vector search to retrieve semantically relevant source material before generation. section 14.1
- Use LangChain to connect the model with external data sources and tools, or deploy a RAG reference architecture through LangServe. section 14.6
Grounded chatbot response
A customer-support chatbot embeds a user query, compares it with stored document vectors, retrieves relevant information, and gives the language model that context for a more accurate answer. section 14.1
Figure 14.1 RAG paradigm step by step (Image © MongoDB 2024 CC BY-NC-SA 3.0)
Follow the step-by-step RAG diagram from document processing through vector retrieval and grounded response generation. section 14.1


































































