liveBook · Manning

Context

As explained in Grokking AI Applications

Context is a numerical representation derived from the input text that summarizes information relevant to predicting a continuation.

Context is a numerical representation derived from input text. It summarizes information relevant to predicting what comes next, much like a powerful autocomplete system uses what you have already written. section 1.5

Context fits into the GPT sentence-completion process:

  • Tokenize the input into words, word parts, or punctuation marks. section 1.5
  • Translate tokens into numbers through embeddings. section 1.5
  • Combine the embeddings with context to guess the next best word. section 1.5
  • Repeat the process autoregressively, feeding each generated word back into the input to build longer text. section 1.5

A tiny vocabulary

A simplified GPT can represent “The,” “capital,” “of,” “Italy,” “is,” “Paris,” “Rome,” and “London” with numerical embeddings. Given a prompt, its context helps select a plausible continuation. section 1.5

Figure 1.8 Given a prompt, you can calculate the context.

Visualize how a prompt becomes a calculated context before continuation prediction. section 1.5

How Grokking AI Applications covers it

How deep it goes
Defines context as a numerical representation and connects it to embeddings and prediction without developing mathematical internals.
Examples
Uses a tiny eight-word dictionary, numerical word representations, prompts, and repeated next-word generation.
What it assumes
Builds tokenization and embeddings from an intuitive starting point rather than assuming AI engineering expertise.
What you can do after
Understand how GPT turns tokenized input into context for predicting and repeatedly generating continuations.
How it connects
Connects context with tokenization, embeddings, autoregressive models, and sentence completion.

Also explained in

Compare how 18 books explain context →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Grokking AI Applications. The section links point to the parts of the book it draws on.