Positional encoding uses sine and cosine, and attention uses softmax. This lesson groups those named components and contrasts them with exact wiring.

highlighted = computed this step

Positional encoding

Positional encoding uses sine and cosine, so it is a named component. The flowchart shows the component without pinning a float value.

posenc=named (sin,cos)\text{posenc}=\text{named }(\sin,\cos)
Named componentsPositional encoding and attention are named boundary nodes.Named componentsPositional encoding and attention are named boundary nodes.transformer block wiringwiring is exact; named components carry no numeric outputinput hexactdisplayed vector+ positional encodingnamed (sin/cos)attentionnamed (softmax)residual addexactvector additionlayernormnamed (√)MLP-ReLUexactrational ReLU wiringresidual addexactvector additionlayernormnamed (√)outputexactresidual example: h=(2,3) + s=(1,-1) = (3,2)

Attention's softmax

Attention includes the softmax boundary from the previous book. Its wiring is shown, while the softmax weights remain named.

attention=named (softmax)\text{attention}=\text{named }(\operatorname{softmax})
Named componentsPositional encoding and attention are named boundary nodes.Named componentsPositional encoding and attention are named boundary nodes.transformer block wiringwiring is exact; named components carry no numeric outputinput hexactdisplayed vector+ positional encodingnamed (sin/cos)attentionnamed (softmax)residual addexactvector additionlayernormnamed (√)MLP-ReLUexactrational ReLU wiringresidual addexactvector additionlayernormnamed (√)outputexactresidual example: h=(2,3) + s=(1,-1) = (3,2)

Summary

Positional encoding, attention softmax, and layernorm are the named components. Residual adds and the MLP-ReLU box stay in the exact register.

named components plus exact wiring\text{named components plus exact wiring}
Named componentsPositional encoding and attention are named boundary nodes.Named componentsPositional encoding and attention are named boundary nodes.transformer block wiringwiring is exact; named components carry no numeric outputinput hexactdisplayed vector+ positional encodingnamed (sin/cos)attentionnamed (softmax)residual addexactvector additionlayernormnamed (√)MLP-ReLUexactrational ReLU wiringresidual addexactvector additionlayernormnamed (√)outputexactresidual example: h=(2,3) + s=(1,-1) = (3,2)