A retrieval-augmented generation (RAG) system can change its answer when its searchable documents change. No change to the parameters of the language model generator is required. It will only alter, however, if there is an appropriate document to be found in the search space, if the retriever is able to find and return that (or an equivalent) document, and if the language model makes appropriate use of the returned document or documents. Lewis et al. varied the Wikipedia index and scored answers against the officeholders at each date. There are, however, quite a number of failures, even when searching an index of the correct date. Lewis et al., Retrieval-Augmented Generation
A museum changes its Thursday closing time, from 18:00 to 20:00. A member of the public asks what time it closes. The answer 20:00 is returned. How might the system have arrived at that? By finding and returning an appropriate document; by the generator happening to "know" 20:00; by parroting an assertion contained in the input question; or by chance. There is no obvious way, just from examining the output, to tell which. Allowing the system access to one or other version of a document and observing the effect on the output is likely to be much more informative.
The components affecting the output to a single question
As described by Lewis et al., the RAG model draws on information held in two forms. Information "learned" as the model parameters were adjusted over many training examples; and information held as a large number of passages, any of which may be returned as a result of a search prompted by the input question. Given an input question, and one or more passages, the generator computes the probability distribution over sequences of output tokens. So it may draw on information obtained by retrieval specifically for this question, in addition to information already embodied in the parameters. Lewis et al., Section 2
Assume there are several relevant documents in the index for the above example: general information for the visitor; an events page giving details of "Late Thursday" openings, prior to the change; and a short notice of the change to Thursday hours. All of these would be expected to have some degree of similarity to the question. The very brief notice of the change might rank below passages that discuss visiting the museum in more detail. Of course it is not enough for a passage merely to be about the right general subject; ideally it will contain some information on which an answer can be based.
Assuming a suitable passage is returned, the language model must then make appropriate use of it. For example "The shop will close at 20:00 on Thursdays" tells us nothing about the closing time for the rest of the museum. "Thursdays will be open late from October" applies only from a particular date. So if the generator outputs "20:00", a user familiar with the returned passage may well think it justified, failing to notice the qualification as to date. Many aspects need to correspond between passage and output for the passage to be a valid justification of the output.
Varying the date of the index searched
The researchers identified 82 world leaders whose offices changed occupant between two Wikipedia snapshots. A standard form of question was asked of each office held, searching one or other of two Wikipedia indices. The change of officeholder matters, otherwise there would be little to differentiate the effect of searching one index or the other. Lewis et al., updating the world knowledge of RAG
| Index searched | Correct for 2016 | Correct for 2018 |
|---|---|---|
| 2016 | 70% | 4% |
| 2018 | 12% | 68% |
So, over these questions about offices known to have changed occupant in the period, searching a particular version of the index gave a much higher proportion of the corresponding answer. The index influenced which officeholders the system named. The aggregate comparison cannot attribute any individual correct answer to a particular passage or establish that the system would reflect a page update immediately. The system still missed 30% of questions for 2016 and 32% for 2018 when the reference year matched the index. Lewis et al., replacing the index
Note that the question makes no reference to a date. The authors choose to evaluate success with reference to the occupant at a particular date. Of course a question about future visits to a building will not necessarily relate to the current state of affairs. Returning the most recent information about hours may therefore be inappropriate. Both the date relevant to the enquirer and that to which a returned document applies would need to be taken into account.
Effect of returned documents on individual output tokens
There are variants of RAG described in the original paper. With RAG-Sequence the probability of each candidate complete sequence of output tokens is assessed with reference to each candidate document, and the results combined. With RAG-Token there is a mixture of documents for each individual output token. On either interpretation it would not generally be possible for a user to identify, unambiguously, which document or documents were responsible for any particular output token, given that probabilities of several options are combined, and there will also be relevant information embodied in the parameters of the generator. Lewis et al., Model
If the question asked about two different closing times, for example for the exhibition space and the cafe, it is possible that information about each would be contained in separate documents. RAG-Token allows for the possibility that different documents inform different parts of the output sequence. It also allows for an inappropriate combination of information from two documents, for example the type of premises from one and the closing time from another. Just because each can be found in a returned document is not sufficient justification for their conjunction.
Many other approaches are possible; for example, returning a number of documents and requiring the generator to refer to them in an output. This may well be a sensible approach in many circumstances, but clearly the mechanism by which information from documents is incorporated into the output differs significantly. So it is important to know what mechanism applies if comparing results with those in the paper. And if questioning how a particular output was derived, one needs to know what documents were input to the generator, in what form. "It's RAG" is not sufficient.
Investigating why the old answer is returned
The first place to look would be the underlying set of documents available. Can the relevant one be identified and located? If not, no amount of modification to other parts of the system will retrieve it. Has it been incorporated into whatever index or indices are searched? There may be several stages between a document being updated and its new form being available to be searched. So the updated version may well exist in one place, but the old version still be returned in response to a search.
Then check what documents would be returned for a "normal" form of the relevant question. The new document may well be found if searched for using, say, its exact title. But other documents may be more highly ranked for a question more typical of that asked by a member of the public. So the required information may well be available, but this at least localises the problem to the retrieval stage. At this point it would be useful to supply the relevant document directly to the generator, with the appropriate question, to see if a suitable answer results.
If so, but the system as a whole still returns 18:00, there may be other conflicting information available to the generator. For example general information about opening hours may co-exist with a special notice. So try supplying just one or other of the documents, and then both together. If the system copes with each separately but fails with both supplied, there is an issue about determining which applies, most recent, most specific, and so on. Supplying yet more documents may well exacerbate this particular problem.
It is important to use similar questions, and the same settings of all other relevant variables, including the generator and its parameters. Record exactly which documents reached the generator, including the dates of the visitor guide and the revised notice. And of course the generated response may vary from one invocation to another. So either repeat a number of times, or set parameters to remove as much randomness as possible. Note that if 20:00 is returned regardless of what documents are supplied, including none, then while the system may be quite fit for purpose, there is little evidence that the updated document is having any effect.
It is also instructive to ask a question not answered by either document. For example, if neither says at what time admission ceases, then generating an answer implying that admission ceases 30 minutes before closing would be unsupported by those documents. Arguably it would be better if the system indicated lack of sufficient information, at least that would reflect the position more accurately. It is desirable that the system is good at both returning information where it exists, and recognising when it does not. One can be improved without affecting the other.
How to tell whether the update reached the answer
Ideally one would want a list of items of information expected to change as a result of an update, with the relevant dates of old and new information. And also some items expected to remain constant. So if only closing time on one day of the week is to change, there should be no effect on other days. Returning the updated time for all days would give a good result if testing only the day expected to change, but fail to give the correct answer to a member of the public enquiring about another day. So it is useful to test a range of related items, to establish the extent of "spill over" of an update.
Keep examples where the generator received the evidence and answered incorrectly, alongside examples where retrieval missed it. In the first case, further updating of documents is unlikely to help. In the second, better phrasing of the output is not going to conjure up the missing information. Different questions may fail at different stages.
So to return to the title question, ideally one would fix all other aspects of the system, vary the documents available, and observe the effect on answers, and in particular that they corresponded to appropriate documents. And one would also wish to examine the document or documents returned. So if, in the example, it returned the updated time of closing, applied it only from the relevant date, and did not alter other times, one could be fairly confident that it had been properly updated. None of these conclusions could be drawn merely from a seemingly correct answer, or the presence of some indication that a document supported it.