~/tedtes/writing/math-foundations-for-reasoning-models

~/writing/math-foundations-for-reasoning-models $ ls

Attention and Transformers

Attention as Learned Alignment

Attention can be understood as learned alignment between a current query and relevant source positions.

~/writing/math-foundations-for-reasoning-models $ cat topic.md

Attention As Learned Alignment

Definition

Attention can be viewed as learned alignment.

Alignment means connecting one representation with the other representations that should influence it.

Simple form:

current query aligns with relevant keys

The stronger the alignment, the larger the attention weight.

Attention aligns a current position with useful source positions.


Why Alignment Is A Useful View

Attention is easier to understand when seen as matching.

The model asks:

which sources match the current need?

The query represents the current need.

The keys represent matchable source descriptions.

The values provide the content.

Alignment is the connection between what is needed and what is available.


Learned, Not Manually Defined

The alignment is not manually programmed.

The model learns how to create queries, keys, and values.

Then attention computes the interaction.

learned representations -> attention scores -> learned behavior

Training shapes which alignments become useful.

Attention alignment is learned from data and objective pressure.


Soft Alignment

Attention usually creates soft alignment.

That means one position can align with multiple sources at once.

Example:

source A -> 0.5
source B -> 0.3
source C -> 0.2

This is different from choosing only one source.

Soft alignment allows several sources to contribute at the same time.


Alignment Is Not Explanation By Default

Attention weights can sometimes be inspected.

But they should not automatically be treated as a full explanation of model behavior.

A high weight means high influence in that attention operation.

It does not prove the model's final reason.

Learned alignment is part of the computation, not a complete human explanation.


Final Summary

  • Attention can be viewed as learned alignment.
  • Queries align with keys.
  • Values provide the information that gets mixed.
  • Alignment is learned, not manually assigned.
  • Attention is usually soft, allowing multiple sources to contribute.
  • Attention weights are influence signals, not guaranteed explanations.

~/writing/math-foundations-for-reasoning-models $ open

Continue the series.

Bridge to Embeddings