Skip to main content
AI · LANGUAGE MODELS

What Is a Context Window?

A context window is the maximum number of tokens a language model can consider at once, covering the instructions, documents, conversation history and its own reply. Current open models from Meta, Google and Alibaba state windows of 128K to 262K tokens. A longer window costs memory and time, which is why retrieval is often used instead.

01

What a context window is

A context window is the maximum amount of text, counted in tokens, that a language model can take into account at one time. Everything the model works with has to fit inside it: the instructions, any documents passed in, the conversation so far and the reply it is writing. Anything outside the window, the model cannot see.

A token is a word or part of a word. Google’s rule of thumb for its Gemini models is about four characters of English per token, with 100 tokens equal to about 60 to 80 words, so a 128K window holds very roughly 80,000 to 100,000 words of English. Context length and context size mean the same thing.

The window is a limit fixed largely by how the model was trained. It is not memory in the everyday sense: a chat assistant only seems to remember earlier messages because the application sends the whole conversation back with each new question.

02

Tokens in and tokens out

The window is shared between what goes in and what comes out. Some services give the reply a separate budget. Google, for instance, says its Gemini 4 models share a single window of 1,048,576 tokens across input, thinking and output, while Gemini 3 and 2.5 have separate input and output limits. A request typically fills the window with these parts.

  • //
    System prompt. The standing instructions an application adds before every request, which can run to thousands of tokens.
  • //
    Conversation history. Every earlier question and answer, sent again each turn, which is why long chats eventually reach the limit.
  • //
    Documents and tool results. Pasted text, retrieved passages and the output of any tools the model calls.
  • //
    Reasoning tokens. Models that think before answering write out working that counts against the window, even when users never see it.
  • //
    The reply. Output tokens are generated one at a time, and each joins the context as it is written.
03

Context lengths of current models

Makers state their limits on their model cards and documentation. These were the figures when we checked on 15 November 2026.

Model Maker Context window Weights
Llama 3.1 (8B, 70B, 405B) Meta 128K tokens Open
Gemma 4 E2B and E4B Google 128K tokens Open (Apache 2.0)
Gemma 4 12B, 26B A4B and 31B Google 256K tokens Open (Apache 2.0)
Qwen3.5-9B Alibaba (Qwen) 262,144 tokens, extensible to 1,010,000 Open (Apache 2.0)
gpt-oss-20b OpenAI 131,072 tokens in the published configuration Open (Apache 2.0)
Gemini 4 Google 1,048,576 tokens, shared with the output Cloud service only

A stated maximum is not the same as good use of it. In the 2023 paper “Lost in the Middle”, researchers found that models perform best when the relevant information sits at the start or end of a long input, and worse when it is buried in the middle, even in models built for long contexts.

04

Why longer context costs memory and time

Every token inside the window has to be held in memory while the model writes. In each layer, the model keeps a key and a value vector for every token, so that new tokens can attend to old ones without recalculating them. That store grows in a straight line with the number of tokens.

For Meta’s Llama 3.1 8B, with 32 layers and 8 key-value heads of size 128, the arithmetic is 2 × 32 × 8 × 128 × 2 bytes, about 128 KB per token at 16-bit precision. A full 128K window therefore needs about 16 GB on top of the model, against roughly 4.6 GB for the weights themselves at 4-bit. Halving the window halves that figure, which is why runtimes let you set a context size below the model’s maximum.

Time grows too. The whole prompt has to be processed before the first word of the reply appears, so a long document means a longer wait, and each new token takes a little longer as the window fills.

05

Long context or retrieval

A large window is one way to give a model more information. Retrieval-augmented generation (RAG) is the other: the application first searches a library of documents and passes only the most relevant passages to the model with the question.

Retrieval keeps prompts short, so answers come quickly and memory use stays low, and the library can be far larger than any window and updated without touching the model. It depends on the search finding the right passages. A long context suits tasks that need a whole document at once, such as comparing two contracts or reviewing a long log, and saves building a search index. Many systems use both: retrieval picks the documents, and a moderate window, for example 8,000 to 32,000 tokens, holds them.

FAQ · 01
What is a large language model?
A neural network trained on huge amounts of text to predict the next word, or token, in a sequence. That one skill lets it answer questions, summarize, translate and write code. Most use the transformer architecture and have billions of parameters, so they run on GPUs or other AI accelerators.
Read the full FAQ —
06

Context windows on edge AI hardware

On an edge computer, the context window is a sizing choice as much as a model feature. On Jetson the processor, GPU and operating system share one pool of memory, so the window you configure competes with camera pipelines and the model itself. A maintenance assistant that retrieves a few pages of a manual works well with a few thousand tokens on a 16 GB module, while reading long documents whole calls for the 64 GB of an AGX Orin 64GB or a Jetson T4000, or the 128 GB of a T5000.

Our Performance Finder sizes memory for a described application, and our Jetson AGX Orin computers and wider range of edge AI computers cover the steps in between. Our comparison of edge AI and cloud AI explains when very long-context work belongs in the cloud instead.

07

Quick answers on context windows

Context windows: common questions

What is a context window in AI?

The model’s working space. It is the maximum number of tokens, covering prompt, documents, history and reply, that a language model can consider at once.

Which LLM has the largest context window?

It changes often. Of the models in our table, checked on 15 November 2026, Google’s Gemini 4 offers the most at 1,048,576 tokens. Claims of a million tokens or more are now common, so check each model card.

What happens when the context window is full?

Older content is lost. The application drops or summarizes the oldest messages, or refuses the request. The model itself cannot see anything that no longer fits.

Does a bigger context window make a model better?

Not on its own. It lets the model see more, but quality can fall for information in the middle of a long input, and every extra token costs memory and time.

Is the context window the same as memory?

No. The window holds only the current request. Anything a model appears to remember across sessions is stored by the application and sent back in.

We supply Jetson and GPU systems for language models integrated as standard, with memory fitted for the context length you plan to run and the operating system installed.