KatInterview

From Raw Text to Tokens: Subword Tokenizers and Modern LLM Blocks

Machine LearningModel answer
MediumModel answerMachine Learningtokenizationtransformerssentencepiece

Last updated

Describe how subword tokenizers such as SentencePiece work, what a Transformer block contains, and why recent LLMs replaced parts of the original design with RMSNorm, RoPE, and MoE.

You are asked to walk through the path from raw text to a modern large language model, covering both the input side and the network itself.

Answer the following:

  1. SentencePiece. What is it, and how does it work? Describe what makes it different from tokenizers that split on whitespace first, and name the training algorithms it supports.
  2. Tokenizer choices. Which tokenizers do BERT and typical Transformer-based language models use, and what motivates those choices? Discuss vocabulary size as a trade-off.
  3. Block anatomy. List the main components inside a Transformer block and explain the role of each.
  4. Architecture comparison. Contrast the original 2017 Transformer with LLaMA-style and Qwen-style decoder-only models. Cover normalization, positional information, feed-forward design, attention variants, and sparsity.
  5. Design trade-offs. For Mixture-of-Experts (MoE), RMSNorm, and Rotary Position Embeddings (RoPE), explain the benefit and the cost of each.

A strong answer is structured, uses concrete details (formulas, typical vocabulary sizes, example models), and states a trade-off with every design choice.

Hints

Hint 1

Start from the problem each component solves: word-level vocabularies have out-of-vocabulary words, character-level sequences are too long, and subwords sit between the two.

Hint 2

For the block, separate what mixes information across tokens (attention) from what transforms each token independently (the feed-forward network), then cover what keeps training stable (residuals and normalization).

Hint 3

For each modern change (pre-norm, RMSNorm, RoPE, SwiGLU, grouped-query attention, MoE), state what it replaced, what it improves, and what it costs, for example compute versus memory for MoE.