liveBook · Manning

Attention

As explained in Optimization Algorithms: AI techniques for design, planning, and control problems

An attention mechanism computes weights over representations so a model can focus on selected input information when producing an output.

Attention lets a model selectively focus on relevant portions of its input while producing an output. It represents relevance with weights, helping preserve context across long sequences and distinguish important graph neighbors. section 11.3.2

Attention supports several related operations:

  • Assigns importance scores to input segments or relationships between graph nodes. section 11.3.2
  • Dynamically concentrates computational resources on different parts of the input at different time steps. section 11.3.2
  • Improves on graph convolution that applies the same learned transformation to every neighbor, allowing relevant neighbors to receive different weights. section 11.3.2
  • Provides the foundation for Transformer processing, which addresses loss of early context in long sequential inputs. section 11.3.2
Figure 11.9 Graph convolutional network (GCN) vs. graph attention network (GAT)

Compare graph convolutional and graph attention networks to see how attention makes neighbor importance explicit. section 11.3.2

Pointer networks and convex hulls

A pointer network uses attention as a pointer that selects an element from a variable-sized input sequence for the output. For a convex hull, it can select points defining a polygon that encloses all input points while minimizing the boundary; an example output sequence is [1, 4, 2] from [1, 2, 3, 4]. section 11.3.3

How Optimization Algorithms: AI techniques for design, planning, and control problems covers it

How deep it goes
Defines selective focus, scores, and applications, but stops short of deriving the attention computation or training procedure.
Examples
Illustrates attention with long-sequence translation, graph neighbors, convex hull selection, and the output sequence [1, 4, 2].
What it assumes
Assumes familiarity with deep learning, graph convolution, graph nodes, and sequence-to-sequence processing.
What you can do after
Evaluate how attention prioritizes sequence segments or graph neighbors and understand its use in variable-sized output selection.
How it connects
Connects attention to graph convolutional networks, graph attention networks, Transformers, sequence-to-sequence models, and pointer networks.

Also explained in

Compare how 28 books explain attention →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Optimization Algorithms: AI techniques for design, planning, and control problems. The section links point to the parts of the book it draws on.