Getting started with legal AI
AI Context Window: Why a Case File May Not Fit
By Lucerna LawPublished 9 min readUpdated
An AI context window is the text a model can see while it writes one answer: the question, the instructions, any documents sent with it, and the answer itself. The window has a fixed size. A case file larger than that cannot be sent whole, so the software chooses passages, and the answer reflects only what was chosen.
What is an AI context window?
An AI context window is everything a language model can refer to while producing a single response. Anthropic, a maker of language models, defines it in its documentation as "all the text a language model can reference when generating a response, including the response itself", and calls it a "working memory" distinct from the data the model was trained on.
The page is its account of how the context window works. Anthropic's glossary, cited below, says the concepts it defines are not unique to its own models. This post relies on that one maker's documentation and opened no other's. The post on legal AI defines the term in a few sentences beside five others.
Two consequences follow from the definition.
The first is that the model has no access to a matter except through the window. It does not open the firm's files. Software reads the files, takes text from them and places some or all of that text in front of the model with the question. What is not placed there does not exist for that answer.
The second is that the window is rebuilt for each answer. The documentation describes each turn's input as the earlier conversation plus the new message. A model does not carry a matter in its head from Monday to Tuesday. If Tuesday's answer knows what Monday's said, that is because the software sent Monday's exchange again.
01
Software reads the files
The model does not open them
02
Text goes in the window
Some or all of it, with the question
03
The model answers
What was not placed there does not exist for that answer
04
The window is rebuilt
The documentation describes each turn's input as the earlier conversation plus the new message
How many pages fit in a context window?
It depends on the model, and the measure is tokens, not pages. Anthropic's documentation lists windows of 200,000 tokens and of 1 million tokens for different models. Its glossary says a token is roughly 3.5 English characters. Converting that to pages needs an assumption about how much text a page holds.
The unit comes from Anthropic's glossary entry on tokens, which describes tokens as the smallest units a model works in and says that, for its models, a token "approximately represents 3.5 English characters, though the exact number can vary depending on the language used."
The arithmetic below is this post's own, on assumed figures: the two window sizes that documentation lists and a single-spaced page of about 3,000 characters. It is an illustration, not a measurement, and it describes no product.
| Window | Characters, at 3.5 a token | Pages, at 3,000 characters a page |
|---|---|---|
| 200,000 tokens | About 700,000 | About 230 |
| 1,000,000 tokens | About 3.5 million | About 1,170 |
Those figures are ceilings on everything in a request, not on the documents alone. The documentation says "everything in the request counts toward the context window": the instructions the software gives the model, every earlier message in the conversation, and the output the model generates.
A real page may also hold more or less than the assumed 3,000 characters. A deposition transcript has wide margins and short lines. A dense contract has neither.
Why the window is a ceiling and not a target
A tool does not have to fill the window, and there are reasons not to. The same documentation says "more context isn't automatically better. As token count grows, accuracy and recall degrade", and concludes that choosing what goes in matters as much as how much space there is.
So the size at which a product stops sending a file whole is a separate fact from any model's window. It is the number to ask a vendor for, and a product's own pages are the place to find it.
Why can a large case file not be sent to the model whole?
A large case file cannot be sent whole because its text exceeds the window, and a request that exceeds the window is refused. Anthropic's documentation says of its own service that if the input alone exceeds the model's context window, the request returns an error that reads "prompt is too long".
Take the file a litigation matter can produce: six deposition transcripts, a 900-page production and 4,000 text messages. On the rough arithmetic above, the production alone takes up most of the larger of the two windows before a single transcript is added.
The refusal is the visible case. The less visible one is a tool that avoids the error by sending less than everything and answering anyway. The lawyer sees an answer either way. Whether it came from the whole file or from part of it is not apparent from the answer's tone.
The post on summarizing a large case file covers what this does to a request for a summary, under why an AI tool cannot read a large case file in one pass.
What a tool does when the file is larger than the context window
When the file is larger than the context window, a tool has three options: select the passages most relevant to the question, shorten the material into summaries, or drop the oldest content. Selection is the method this post follows, because it is the one Lucerna Law's homepage describes for a large matter.
| Option | What the tool does | What it costs |
|---|---|---|
| Selecting passages | Sends the passages that best match the question as asked | Two wordings of one question can be given different passages |
| Summarizing in stages | Summarizes each document, then answers from the summaries | Each summary chose what to leave out before the question was known |
| Dropping the oldest turns | Can remove the oldest exchanges of a long conversation to make room | An early instruction may no longer be in front of the model |
Selecting passages
Selection goes by the name retrieval. Anthropic's glossary describes it under retrieval augmented generation: relevant information "first must be retrieved from the knowledge base based on the input prompt, and then passed to the model along with the original query." It adds a caution that the method's effectiveness "depends on the quality and relevance" of what is retrieved.
The words "based on the input prompt" carry the weight. Passages are chosen by their match to the question as asked. Two differently worded questions about the same event can be given different passages.
Summarizing in stages
A tool can also summarize each document, then answer from the summaries. More of the file is represented. Each summary has already decided what to leave out, and that decision was made before the question was known.
Dropping the oldest turns
In a long conversation the oldest exchanges can be removed to make room. The documentation notes that chat interfaces can manage the window on a rolling "first in, first out" basis. An instruction given early in a long session may no longer be in front of the model.
What does a limited context window mean for questions about "everything" and "nothing"?
A limited context window weakens any answer that depends on the model having seen the whole file. Questions about what a document says survive selection, because the passage is in the selection or the answer has nothing to cite. Questions about what is absent, or about every instance, do not survive it as well.
The table sorts five kinds of question on the hypothetical matter above. It is an illustration of the reasoning, not a test result.
| Question | When the model has the whole file | When it has a selection |
|---|---|---|
| "What did the manager say about the schedule on March 3?" | Answerable | Answerable if the passage was selected. Open the citation |
| "Did anyone ever mention a written warning?" | "No" is a statement about the file | "No" is a statement about the selection |
| "List every message that mentions overtime." | The list can be complete | The list may stop short |
| "How many times did she ask for the report?" | Countable | The count may be low |
| "Put these events in date order." | Sees every dated passage | Orders only what it was sent |
A question that names a person, a date and a topic gives selection the most to match on. "Everything", "ever", "never" and "how many" give it the least, and they are the questions whose answers depend most on completeness.
Compare two ways of asking about the same thing:
Ask the file
Did anyone ever mention a written warning?
Which messages between Reyes and the site manager in March mention a warning, and what does each say?
The second can still miss a message. Its answer, though, is a list of cited passages that can each be opened, and the gaps are easier to see in a list than in a "no".
How Lucerna Law handles a matter larger than its limit
Lucerna Law sends a small matter whole and a large one in part. Its homepage says: "A matter of up to about 150 single-spaced pages goes whole. From a larger one, only the passages that best match the question." Its pages state that line and do not explain how it was set.
The same page lists what travels with a question. The model is sent the question, the text of the matter's files ("all of it when it fits, otherwise a selection"), each file's title, the matter's name, client and description, and up to the last 10 turns of the chat. All of that shares the window. No Lucerna Law page states the context window of the model it calls, and the page arithmetic earlier in this post is not a description of it.
The homepage's account of how data is handled describes one check on the result. The server confirms that each citation names a passage the model was given, and strikes through one that does not. That check works on selection's side of the problem and not on the other. It confirms a cited passage was sent. It cannot flag a passage that was never selected, and it does not test whether a passage supports the statement it follows.
The unit of selection is the passage. The post on AI document review explains what a passage is and how the AI reads the files in a matter.
How to work within a context window on a large matter
Work within a context window on a large matter by keeping questions narrow, asking the important ones more than once, and using literal search for anything that turns on absence. These habits apply to any tool that selects passages. They are a method, not a guarantee.
- Find out which side of the line the matter is on. If the product states a size, compare the matter with it. A matter under the line can be asked "everything" questions with more confidence.
- Name people, dates and topics. Each one gives selection something to match.
- Ask twice in different words. If the two answers cite different passages, both sets matter.
- Search for the literal word. Lucerna Law's matter search matches passages by a plain, case-insensitive "contains". A search for "warning" does not depend on what was selected for a question.
- Split a long session. Lucerna Law sends up to the last 10 turns of a chat with a question, so an instruction given earlier than that is no longer in front of the model. A new chat with the instruction restated is cleaner.
- Treat every negative as provisional. On a large matter, "nothing in the file says X" has been established for the passages sent and no further.
The same limit applies outside practice. A student who pastes a casebook chapter into a chatbot is filling a window too, and the post on AI for law students covers what law schools' own policies say about doing so.
None of this is legal advice. It describes how one kind of software works, from one maker's documentation and from Lucerna Law's own pages, and a firm weighing a tool will want that tool's own answers.