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 01 of 62 · Text in, prediction out

BPE vs WordPiece vs Unigram

Medium

How do BPE, WordPiece, and Unigram build a subword vocabulary, and how do they differ when encoding new text?

Know firstNothing. This is where the path starts.
Why this mattersTokenization sets sequence length, vocabulary matrix size, and how numbers, code, and multilingual text are split before the model ever sees an embedding.

1 · Start with the intuition

Every subword tokenizer tries to solve the same practical problem: give the model a fixed-size vocabulary (say 32K to 128K tokens) that keeps common words intact as single tokens while splitting rare or unfamiliar words into smaller reusable pieces. BPE and WordPiece build their vocabulary **bottom-up**, starting from individual characters/bytes and repeatedly merging pairs. Unigram works **top-down**, starting with a huge candidate list of substrings and pruning away the ones that hurt corpus likelihood the least.

2 · How the mechanism works

Mechanism step 1 of 3 · no question to answer

Start from a base alphabet

Initialize with raw UTF-8 bytes (byte-level BPE) or characters, after applying a regex pre-tokenizer that prevents merges across word/punctuation boundaries.

Next, we will look at: Grow bottom-up or prune top-down. Move on when this operation makes sense.

Visualizing the behavior

BPE: candidate pairs before the first merge

Derived

adjacent-pair count in the toy corpus

e s
9
s t
9
w e
8
l o
7
o w
7
w i
3
The most frequent pair wins, whatever its parts are. After e s → es, the pair es t also has count 9 and becomes est: the frequent suffix of newest and widest.

Same word, three conventions for marking word boundaries

Illustrative
WordPiece (BERT)
play##ingcontinue
SentencePiece
▁playword starting
Byte-level BPE
Ġplayspace byteing
WordPiece marks continuations; SentencePiece and GPT-2-style byte-level BPE mark the start of a word (whitespace is part of the token). Actual splits depend on the trained vocabulary.