What Huge Context Windows Actually Mean
Announcements of large language models featuring huge context windows – possibly of one million or more tokens – pop up somewhat regularly by now, and usually spur a veritable avalanche of hypotheses as to in what area are they expected to prove useful. The current iteration centres around Gemini 2.0 Flash, and the idea seems to be that it will revolutionize the RAG architecture. Hereby we recommend the proverbial grain of salt.
First, the basics. The current crop of LLMs has to try to correlate every token with every other token in the context window. This immediately means that the size of the model (or maybe only that of the computation, in the case of some real aggressive exploitation of symmetries) has to grow with the square of the size of the context window and not any slower, a fact that prevents us from going the naive way of just scaling everything up. On the other hand, it appears that larger context windows would be really useful – one could prime the LLM with so much more information if space allowed – and thus a very lively research activity was unfolding in the last couple of years aimed at separating the context size from the model size, with some success. However, so far every solution has some sort of drawback, the most often encountered one being inconsistency of focus. Plainly stated, models with large context windows often have difficulty consistently finding relevant information in their context, even if it is plainly there. This has always been a problem to some extent, but with the advent of huge context windows, it became a significant headache.
So whenever we hear about another model with an extremely large context window, we can be sure that the developer team has managed to fine-tune a trick solution to the point where the remaining issues aren’t seen as showstoppers. But instead of dwelling upon the shortcomings, let’s assume that a bona fide millions-of-tokens context window comes our way. How can we exploit its possibilities?
The first idea that should occur to us is that we no longer have to deal with the issue of balancing query size against possibly leaving out important information. We can throw the entire book at the LLM – okay, that’s a lame pun, but we can just hand a whole document to the LLM and ask it to find the reply to our question, and we can be sure that we supplied all the necessary information. This is probably why such models are hailed as RAG-killers. With the current RAG solutions we have to search for judiciously partitioned text fragments and then decide how many of them to include in the prompt (although this decision is usually, and probably often wrongly, taken at development time). Obviously, less manipulation is better, and finding the proper text chunks can be a point of failure in quite a lot of situations, so why wouldn’t we welcome the opportunity of just sending the whole document to the AI with the reassurance that the chunking mechanism, not even having been invoked, did not lose anything important?
Well, there are a number of issues:
- Sending only smaller chunks may be more efficient in helping the system to focus on important information. Providing it with the whole document may even turn out to be counterproductive because the system may accidentally skip over important pieces of information.
- The size of the document is bound to be larger, perhaps much larger than that of classic RAG prompts. This means extended computation and larger fees if your tariff plan features per-token pricing.
- The document has to be sent as a whole, eliciting worries about secrecy. It is not at all likely that any of the LLM cloud providers would spy on their clients, but your company guidelines concerning cybersecurity might still forbid this action altogether. Note that classic RAG prompts aren’t free of this issue either, but it is much harder for the other side to reassemble the documents from the fragments thrown at it seemingly at random.
- Apart from simple cases, documents still have to be fragmented; not because the fragments go into the prompt but because we still need to identify the proper document from the original query, we can not do so without involving some sort of embedding model, and embedding models have much smaller windows. After we have found the relevant chunks, we can of course send the entire document the chunks are coming from (or multiple documents, even), but chunking is still relevant.
- Providing all the necessary documents for certain kinds of queries probably will exceed the capacity of the context window anyway. Consider for instance a query that requires consulting all previous versions of a document, say a periodically renewed contract. All versions of the contract have to be sent in their entirety. At some point an overflow will necessarily occur.
- The documents still have to be extracted into a text format that conveys structural information. Tables must be correctly handled; so do footnotes and sidebars.
So as of yet, we think that for RAG solutions these huge context windows aren’t that much more useful than the current ones. The prompt engineering around carefully extracted text chunks is probably here to stay as well.
Large context windows are more likely to help with other applications of LLMs, in that particular area of tasks we might call, no offence intended, shallow analysis tasks. These are tasks that require a moderate depth of logic and intuition but a relatively large body of knowledge. A very pertinent example is text-to-SQL. Text-to-SQL was among the earliest attempted applications of LLMs, but the results are still somewhat imperfect, too often returning queries that do not correspond to the intended meaning, and one of the reasons for their imperfection is that it is difficult to impart enough information to the LLM about both the SQL dialect used and the semantics of the underlying database structure. This could be caused by the relatively small size of context windows, but now this constraint seems to be on its way out. Another cause, uncovered by the disappearance of the first, is the (lack of) completeness for database descriptions, as humans are more flexible when it comes to dealing with imperfect descriptions, i.e. we go around and ask questions, or devise and perform tests to decide between competing interpretation hypotheses. Text-to-SQL solutions demand much more complete descriptions of the underlying database, and these documents will have to be kept rigorously up to date and proofread in an antagonistic manner, to make sure the LLM has all the information that a newly hired programmer could simply ask from the more experienced ones. (It could, however, be possible to ask the LLM itself to perform this kind of proofreading, even though it might make mistakes in the process – how many layers of uncertainty are you willing to accept?)
It might seem somewhat anticlimactic that we have to pay more attention to document quality right now when LLMs appear to have solved the issue of the gap between formality required by computers and informality characterizing human communication, but the rule is clear: you can get away with informality but you cannot get away with incompleteness. For this reason, we expect that a cottage industry of brushing up internal documentation to the level demanded by shallow analysis will spring up, likely augmented by the arcane science of creating meta-documentation to go with it; long-term predictions are harder to give, but it is possible that this kind of task itself will be greatly helped by large-context-window LLMs, by e.g. pointing out the missing information.
Another application area of large context windows appears to be shallow analysis of information partly or entirely supplied in the form of diagrams. An example would be to provide guesswork based on symptoms as to what went wrong in a system described by a diagram, like complex piping or an electric grid. Most LLMs do have at least a rudimentary capacity to ingest images, but we still expect them to be able to handle information better if presented in the form of text, at least for the foreseeable future. Conversion to a text description of diagrams as a set of relationships between components is therefore a likely avenue to supply the AI with reference data, but this description is prone to balloon to large sizes, hence the need for large context windows.
The list can be continued. Descriptions/specifications of some locally important domain-specific language might provide help in creating or proofreading code in said DSL. Large reference works can be fully included with the system instruction to make the chatbot instantly knowledgeable about some speciality area. Entire databases (if small enough – say, the sales database of a pop-and-mom shop) can be entered and processed in various ways, although this one skirts the separation line between shallow and deep analysis. Nonetheless, there are probably a large number of applications that depend on having more information, and this has just become possible.



