Large Language ModelsContext Windows

What is context length in an LLM?

Context length in an LLM is the number of tokens currently included in the sequence the model is processing.

It is measured in tokens and can include the prompt, conversation history, retrieved information, system instructions, and generated tokens that are still part of the active sequence.

Context length vs. context window

These two terms are related but not identical.

  • Context length is how many tokens are currently being processed.
  • Context window is the maximum number of tokens the model can process at once.

For example:

Context window: 128,000 tokens
Current context length: 20,000 tokens

The current request is using only part of the model's available context capacity.

What contributes to context length?

Depending on the model and application, context length may include:

  • System instructions
  • User prompts
  • Previous conversation turns
  • Retrieved documents
  • Tool results
  • Special tokens
  • Generated response tokens

The exact accounting depends on the model and API.

Why does context length matter?

As context length increases:

  • More of the context window is consumed
  • Memory usage can increase
  • Inference can become slower
  • Attention computation may increase
  • Less room may remain for additional input or output

A longer context can provide more information, but only when that information is relevant and the model can use it effectively.

Is context length measured in words?

No.

Context length is normally measured in tokens.

Because different tokenizers split text differently, the same number of words can produce different context lengths across different LLMs.

For example:

Same paragraph
→ Model A: 500 tokens
→ Model B: 650 tokens

Does context length stay fixed during generation?

No.

During autoregressive generation, each newly generated token becomes part of the sequence used to predict the next token.

So the active context length usually grows as the response is generated.

For the maximum supported capacity, see “What is a context window in an LLM?”

In short: context length is the number of tokens currently being processed by an LLM, while the context window is the maximum number of tokens the model can handle at one time.

#what is context length in an LLM#LLM context length#context length vs context window#LLM token context length#current context length LLM#large-language-models#llm#context-length#context-window#tokens

Learning Sequence

Large Language Models Curriculum

22% Completed
Up NextLarge Language Models

What is the difference between input tokens and output tokens?

Explore Related Questions

Deepen your understanding across related Large Language Models topics.

Machinoai Logo
Machinoai

Your edge in the AI era. Deep dives into machine learning concepts, paper explainers, verified industry jobs, and developer tools.

© 2026 Machinoai. All rights reserved.