You are reading immutable version 28. The current guide may be newer.

Study the paper

Attention Is All You Need

Lessons, visuals, quizzes, flashcards, and resources—organized in teaching order.

All activities

Scaled Dot-Product Attention

Scaled Dot-Product Attention: step by step

Interactive study view

Scaled Dot-Product Attention: step by step

Illustrative teaching data

Follow the existing bounded walkthrough in its intended sequence.

Step 1 of 4

  1. Step 1

    Compute dot product of Q and K: 2*2 + 0*0 + 2*2 + 0*0 = 8

  2. Step 2

    Scale by square root of d_k (sqrt(4) = 2): 8 / 2 = 4

  3. Step 3

    Apply softmax to the scaled dot product: softmax([4]) = [1.0]

  4. Step 4

    Multiply by value V (5): 1.0 * 5 = 5