What changes when the documents no longer fit?
Part 2 of 7: Start here
What should your application include when the documents a question needs no longer fit in one request? It has to choose which passages to include. If it leaves out the passage that settles the question, the model cannot use that passage to check which rule or exception applies.
This piece helps you see what each request contains, test the choice with your own questions, and check whether the passages it needs are present and current.
When you ask a chat assistant about a file you have uploaded, you have chosen which document the question concerns. That narrows the document set. It does not tell you whether the file's full text goes into the request or passages are selected from it, and that varies by assistant.
For questions about a large, shared collection, your application makes that choice by selecting text from the documents and including it in each request alongside the question.
Choose what each request contains
Retrieval is the process of selecting relevant documents or passages to include alongside the question in the model's request.
If the documents needed for a question fit together, your app can include their full text in the request.
Take a gym member who asks whether they can cancel their membership four days after joining. The gym's policy manual requires 30 days' notice. An amendment allows cancellation within seven days, effective immediately and with a full refund.
The gym keeps a large shared collection of policy manuals, earlier versions of the manuals and amendments, too large to include in full in one request.
The application builds a request containing the member's question and the passage with the manual's notice rule. The amendment is not in the request, so the model has no evidence of it. The answer can then say that cancellation takes effect after 30 days' notice and leave out the immediate cancellation and refund the amendment allows.
For the same member's question, the request needs passages containing both the notice rule and the amendment's exception, with enough surrounding wording to show that the exception applies. With those passages in the request, the model has what it needs to explain immediate cancellation and the refund.
The passages needed depend on the question. If the member instead asks what each amendment changes, the app needs passages from all the amendments.
Check which passages are missing
A passage cut from a document can lose the surrounding wording needed to interpret it, a problem Anthropic describes in its retrieval work. A selected passage can then reach the request without the wording that makes it apply.
As with a whole document, check whether the selected passages contain everything needed to answer the member's question.
One team reported on Hacker News that its retrieval setup over large knowledge bases showed strong recall in its own testing and much weaker results once real users asked questions. Recall is the share of needed information the setup finds. The missing documents and recall collection gathers more reports like it.
Run your checks on questions users have asked as well as on the ones you wrote yourself.
Keep the selected passages current
The selected passages can also become outdated. The stale answers after updates collection gathers reports of outdated or deleted documents still being retrieved.
After you update or delete a document, test the change. For example, replace the cancellation amendment in the gym's collection with a new version that changes the cancellation window, then ask the same question again.
Inspect whether the request contains passages from the current version and whether the answer uses them. If a document is deleted, check that its passages stop appearing in later requests.
Check the passages behind each answer
Keep a set of test questions, including ones users have asked. Record the passages that answer each question and the documents those passages came from. For the gym member's cancellation question, record the passages containing the notice rule and the applicable exception.
For each question, inspect the passages the app actually included in the model's request. There are two different findings.
If the amendment's cancellation passage is absent from the request, the failure happened while the request was being built. The cause could be how passages were selected, a source missing from the index, a filter that excluded it, or how the request was assembled. Check each step between the document collection and the request.
If the passage is in the request but the answer gives only the notice rule, the answer fails to account for an exception the request already contained. The output alone cannot show why. Record the case and run it again after each change to the instructions or to the passage selection, and see whether the answer changes.
If your app shows which passage supports each statement, check that the passage does support it. A reference to the notice rule alone would leave the immediate cancellation and refund unsupported.
Start by recording, for each test question, the passage that settles it, and check whether the request contained it. Repeat that after every change to the documents or to the passage selection.
Once the app selects individual passages, the way the documents are divided starts to matter. The app has to find the relevant passages and include enough surrounding wording for the model to interpret them. The next piece covers how to divide documents into passages.
Join the waitlist: one email when there is something to try.