Deep-dive map
Deepen: a map, not a list
The Deepen area collects treatments that go beyond the mental model needed for the core learning route. It is neither a second mandatory sequence nor an unstructured repository of specialist topics.
Each entry answers a more specific question: why a mechanism works, under which conditions it remains valid, which trade-offs it introduces, or how to investigate it rigorously. Pages are grouped by intellectual problem, not alphabetically. A page may have cross-links, but retains one primary category to keep its entry point stable.
Another way in: the 2026 Advent Calendar. Its 24 doors highlight independent lessons from this collection. During December, the calendar presents them as stories; throughout the year, the pages remain available here under their thematic domains. A door creates neither a prerequisite nor a parallel curriculum.
Choose by question
| Your question | Domain |
|---|---|
| How do language models represent, predict, and generate text? | Language modeling |
| How does a specialized architecture change information flow? | Attention, position, and architectures |
| How do corpora and tokenizers shape model inputs? | Text, corpora, and tokenization |
| Which mathematical tools help analyze representations? | Mathematical tools and geometry |
| How are probabilities, objectives, and optimization connected? | Probabilistic formalization and the training chain |
| How are outputs produced, and what resources do they require? | Inference and efficiency |
| What can evidence tell us about scale and model capabilities? | Scale and research questions |
Language modeling
This collection brings together deep dives into language models: text representation, architectures, probabilistic formalization, learning, inference, and research findings. It includes two kinds of pages: technical companions to selected calendar stories, and standalone investigations whose question, depth, or empirical scope does not fit a fifteen-minute story.
The calendar keeps one central, self-contained story; it should not absorb long derivations, research comparisons, or reference dossiers. Those materials remain available here, with a link from the story when they extend it. The categories below are discovery areas, not a mandatory reading order.
Attention, position, and architectures
Guiding question: which variants change information flow or a model’s computational structure?
Start here: begin with scaled dot-product attention; the variants and derivations below are optional extensions.
Related core lesson: Transformer architectures: encoder, encoder–decoder, and decoder — compares the three main configurations and their information flow; this Understand lesson is not a specialist deep dive.
- Why scale attention scores? — dot-product variance under Gaussian assumptions, softmax concentration, and the limits of the \(\sqrt{d_k}\) factor.
- Contextualized representations: dependencies across positions and layers — formalizing accessible context, masks, and hidden-state evolution.
- Q/K/V: mathematical formulation and variants — per-position equations, batched dimensions, compatibility geometry, gradient paths, and head/projection sharing.
- Cross-attention — information transfer between two sequences, notably in encoder–decoder and multimodal architectures.
- Multimodal architectures: understanding and generation — distinguish input pathways, projectors, decoders, and modality-specific generation mechanisms.
- Sinusoidal positional encodings — logarithmic frequencies, wavelengths, derivation of the linear-shift property, implementation, and extrapolation limits.
- RoPE: rotary positional embeddings — rotation geometry, relative-position dependence, and extrapolation limits.
- Hybrid architectures: Nemotron 3 and 3.5 — recurrence, attention, experts, and multi-token prediction in a concrete case.
- Next-Concept Modeling — non-autoregressive generation through discrete-code levels, compared with GPT and diffusion models.
Specialized variants do not enter the core route merely because a recent model uses them. Their necessity for general understanding must be demonstrated.
Resources focused on sinusoidal positional encodings
- Vaswani et al. (2017), section 3.5 — primary source for the formula, frequencies, and mathematical motivation.
- Jay Alammar — The Illustrated Transformer — visualization of positional signals; distinguish the initial concatenated illustration from the paper’s interleaved formula.
- Harvard NLP — The Annotated Transformer — annotated PyTorch code connecting the formula to its implementation.
- Stanford — Transformers for Signal Prediction — signal-oriented treatment of logarithmic frequencies and wavelengths.
Complementary resources for understanding Transformers
These resources offer visual explanations, the original architectural formulation, or implementation examples. They complement LLM Lab’s conceptual lessons; they are neither a parallel learning path nor prerequisites.
Building intuition with visualizations
- 3Blue1Brown — Transformers, the tech behind LLMs: an animated explanation of the system, from embeddings through Transformer blocks to logits and generation.
- 3Blue1Brown — Attention in transformers, step by step: a focused visual explanation of attention, masking, multiple heads, and cross-attention.
- Jay Alammar — The Illustrated Transformer: a step-by-step visual explanation of the original encoder–decoder Transformer. It illuminates the 2017 design but does not represent all modern GPTs.
- Jay Alammar — The Illustrated GPT-2: a visual presentation more directly related to decoder-only GPT-style models.
Connecting equations to an implementation
- Vaswani et al. (2017), Attention Is All You Need: the primary paper describing the original Transformer formulation. It presents an encoder–decoder architecture; GPT is a later decoder-only family.
- Harvard NLP — The Annotated Transformer: an executable, annotated implementation tied to the original paper. It helps connect equations to code, but its architecture and training choices do not define all modern LLMs.
- PyTorch — scaled dot-product attention: the API contract of one operation, not a full explanation or implementation of a Transformer.
Optional books and courses
- Sebastian Raschka — Build a Large Language Model (From Scratch) and the source repository: a book with accompanying code covering data, attention, GPT implementation, pretraining, and fine-tuning. Use it as a substantial reference, not as the mandatory order of this site.
- Raschka — reading recommendations: advice on first building a big-picture understanding, then reading alongside code.
- DeepLearning.AI — How Transformer LLMs Work: a compact video course by Jay Alammar and Maarten Grootendorst covering tokenization, embeddings, attention, modern block components, and selected efficiency variants. Course access and terms may change.
These resources are complementary, not interchangeable: visualizations build intuition, the primary paper records the original formulation, annotated code exposes implementation choices, and API documentation specifies one library contract.
Text, corpora, and tokenization
Guiding question: how does a character string become a discrete sequence compatible with a model, and how should representation choices be evaluated?
Entry point: Tokenization and tokenizers — a domain map connecting Unicode representation, segmentation mechanisms, design, evaluation, and data preparation.
The main learning path starts with From text to tokens. The map organizes optional deep dives and helps choose one according to the question. Corpus preparation remains in Build; it is linked from this map as a practical continuation, not as a Deepen child.
Language statistics
- Zipf’s law and lexical frequency statistics — the calendar story: build a corpus, read a rank–frequency relation, and understand its limits.
- Beyond Zipf’s law: data, uses, and limits — its companion deep dive: Zipf–Mandelbrot, cross-linguistic comparisons, history, applications, and interpretive caveats.
Tokenization and evaluation
- Unicode, UTF-8, and text normalization — code points, bytes, and normalization before tokenization.
- Tokenization strategies — BPE, WordPiece, Unigram, and encoding conventions.
- Designing and evaluating a tokenizer — vocabulary, sequence-length, and system-cost trade-offs.
- Evaluating tokenizers: costs, performance, and multilingual equity — empirical findings, metrics, cross-language comparisons, and protocol limitations.
These routes are reading suggestions, not prerequisites. Mechanism, design, and evaluation pages have distinct scopes; their links do not imply that one metric or strategy is sufficient to select a tokenizer.
Probabilistic formalization and the training chain
Guiding question: how are the predicted distribution, observed likelihood, objective function, and optimization connected?
Start here: begin with likelihood and loss; the deep dives connect these objects without conflating them.
- Self-information and surprisal — event information, conditional surprisal, and the chain rule; distinguish an observed score from predictive entropy.
- Mathematical formalization of language modeling — autoregressive factorization, cross-entropy, and KL divergence.
- The mathematical chain of LLM training — from logits to gradients, distinguishing the mathematical objects involved.
- Score centering in off-policy RL — correcting policy-gradient drift when sampler and trainer distributions differ.
Related core lesson: From a base model to an assistant: post-training — an Understand lesson on parameter adaptation, distinct from the mathematical deep dives above.
The core route’s canonical pages remain responsible for local definitions of likelihood, entropy, cross-entropy, loss, and gradients. These deep dives connect or generalize those concepts without replacing them.
Inference and efficiency
Guiding question: how does a model use context, select outputs, and consume resources?
Start here: begin with autoregressive generation; explore advanced strategies and costs only when your question calls for them.
- Advanced decoding strategies — distribution transformations and sequence search.
- Computational complexity and parallelism in LLMs — compute, memory, and parallelism in training, prefill, and decoding.
- RAG, memory, and context transmission — trace external information through to model use.
- Document retrieval: indexing, retrieval, and ranking — compare retriever families, visual search, and ranking methods.
The core route introduces autoregressive generation and its minimum operations. This category covers strategies and costs not needed for that first understanding.
Scale and research questions
Guiding question: which empirical regularities and capability claims are supported by evidence?
Start here: begin with the LLM overview and its discussion of limitations before examining research results and empirical scaling laws.
- From GPT-2 to contemporary LLM systems — a cross-cutting synthesis from scale and post-training to reasoning and tool-using systems.
- Scaling laws: parameters, data, and compute — empirical relationships between training resources and loss, and limits to extrapolation.
- Emergence — gradual improvement, metric-induced thresholds, and genuine discontinuities.
- From shared observations to shared representations: JEPA and the Platonic Representation Hypothesis — positive-pair graphs, good versus bad views, a conditional convergence theorem, and a qualified reading of cross-modal alignment evidence.
Always distinguish observations, explanatory hypotheses, and conclusions that depend on the protocol.
Mathematical tools and geometry
Guiding question: which mathematical operations and properties help analyze representations and computations?
Start here: begin with embedding space; the pages below extend that first geometric picture to other objects and uses.
- Specialized deep dive: embeddings and vector representations — a self-contained map of families, objectives, geometry, evaluation, and uses beyond LLMs.
- Tensors — dimensions, operations, and conventions.
- Cosine similarity — angular measure and interpretation limits.
- Embedding linearity — assumptions and empirical evidence behind linear relations in representation spaces.
- Kolmogorov complexity, AIXI, and computational limits — descriptive complexity, universal induction, and decision-making under resource bounds.
Historical perspective: from static vectors to contextualized representations
Early neural distributed text representations, followed by methods such as Word2Vec, learned vectors associated with words or lexical units. These so-called static vectors did not change with the sentence. Contextualized models later produced different states depending on context, while retaining an initial embedding table for input IDs. This transition is a useful historical marker, not a single linear progression or the replacement of every earlier method.
- Bengio et al. (2003), A Neural Probabilistic Language Model — a neural language model with learned distributed representations.
- Mikolov et al. (2013), Efficient Estimation of Word Representations in Vector Space — the CBOW and Skip-gram architectures associated with Word2Vec.
- Peters et al. (2018), Deep Contextualized Word Representations — ELMo and context-dependent representations.
What the historical comparison does—and does not—tell us
Word2Vec learns vectors associated with vocabulary words. CBOW predicts a target word from its context; Skip-gram predicts context words from a target word. Once trained, a given word has a static vector: a word’s vector does not change from one sentence to another. In the Monty Python exchange, the word “the” has the same static vector in “the Romans” and “the sanitation”. This limitation helped motivate contextualized representations, but it does not mean that Transformers have done away with input embedding tables: those tables still provide the initial vectors associated with token IDs.
The Monty Python exchange provides a familiar example: if the two occurrences of “the” are encoded with the same ID, they retrieve the same initial row; subsequent context processing can produce different hidden states. The exact segmentation and ID remain specific to the tokenizer. This is a conceptual example, not a claim about universal tokenization.
Representation geometry: interpretation caveats
A vector of dimension \(d\) can be interpreted as a point in vector space, but two-dimensional visualizations are projections: they generally preserve only some distances and neighbourhoods. Visually separated groups in a 2D plot therefore prove neither robust separation in the original space nor classification ability on unseen data.
Closeness depends on the object being compared (initial embedding, a contextualized state at a particular layer and position, or a sentence embedding), the model, layer, corpus, any pooling method, and the chosen metric.
It is also important to distinguish three levels: a token embedding is the initial vector retrieved from the table; a contextualized state is produced by the network’s layers for a particular position; a sentence or document embedding represents a longer text, using a model-specific method (for example, pooling or a dedicated head). These objects have different uses and properties. A method validated for comparing sentence embeddings does not automatically apply to a language model’s internal hidden states. High cosine similarity does not imply semantic equivalence: negation or a logical relation can change meaning while leaving much of the vocabulary unchanged.
- Ethayarajh (2019), How Contextual are Contextualized Word Representations? — analysis of how contextual representations vary across layers.
- Li et al. (2020), On the Sentence Embeddings from Pre-trained Language Models — study of properties and limitations of sentence embeddings from pretrained models.
- Steck, Ekanadham & Kallus (2024), Is Cosine-Similarity of Embeddings Really About Similarity? — challenges a naïve interpretation of cosine similarity.
- Sentence Transformers — Semantic Textual Similarity — an example of a task and protocol designed for comparing sentence embeddings.
For measurement tools, see cosine similarity; for geometric relations and their empirical evidence, see embedding linearity. For a visual introduction to a GPT input pipeline, also see The Illustrated GPT-2.
These pages provide analytical tools; they are not a prerequisite mathematics course to complete before building a small GPT.
Classifying a new topic
Classify an entry by its primary learning objective, not by a keyword in its title.
- Conceptual necessity: is the mechanism essential to the first mental model? If so, put only the minimum accurate explanation in Understand and reserve derivations or variants for Deepen. Otherwise, keep it here.
- Question addressed: architecture/flow, text/tokenization, mathematical tool, probabilistic foundation/training, inference/efficiency, or scale/research.
- Content ownership: extend a canonical page if the material belongs to its scope. Create a page only for a durable, distinct question.
- Relation semantics: parent/child for generalization or decomposition; related for a cross-topic connection; suggested_route for a recommended reading order. Not every dependency is hierarchical.
- Evidence level: state assumptions and conventions in derivations; document data, metrics, and protocols for empirical comparisons; separate general principles from case-specific choices.
Maintenance rule
Every new advanced page must be added simultaneously to this map, FR/EN navigation, the Quarto render list, the editorial inventory, and the metadata graph. Its counterpart must preserve the same scope, level, and relations. Create a category when it groups multiple pages or represents a durable research axis; avoid single-entry categories unless justified.
This map is a discovery taxonomy, not a new mandatory learning route. Category order does not create prerequisites.