liveBook · Manning

Attention

As explained in Causal AI

Attention is a neural-network mechanism that assigns different weights to parts of an input when computing a representation or producing an output.

When a language model encounters an ambiguous token, it must determine which surrounding words matter most. Attention solves this by assigning different weights to parts of the input sequence when computing a representation or output. section 13.2.2

In a Transformer-based language model, attention lets the network focus on sequence elements relevant to the current task while assigning less weight to others. This supports higher-level representations beyond predicting each token from the tokens before it. section 13.2.1 section 13.2.2

Stacked attention layers can build progressively broader relationships:

  • Early layers capture immediate word-to-word relationships. section 13.2.2
  • Intermediate layers connect phrases and treat related spans as broader entities. section 13.2.2
  • Later layers represent overarching themes across a sentence or broader text. section 13.2.2

Resolving “leaves”

In “The Labor Day weekend wildfire started in the forest and spread rapidly due to the dry leaves on the ground,” attention connects “leaves” with “dry,” “ground,” and “forest,” favoring the foliage meaning over the verb meaning. section 13.2.2

A higher-level representation is not automatically a causal representation. Attention can help an LLM organize relevant information, but it does not by itself establish causal understanding or make the model’s reasoning verifiable. section 13.4

How Causal AI covers it

How deep it goes
Explains weighted focus and stacked layers from local relationships to global themes, but stops short of attention’s mathematical implementation.
Examples
Uses wildfire language to show contextual disambiguation and layered connections between words, phrases, and themes.
What it assumes
Assumes familiarity with token-sequence probability and introduces attention as the mechanism behind coherent higher-level representations.
What you can do after
Evaluate/understand how attention builds contextual representations without treating them as verified causal explanations.
How it connects
Connects attention to Transformer architectures, large language models, token sequences, neural network layers, and causal representations.

Also explained in

Compare how 28 books explain attention →

Related concepts

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