ladderlore
Request a guide
  • Type a service name, like S3 or IAM.

Concept

Tokens and the context window

The small pieces of text a model reads and writes, and the limit on how many fit in one request.

Context window: tokens in plus tokens out
Prompt
Model
Response
  1. 1Your prompt is split into tokens and sent to the model.
  2. 2The model writes the response token by token. Both count toward the window.
The prompt and the response share one context window.
  • cat

    May split into
    cat
    Tokens
    1
  • Hello!

    May split into
    Hello + !
    Tokens
    2
  • unbelievable

    May split into
    un + believ + able
    Tokens
    3
Examples only. Every model has its own tokenizer, so real splits differ.

What it is

A model does not read letters or whole words. It reads tokens. A token is a piece of text: a short word, part of a longer word, a number or a punctuation mark. A tokenizer splits your text into tokens before the model sees it. The model then writes its answer one token at a time.

Every model has a context window. This is the most tokens it can handle in one request, counting the prompt you send and the answer it writes. If the prompt is long, less room is left for the answer. Text that does not fit is cut off or rejected.

What it is

Tokens matter for two more reasons. Providers bill by tokens (see the token pricing lesson), and more tokens take more time to process.

Remember

  • A token is a piece of text, not always a whole word.
  • Different models split text in different ways, so token counts differ between models.
  • The context window is the limit on tokens in one request: input tokens plus output tokens.
  • A longer prompt leaves less room for the answer.
  • More tokens mean more cost and more waiting time.

On the exam

  • “The maximum amount of text a model can handle in one request” points to the context window.
  • “The unit a model reads and the unit it is billed by” points to a token.
  • “A prompt and answer together are too long” points to the context window limit.