Retrieval-augmented generation (RAG)
Retrieval-augmented generation (RAG) is an AI technique in which a system first retrieves relevant passages from a defined knowledge base, such as agronomic guides or regulations, and then has a language model generate an answer grounded in those passages, often with citations.
Also known as: RAG · grounded generation · retrieval-augmented AI
Why does it matter?
In agriculture and compliance, answers must fit a specific crop, region, season or legal text. A language model on its own can produce fluent but inaccurate advice. RAG grounds answers in a curated body of knowledge, such as extension manuals, good agricultural practices, certification standards or the EUDR, which can be updated without retraining the model. The approach was described in research by Lewis and colleagues (2020).
How does it work?
- Build the knowledge base: collect and review documents, split them into passages and index them.
- Retrieve: for each question, find the most relevant passages, often with semantic search.
- Generate: give the passages and the question to a language model, instructing it to answer from them.
- Cite and evaluate: show sources, test answers against expert-reviewed questions, and collect user feedback.
Common pitfalls
- A knowledge base that is outdated or not adapted to local conditions.
- Mixing sources of different reliability without ranking them.
- No evaluation set, so quality is unknown.
- Answers in a language or reading level farmers do not use.
Farmer1st’s AI agronomist uses grounded answers from reviewed agronomic knowledge to support farmers and the teams who work with them.
Frequently asked questions
Why use RAG rather than a general chatbot?
A general model answers from what it learned in training, which may be outdated, generic or wrong for a local context. RAG constrains answers to vetted, current sources, and makes it possible to show which source supports the answer.
Does RAG eliminate AI errors?
No. It reduces unsupported answers but depends on the quality and coverage of the knowledge base, the retrieval step and evaluation. Human review and feedback loops remain important.
Tell us about your supply chain.
Ten minutes with our scoping assistant. We come back with a first sketch of your service.