TensoriumInterview preparation
← Home

Core concepts · 62 topics

A guided path through the ideas behind modern LLMs.

Read the stages in order: how text becomes a prediction, what happens inside the Transformer block, how a model learns, then serving, scale, and post-training. Every topic names what to know first, then gives the intuition, the math with concrete numbers, the common misconception, and a self-check. Already comfortable with the basics? Switch to By area and jump straight to a topic.

New to machine learning? Start here instead.

These topics work best as a refresher; they assume ideas like probability and loss. Begin with three short beginner lessons (tokens, embeddings, next-token prediction), then the visual walkthrough for attention and the Transformer.

Finish line: You can explain how text becomes a prediction and what training does to improve that prediction.

Topic 06 of 62 · Inside the Transformer block

Self-attention and the √d scale

Medium

Follow one token: how do queries, keys, masking, and values produce a contextual representation?

Why this mattersEvery attention variant and kernel optimization starts from this equation. If you can trace the shapes and the √dₖ variance argument cold, GQA, FlashAttention, and KV caching become straightforward.

Video explanation

Inside Self-Attention

Open video in a new tab

Build it from one example

  1. 01

    0:00 · What problem are we solving?

    At “sat”, gather context from “The”, “cat”, and “sat” itself. We are updating a representation, not choosing the next word.

Keep the result above in view. Next, we will use it to work through: 0:35 · Why three vectors: Q, K, V?.

1 · The core intuition

Start with “The”, “cat”, “sat”. These are simplified position labels, not a claim about a particular tokenizer. Focus on “sat”: it needs a representation informed by the context so far. Causal self-attention combines information from earlier positions and the current position itself. The result is an updated vector, not a next-token prediction. Follow the same sequence as the video: project → compare → scale → mask → normalize → mix.

2 · How the mechanism works

Mechanism step 1 of 6 · no question to answer

Project

Stack input vectors into X and use three learned projections: Q = XW_Q, K = XW_K, V = XW_V.

Next, we will look at: Compare. Move on when this operation makes sense.

Visualizing the behavior

The video’s “sat” query: three scores become three weights

Illustrative

softmax([1, 0, 1] / √2)

The
0.401
cat
0.198
sat
0.401
All three positions are allowed for “sat”. The weights sum to one and mix the value vectors [1, 0], [0, 2], and [1, 1] to produce approximately [0.802, 0.797]. These illustrative numbers are not from a trained model; attention weights are not next-word probabilities.