← Back to Glossary

RAG (Retrieval-Augmented Generation)

RAG (Retrieval-Augmented Generation) enhances large language models by first retrieving relevant information from a knowledge base—such as your PDF documents—and then using that context to generate answers. Instead of relying only on the model's training data, RAG grounds responses in your actual documents, reducing hallucinations and improving accuracy.

Leafra uses RAG to power its PDF chat: when you ask a question, the system finds the most relevant passages from your uploaded PDFs and feeds them to the AI, so answers are based on your content.