Retrieval & reasoning
Which document should the AI believe?
Three documents name three payment deadlines. Open the project file and find out what it takes to answer one simple question.
Try the experimentIt’s Friday and a subcontractor wants to know when invoice 41 is due. The project manager remembers thirty days. An email mentions fifteen. Somewhere in the job folder there’s a signed amendment. All three sound plausible in a chat window. Only one sets the terms for this invoice.
Build the evidence packet
Choose which records reach the assistant in this fictional case. Compare the answer it can support with the one you would send.
“How long do we have to pay invoice 41?”
30 days under the original terms.
Agreement §4 supports a provisional answer. Check for a later signed amendment before promising a date.
This worked example uses fixed rules so you can reproduce each answer.
Where an answer comes from
A language model can learn the shape of a contract during training. It cannot know about a change order that two people signed this morning unless the new information reaches it. Retrieval-augmented generation, usually called RAG, gives the model a reading packet when a question arrives. You can update the packet without retraining the model.
A typical system breaks documents into passages, attaches details such as job number and date, and builds an index. When someone asks a question, a search step finds candidate passages. A second pass may reorder them. The model receives a small selection and writes an answer. If the amendment disappears at search time, even an excellent writer is working from an incomplete file.
How the wrong answer earns a citation
Search for “payment due” and the old agreement might win. The amendment calls the same thing “remittance terms.” A search based on meaning can bridge those words. Exact matching still matters for a string like INV-41, where a single digit changes the case. Combining the two searches gives a reviewer better candidates, but neither search knows which signature carries authority.
Say the assistant answers “thirty days” and links to paragraph four. That passage genuinely supports thirty days under the original terms. It cannot establish that those terms still govern. A useful citation points to the operative sentence, identifies the version, and lets the reader inspect the condition. Separate the question “Does this passage say that?” from “Does this passage apply here?”
Sending the whole binder introduces another failure mode. In controlled experiments, Liu and colleagues found that some models performed worse when the relevant information sat in the middle of a long input. A larger input window makes room for the amendment. It gives no guarantee the model will use it.
What comes after one search
A better follow-up to this question is a search for amendments to the named agreement. If one appears, check its effective date, signatures and scope. A system can do that as a fixed second search, or let a model decide when another search is worthwhile. Self-RAG is one research example that learns when to retrieve and how to critique the result.
Another question needs another tool. “Has invoice 41 been paid?” belongs in the authorized payment ledger. A contract explains when payment is due. It cannot tell you that money moved yesterday. A useful assistant can ask for the missing record, check a structured system with the reader’s permissions, or tell the reader exactly what remains unknown.
Test the part that failed
Keep a small set of real questions with known answers and the passages that justify them. First check how often a governing document reaches the packet. Then give the writer the correct packet and see how often each claim follows. Those two scores send an engineer to different places when something breaks.
Include a superseded agreement, a document from a different customer, and a question nobody has answered yet. Apply access controls before passing passages to the model. Count a justified request for missing evidence as a success. For an accounts team, “I need the signed amendment” is a cheaper mistake to investigate than a confident payment commitment.
Sources
- Lewis et al. · NeurIPS 2020Retrieval-Augmented Generation for Knowledge-Intensive NLP Tasks ↗
- Liu et al.Lost in the Middle ↗
- Gao et al. · ALCEEnabling Large Language Models to Generate Text with Citations ↗
- Asai et al. · Self-RAGLearning to retrieve, generate and critique ↗