Week 1

Stage 10 · Weeks 72–77 · deep-learning

Transformers + LLM Foundations

Understand modern language models

Locked

Scored stage progress

0%

Practice and implementation

0/7

Exercises + milestone requirements owned by this stage

Evidence and gate

0 · 0/9

Artifacts · checked requirements

Why it matters

Purpose of this stage

Understand modern language models

Subjects

2 subjects · 27 canonical topics

Each subject states what you should be able to do, an order to work through it in, what to watch for, and the questions a reviewer should be able to ask you at the end. None of it is tracked or scored.

How to work through this subject

An order that works, not a checklist. Nothing here is tracked — the steps sequence this subject’s own topics and add none.

  1. Tokenize several strings and look at the actual token boundaries, including for numbers and rare words.
  2. Read what the vocabulary is and why a fixed one forces subword splitting.
  3. Follow a token through its embedding and the addition of positional information.
  4. Work through attention as query, key and value on a three-token example, by hand.
  5. Assemble the pieces into one transformer block and say what each sublayer contributes.
  6. Read what causal masking prevents, and what encoder and decoder mean in this setting.
  7. Describe pretraining as next-token prediction, then follow inference and sampling out the other end.
  8. Change temperature and observe how the output distribution behaves, including at zero.
  9. Finish by reading what fine-tuning, LoRA and quantization each change, and what none of them change.

What to watch for

  • Tokenization explains a surprising number of model failures. Look at actual token boundaries before blaming the model.
  • Attention is a weighted lookup: query against keys, retrieve values. Everything else is plumbing around that.
  • Positional information exists because attention alone is order-blind. Remove it and the sentence becomes a bag of words.
  • The model predicts a distribution over the next token, every time. Sampling is a separate decision applied to that distribution.
  • The context window is a hard limit, not a soft preference. Decide what gets dropped before the model decides for you.
  • Fine-tuning changes weights; prompting changes inputs. LoRA changes a small number of weights; quantization changes their precision. None of them add knowledge the data never contained.

Curriculum topics

language modeling
Learning to predict text, which turns out to be enough to learn a great deal about language.
tokens
The chunks text is split into before a model sees it. A token is often part of a word, not a whole one.
tokenization
The process of converting text into tokens. Inspecting real token boundaries explains many model failures.
vocabulary
The fixed set of tokens a model knows, fixed at training time.
embeddings
Learned dense vectors representing discrete items, placing similar items near each other.
positional information
How the model is told the order of tokens, since attention alone has no sense of position.
attention
A weighted lookup: each token gathers information from other tokens according to how relevant they are.
query/key/value intuition
The query asks, keys advertise what each token offers, values carry the content retrieved.
self-attention
Attention where tokens attend to other tokens in the same sequence.
transformer block
The repeating unit: attention followed by a feed-forward layer, with normalisation and residual connections.
encoder/decoder concepts
Encoders read a whole input at once; decoders generate one token at a time. Models use one or both.
causal language model
A model that may only attend to earlier tokens, so it can generate text left to right.
pretraining
The large-scale initial training on generic text, before any task-specific adaptation.
next-token prediction
The pretraining objective: given what came before, predict what comes next.
context window
The maximum number of tokens the model can consider at once. Exceeding it means something must be dropped.
inference
Running a trained model to produce output, as opposed to training it.
sampling
How the next token is chosen from the predicted distribution.
temperature intuition
A knob on randomness in sampling. Zero is deterministic; higher values produce more varied output.
fine-tuning
Continuing training on your own data to adapt a pretrained model to a specific task.
LoRA concept
Fine-tuning by training a small number of added parameters instead of all of them, cutting cost dramatically.
quantization concept
Storing weights at lower numeric precision to reduce memory and speed up inference, trading a little quality.

Resources for this subject

  • PRIMARYHugging Face LLM Course Hugging Face
    The teaching path for this stage: tokenization, attention, transformer internals and the library that exposes them. Chapters 1 to 3 cover what the gate asks you to explain.
    Open
Need another explanation?4 more references
  • REFERENCEMLCC — LLM module Google
    A short, conceptual account of language models and how they are trained. Useful as a second explanation of tokens, context and fine-tuning when the primary course moves quickly.
    Open
  • REFERENCENeural Networks: Zero to Hero Andrej Karpathy
    Builds autograd and then a transformer from scratch. The single best antidote to explaining transformers as 'magic', which Stage 10's gate forbids.
    Open
  • REFERENCEThe Illustrated Transformer Jay Alammar
    The clearest visual explanation of query/key/value and multi-head attention. Read alongside the HF course chapter on attention.
    Open
  • OPTIONALAttention Is All You Need Vaswani et al., 2017
    The original paper. The roadmap targets paper-reading capability, and this is the right first paper to read properly.
    Open

A reviewer should be able to answer these

Answer from memory, out loud, before moving on. These are not tracked and do not affect the gate — they tell you whether you actually understand this subject.

  1. What is a token, and why is it not the same as a word?
  2. What do query, key and value mean in attention, and what is being computed?
  3. What does 'causal' mean in a causal language model, and what does it prevent?
  4. What does the model actually predict at each step during pretraining?
  5. What does the context window limit, and what happens when you exceed it?
  6. What does temperature change about sampling, and when would you set it to zero?
  7. What is fine-tuning changing that prompting cannot?
  8. Why is positional information needed at all, given that attention sees every token?
  9. What does quantization trade away, and when is that trade acceptable?

Exercises

Demonstrated practice · 35% base weight
This stage defines implementation through its owned project milestone rather than a separate exercise list.

Stage project

Only milestones owned by Stage 10 count here

P7 · Stage project

Transformer Experiment

Project detail

Compare classical vs pretrained transformer approach.

P7.M1 · Classical vs transformer comparison

Resources

0% progress weight

Resource status is a convenience marker only. It cannot change competencies, gates, or stage completion — in any tier below.

Start here

PRIMARY

Hugging Face LLM Course

Hugging Face

The teaching path for this stage: tokenization, attention, transformer internals and the library that exposes them. Chapters 1 to 3 cover what the gate asks you to explain.

References

1 available
  • REFERENCEMLCC — LLM module GoogleA short, conceptual account of language models and how they are trained. Useful as a second explanation of tokens, context and fine-tuning when the primary course moves quickly.Open
Need another explanation?5 supplementary resources · not part of the canonical library

Use these for a demonstrated gap, not as a parallel course. They are authored additions and can never be the primary resource for a subject.

  • REFERENCENeural Networks: Zero to Hero Andrej KarpathyBuilds autograd and then a transformer from scratch. The single best antidote to explaining transformers as 'magic', which Stage 10's gate forbids.Open
  • REFERENCEThe Illustrated Transformer Jay AlammarThe clearest visual explanation of query/key/value and multi-head attention. Read alongside the HF course chapter on attention.Open
  • REFERENCETransformers documentation Hugging FaceReference for loading models and tokenizers directly rather than through a pipeline — which the stage explicitly asks you to do.Open
  • REFERENCETokenizers and Datasets documentation Hugging FaceThe two libraries the stage names alongside Transformers. Inspecting real token boundaries explains a surprising share of model failures.Open Open
  • OPTIONALAttention Is All You Need Vaswani et al., 2017The original paper. The roadmap targets paper-reading capability, and this is the right first paper to read properly.Open

Stage gate

Readiness assessment

Not ready

Stage-specific requirements

Answer each prompt without notes. Expand a question only when you are ready to check your answer.
0/1
  • Explain transformers without saying "magic" or hiding behind an API
    Answer

    Text is split into tokens from a fixed vocabulary and each token becomes a vector, with positional information added because attention alone is order-blind. Attention computes a query for each token, matches it against every key, and returns a weighted combination of the values, so each position gathers what it needs from the others. Stacked blocks repeat this with feed-forward layers between, and the output is a probability distribution over the next token. Causal masking prevents any position from attending to later ones, and sampling from that distribution is what produces text.

Universal requirements

The eight conditions 01_LEARNING_RULES.md applies to every stage. Expand one to see what it actually asks for.
0/8
  • Core concepts can be explained from memory.
    What this asks for

    Every subject in this stage has review questions. The condition is met when you can answer them out loud, without notes and without looking anything up, in your own words rather than a recited definition. An explanation you can only give with the material open is recognition, not recall.

  • Required exercises are complete.
    What this asks for

    Complete means each exercise satisfies its stated requirements and its done-when criteria, not that you attempted it. Where an exercise says you should be able to explain or defend something, that explanation is part of completing it. A stage whose source lists no exercises meets this through its owned project milestone instead.

  • Stage project works.
    What this asks for

    Works means it runs end to end from a clean checkout, on the inputs it was built for, with the failure cases it claims to handle actually handled. It is not a notebook that produced a result once. Someone else following your README should be able to run it without asking you a question.

  • Tests or verification exist.
    What this asks for

    There is something that would fail if the behaviour regressed, and you have watched it fail. That can be automated tests or a written verification procedure with recorded results, depending on what the stage produces. A test that has only ever passed is evidence of nothing.

  • README explains decisions.
    What this asks for

    The README says what the project is, how to install, run and test it, and why it is built the way it is: the choices you made, the alternatives you rejected, and what you deliberately left out. A list of commands with no reasoning does not meet this condition.

  • You can reproduce the core implementation without copying.
    What this asks for

    Delete the central piece and write it again from an empty file, without your previous version, a tutorial, or generated code in front of you. It does not have to be identical, it has to work and you have to be able to explain every line. This is the condition that separates having finished from being able.

  • You pass the stage self-assessment at >= 80%.
    What this asks for

    Record a gate exam and score yourself honestly against the dimensions the roadmap defines: recall, implementation, debugging, testing and design judgment. Elapsed time, hours watched and completed resources count for nothing here. Checking the boxes without a recorded exam does not open the gate.

  • Claude/ChatGPT reviewer finds no foundational blocker.
    What this asks for

    Ask an AI reviewer to examine the work against this stage's concepts and report foundational misunderstandings, not style. A foundational blocker is a misconception that later stages would build on, such as leakage, a broken abstraction, or an explanation that is confidently wrong. Nothing in that class may remain open when you pass.

Recorded exam

No exam recorded. Checking every requirement is not sufficient.

Evidence

Artifacts linked to this stage

Add evidence
No stage evidence yet.