Main Point
Normalize the supplied allowed-position scores, multiply the corresponding value vectors by those shares, and add their coordinates. A mask changes the allowed set and its normalization.
Key Points
- The supplied scores (2,1,0) have already been scaled; query/key projections are outside this calculation.
- A finite score of 0 contributes `exp(0)=1` before normalization.
- Computed attention shares and learned parameter matrices have different roles.
- Value coordinates are combined component by component; they are not output-token probabilities.
- State whether weights were rounded before calculating the mixture.
- Excluding a position changes both the allowed contributions and their denominator.
1. Record the inputs
This is a separate classroom construction, not a measured map from the previous package-prefix example.
| Source position | Already-scaled score | Supplied value |
|---|---|---|
| A | 2 | (2,0) |
| B | 1 | (0,2) |
| C | 0 | (1,1) |
Initially all 3 positions are allowed. The value vectors have 2 coordinates. That does not specify a query/key dimension or justify scaling the scores again.
2. Compute the normalized shares
Softmax uses `exp(score) / sum(exp(allowed scores))`. The constant e is approximately 2.718. Displaying exponentials to 3 decimal places gives:
| Position | Exponential, approximately | Share, to 3 decimal places |
|---|---|---|
| A | 7.389 | 0.665 |
| B | 2.718 | 0.245 |
| C | 1.000 | 0.090 |
The displayed denominator is about `7.389 + 2.718 + 1 = 11.107`. The shares sum to 1 under this rounding. Score 0 remains a finite allowed score, so C has a positive share.
3. Mix the values using a declared rounding convention
For the classroom working path, round the weights first to (0.665,0.245,0.090), then compute:
`coordinate 1 = 0.665×2 + 0.245×0 + 0.090×1 = 1.420`
`coordinate 2 = 0.665×0 + 0.245×2 + 0.090×1 = 0.580`
The displayed output is approximately `(1.420,0.580)` under that convention. Several positions contributed. The shares sum to 1; the resulting coordinates need not. Coordinate 1 exceeds 1 here, which is valid for this representation.
Optional precision note
Using the exponential expressions without rounding the weights first gives approximate shares `(0.6652409558,0.2447284711,0.0900305732)` and output `(1.4205124847,0.5794875153)`. Rounding that final output alone to 3 decimal places gives `(1.421,0.579)`. This differs slightly from rounding the shares before multiplication. Keep the classroom convention explicit rather than mixing the 2 paths.
4. Exclude C and recompute
Keep the original scores and values fixed but exclude C through the defined mask. C receives share 0. The allowed denominator becomes `exp(2)+exp(1)`, approximately 10.107. The new shares are approximately `(0.731,0.269,0)` when displayed to 3 decimal places.
Using those rounded shares, the output is:
`(0.731×2, 0.269×2) = (1.462,0.538)`.
The higher-precision output is approximately `(1.4621171573,0.5378828427)`. Deleting C's old contribution without renormalizing would implement a different operation. Here removing the balanced value (1,1) changes both output coordinates.
5. Keep the scale and meaning clear
Multiplying all supplied scores by 10 gives (20,10,0), concentrating the shares much more strongly on A. The historical Transformer scales query–key dot products before the normalization we have inspected. Our scores already include that step.
This operation combines source-position values. A later vocabulary distribution and token-selection rule have a different object and purpose. A computed attention share is also distinct from a learned parameter value saved in a checkpoint.
6. Closing
You can now reproduce normalization and coordinate mixing, identify rounding choices, and recompute a masked case. The result depends on the specified inputs and allowed set. The next lesson places this operation inside a transformer block with additional transformations and connections.
7. Learning Checks
Attempt the calculations before opening the explanations; use the separate worksheet for working space.
M14-L06-Q01
All 3 source positions A, B and C are allowed, with scores 0, 0 and 0. Their values remain A=(2,0), B=(0,2), C=(1,1). What are the attention shares and combined output? Does score 0 exclude a position?
Your shares, output and explanation: ____________________
Show explanation after your attempt
Each exponential is 1, so the shares are 1/3, 1/3 and 1/3. Coordinate addition gives (1,1): ((2+0+1)/3, (0+2+1)/3). All 3 positions contributed, although the output coincides with C’s value. A finite score of 0 did not exclude a position; the defined mask determines exclusion.
M14-L06-P01
In a separate example, positions D and E are allowed with scores 0 and 0. Their values are D=(4,0) and E=(0,2). Calculate the mixture. Then exclude E while keeping D allowed. What are the new shares and output?
Your 2 calculations: ____________________
Show explanation after your attempt
Initially the equal shares are (0.5,0.5), giving 0.5×(4,0)+0.5×(0,2)=(2,1). After excluding E, the allowed set contains only D: the shares are (1,0), and the output is (4,0). The output coordinates are representation values; normalization applies to the shares over source positions.
Sources
- Vaswani, Ashish, and colleagues. *Attention Is All You Need*. Original preprint 12 June 2017; v7, 2 August 2023. Primary paper, sections 3.2.1–3.2.3; version history. Retrieved 30 October 2026. Historical scaled-attention method and mask; all scores/value vectors used in this reading are supplied classroom inputs, not reported model measurements.