liveBook · Manning

Attention

As explained in AI Agents in Action, Second Edition

An attention layer computes context-dependent interactions among input elements to form representations for prediction.

Attention selects what matters from context. In language models, attention and feedforward layers build internal representations used to predict the next token; in cognitive agents, attention routes control dynamically among specialized modules. section 2.1.1 section 10.0

A useful contrast is static versus adaptive reasoning. Static reasoning commits to one pattern, while attention lets an agent select, compose, and monitor strategies according to the problem and feedback. section 10.1.2

Use this mental model:

  • Represent the current context so the system can make a prediction or choose an action. section 2.1.1
  • Route control toward the specialized module or reasoning pattern that fits the problem. section 10.0
  • Use evaluation feedback to redirect attention when ambiguity or contradiction appears. section 10.1.2

Redirecting reasoning

An agent begins with one reasoning strategy, but evaluation detects ambiguity or contradiction. Attention redirects control to a different strategy instead of forcing the original pattern to completion. section 10.1.2

Figure 10.2 Cognitive primitives vs. cognitive architecture, with reasoning primitives becoming a selection within the process

Trace how cognitive architecture turns reasoning patterns from fixed design-time choices into dynamically selected components. section 10.1.2

How AI Agents in Action, Second Edition covers it

How deep it goes
Connects attention to context representations and strategy selection, but does not detail attention-layer computation.
Examples
Uses next-token generation and feedback from ambiguity or contradiction as attention-related illustrations.
What it assumes
Builds from token prediction and reasoning primitives toward a cognitive architecture.
What you can do after
Evaluate how an agent can redirect reasoning when evaluation detects ambiguity or contradiction.
How it connects
Links attention to transformers, feedforward layers, cognitive architecture, reasoning patterns, and evaluation.

Also explained in

Compare how 28 books explain attention →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of AI Agents in Action, Second Edition. The section links point to the parts of the book it draws on.