← Back to Cooldecode
Cooldecode · AI Watch · LLM fundamentals

Context window: what it is, and why "1 million tokens" doesn't mean 1 million useful tokens

Recent models keep announcing bigger and bigger context windows — Anthropic launched Claude Opus 5 on July 24, 2026 with support for a 1-million-token context. But what does that actually mean in practice, and why isn't "fitting more text" the same as "using that text well"?

01What a context window is

The context window is the total amount of information a model processes in a single inference call: system instructions, conversation history, attached documents, and the response it's about to generate — all of it counts toward the same limit. It's measured in tokens, text units that, on average, correspond to roughly three-quarters of an English word (in Portuguese the ratio varies a bit because of accents and conjugations).

Think of the context window as the model's "working memory" for that specific call: anything outside of it, the model simply doesn't see.

02Why it doesn't grow for free

Transformer-based models use a mechanism called self-attention, which makes every token "look at" every other token in the sequence to decide what's relevant. The computational cost of this mechanism grows roughly quadratically with sequence length: doubling the context window can quadruple the processing cost of the attention layer.

In practice

That's why increasing the context window isn't just "allowing more text" — it requires specific architectures and engineering optimizations so each request doesn't become prohibitively expensive and slow.

03The real problem in 2026: effective context vs. raw context

Building a model that accepts 1 or even 10 million input tokens is, today, a relatively solved engineering problem. The bigger challenge is making sure the model can actually make good use of all of it — finding a specific piece of information buried somewhere in the middle of a giant document remains harder than the window size suggests.

Two documented phenomena in this context:

  • Lost in the middle: models tend to prioritize information at the beginning or end of the context, neglecting what's in the middle — even when they weren't deliberately designed to do so.
  • Attention dilution: more tokens give the model more material to work with, but also introduce more noise; not everything in the window is equally relevant to the current task, and the model has to "filter" that internally.

04What this changes in practice for people using AI

PracticeWhy
Put the most important instruction at the start or end of the promptReduces the risk of it getting "lost" in the middle of a long context
Don't blindly rely on "fitting everything" into a giant promptA large context doesn't guarantee perfect retrieval of any given passage
Prefer relevant, well-selected context over maximum contextLess noise tends to produce more accurate answers
Test the actual task, not just the document size"It fits in the context" and "the model uses that context well" are different things

05Why this is topical right now

The launch of Claude Opus 5, on July 24, 2026, brought support for a 1-million-token context window with up to 128,000 output tokens — a meaningful leap over previous generations of the Opus family. Announcements like this tend to create the impression that "a bigger context window" alone solves problems like summarizing entire books, analyzing full codebases, or holding very long conversations without quality loss. Recent research shows that's only part of the equation: window size is necessary, but not sufficient — what really matters is how much of that window's content the model can actually retrieve and use.

To remember

A context window is the working memory of a single call to the model, measured in tokens. It's expensive to grow (attention scales roughly quadratically), and even when large, it suffers from practical limitations like "lost in the middle". When using a model with a large window, it's worth testing whether it actually retrieves specific information well within it — don't assume "it fits" means "it's used well".

Newsletter

Learn what AI is creating for you. Don't get lost.

Get notified when a new deep dive or lesson goes up. No spam, just new posts.

Cooldecode · IA Watch · Conceitos fundamentais de LLMs

Context window: o que é, e por que "1 milhão de tokens" não significa 1 milhão de tokens úteis

Modelos recentes anunciam janelas de contexto cada vez maiores — a Anthropic lançou o Claude Opus 5 em 24 de julho de 2026 com suporte a 1 milhão de tokens de contexto. Mas o que isso realmente significa na prática, e por que "caber mais texto" não é o mesmo que "usar bem esse texto"?

01O que é context window

A context window (janela de contexto) é a quantidade total de informação que um modelo processa em uma única inferência: instruções do sistema, histórico da conversa, documentos anexados e a própria resposta que ele vai gerar — tudo isso soma dentro do mesmo limite. É medida em tokens, unidades de texto que, em média, equivalem a algo entre três quartos de palavra em inglês (em português a proporção varia um pouco por causa de acentuação e conjugações).

Pense na context window como a "memória de trabalho" do modelo durante aquela chamada específica: tudo o que está fora dela, o modelo simplesmente não vê.

02Por que ela não cresce de graça

Modelos baseados em transformer usam um mecanismo chamado self-attention, que faz cada token "olhar" para todos os outros tokens da sequência para decidir o que é relevante. O custo computacional desse mecanismo cresce de forma aproximadamente quadrática com o tamanho da sequência: dobrar a janela de contexto pode multiplicar por quatro o custo de processamento da camada de atenção.

Na prática

É por isso que aumentar a context window não é só "permitir mais texto" — exige arquiteturas e otimizações de engenharia específicas para não tornar cada requisição proibitivamente cara e lenta.

03O problema real de 2026: contexto efetivo vs contexto bruto

Construir um modelo que aceita 1 ou até 10 milhões de tokens de entrada é, hoje, um problema de engenharia relativamente resolvido. O desafio maior é garantir que o modelo consiga usar bem tudo isso — encontrar uma informação específica escondida em algum ponto no meio de um documento gigantesco continua sendo mais difícil do que o tamanho da janela sugere.

Dois fenômenos documentados nesse contexto:

  • Lost in the middle: modelos tendem a priorizar informação que está no início ou no fim do contexto, negligenciando o que está no meio — mesmo quando não foram projetados deliberadamente para isso.
  • Diluição de atenção: mais tokens dão ao modelo mais material para trabalhar, mas também introduzem mais ruído; nem tudo que está na janela é igualmente relevante para a tarefa atual, e o modelo precisa "filtrar" isso internamente.

04O que isso muda na prática de quem usa IA

PráticaPor quê
Colocar a instrução mais importante no início ou no fim do promptReduz o risco de ela "se perder" no meio de um contexto longo
Não confiar cegamente em "caber tudo" num prompt giganteContexto grande não garante recuperação perfeita de qualquer trecho
Preferir contexto relevante e bem selecionado a contexto máximoMenos ruído tende a gerar respostas mais precisas
Testar a tarefa real, não só o tamanho do documento"Cabe no contexto" e "o modelo usa bem esse contexto" são coisas diferentes

05Por que isso está em alta agora

O lançamento do Claude Opus 5, em 24 de julho de 2026, trouxe suporte a uma janela de contexto de 1 milhão de tokens com até 128 mil tokens de saída — um salto relevante frente às gerações anteriores da família Opus. Esse tipo de anúncio tende a gerar a impressão de que "context window maior" resolve sozinho problemas como resumir livros inteiros, analisar bases de código completas ou manter conversas longuíssimas sem perda de qualidade. A pesquisa recente mostra que isso é só parte da equação: o tamanho da janela é necessário, mas não suficiente — o que importa de verdade é o quanto do conteúdo daquela janela o modelo consegue efetivamente recuperar e usar.

Para fixar

Context window é a memória de trabalho de uma chamada ao modelo, medida em tokens. Ela custa caro para crescer (atenção escala de forma aproximadamente quadrática) e, mesmo grande, sofre de limitações práticas como "lost in the middle". Ao usar um modelo com janela grande, vale testar se ele recupera bem informação específica dentro dela — não assumir que "cabe tudo" equivale a "usa tudo bem".

Newsletter

Saiba o que a IA está criando pra você. Não fique por fora.

Seja avisado quando eu postar uma imersão ou lição nova. Sem spam, só posts novos.