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 38 of 62 · Training at scale

Tensor vs pipeline parallelism

Hard

What do tensor parallelism and pipeline parallelism split, and how do their communication costs differ?

Why this mattersTensor parallelism communicates inside every layer while pipeline parallelism communicates between stages—matching each to the right interconnect is the core of cluster layout.

1 · Start with the intuition

When a model is too large to fit on a single GPU, you can split it in two ways: Tensor Parallelism (TP) slices the weight matrices inside each individual layer so multiple GPUs cooperate on every single matrix multiply, whereas Pipeline Parallelism (PP) keeps each layer intact and assigns consecutive groups of layers (stages) to different GPUs like an assembly line. Because TP synchronizes large activation tensors twice inside every layer on the critical path, it requires ultra-fast intra-node links (NVLink); because PP only sends activations across the boundary between stages, it can cross slower inter-node links, but introduces idle “bubble” time while stages wait for the pipeline to fill and drain.

2 · How the mechanism works

Mechanism step 1 of 3 · no question to answer

TP: Column + Row sharding

Shard the first linear projection by columns and the second by rows so only one all-reduce (or reduce-scatter + all-gather) is needed per subblock.

Next, we will look at: PP: Partition depth into p stages. Move on when this operation makes sense.

Visualizing the behavior

4 stages × 8 microbatches (forward only): 8 of 11 slots busy per stage

Derived
Stage 1
1
2
3
4
5
6
7
8
Stage 2
1
2
3
4
5
6
7
8
Stage 3
1
2
3
4
5
6
7
8
Stage 4
1
2
3
4
5
6
7
8
03811time slots
The empty triangles at the start (fill) and end (drain) are the pipeline bubble: (p − 1) slots per stage. More microbatches spread that fixed cost over more useful work.

Utilization m / (m + p − 1) for p = 4

Derived
00.250.50.7511481632microbatches mutilization8/11 ≈ 73%32/35 ≈ 91%
  • ideal balanced pipeline
Diminishing returns: going from 8 to 32 microbatches gains 18 points, but each microbatch gets smaller (at a fixed global batch), which can lower kernel efficiency.