Modern Deep Learning Foundations
Learn by predicting, running mathematically grounded experiments, explaining evidence, and exporting an inspectable mastery artifact.
- Laboratories
- 6
- Guided time
- 4h 20m
- Mastery artifacts
- 6
Attention constructs a new representation for every token
Each token is projected into Query, Key, and Value vectors. Query-Key dot products create compatibility scores, scaling controls their magnitude, and softmax converts them into attention weights.
A causal mask removes future positions before softmax. The resulting weights combine Value vectors into a context vector that represents the selected token in its current sequence.
Lesson 11 - Self-Attention and the Transformer Principle
Printed pages 72-76; PDF pages 74-78.
- Query, Key, and Value Projections printed pp. 72-73 / PDF pp. 74-75 projection paragraphs; Equations 11.1-11.2
- Scaled Scores, Masking, and Softmax printed pp. 73-74 / PDF pp. 75-76 attention normalization; Equations 11.3-11.5
- Context Vector and Transformer Block printed pp. 74-76 / PDF pp. 76-78 weighted sum and block composition; Equation 11.6
Evidence and provenance
Token IDs, embeddings, Q/K/V projections, scores, softmax, and context vectors are computed in the browser.
Masked future positions are removed before softmax and therefore receive zero probability.
The compact dimensions make every number inspectable; they are not claims about a production language model.
A high weight shows contribution in this forward pass, not human-like reasoning or causal importance.
Run, inspect, and compare
Follow the three guided moves above. Change one variable at a time so every visual change has a clear cause.
Compare runs instead of trusting one result
Explain what happened, then transfer it
Follow the selected token through Q/K/V, scaled scores, masking, softmax, and the context vector using at least one displayed number.
Use at least one value or visible change from the experiment.Explain how the computation would differ for bidirectional attention or for a longer sequence with several heads.
Name the new context and the design choice you would make.- Distinguishes causal from bidirectional attention
- Explains Q-K scoring and scaling
- Explains softmax and the weighted Value sum
- Addresses sequence length or multiple heads
By the end of this lesson, you will be able to:
- Follow tokens through embedding and Query, Key, and Value projections.
- Explain scaled dot-product attention and why a causal mask blocks future tokens.
- Read attention weights and construct the weighted context vector for a selected token.
Explains shift from RNN to self-attention. Introduces Query, Key, Value, and weighted sums. Outlines Transformer encoder-decoder and multi-head attention.
Leave with inspectable evidence, not a completion click
Your artifact combines the prerequisite check, prediction, experiment configuration, displayed evidence, explanation, transfer rubric, and confidence change.
Retrieve the concept after time has passed
Complete the artifact to schedule a 24-hour retrieval prompt and a seven-day transfer revisit.
Help evaluate whether the laboratory teaches the concept
No name, email address, free text, or IP address is retained in the learning record.