Glossary

Attention Mechanism

A component that weights information from different input positions when building a representation.


“The telescope tracked the comet until it set.” You can spend an enjoyable minute arguing about what it refers to. An attention map offers one more clue to argue about. A bright square shows which earlier word received weight in one part of the model.

Attention compares queries and keys to determine how much to draw from corresponding values. Several heads can put weight in different places, and later layers transform what they receive. A weight describes one contribution to the computation. Explaining a final decision takes evidence about the rest of it too.

Read an attention map with a counterexample

Change “comet” to “satellite” and look again. Did the bright square move? Did the actual answer change? When one changes and the other stays put, you’ve discovered something a single screenshot could never show.

A caption that names the input, output, head and layer gives somebody else a fair chance to interpret the picture. Without those details, a striking square can easily acquire more explanatory power than the model assigned it. Original Transformer paper