Skip to main content

One Afternoon Under the Hood

BuilderKnow the basics and start building

one afternoon

Read twelve topics across foundations, training, architecture and generation. Focus on explaining behavior and limits; revisit details when needed.

Checkpoint
  1. Walk through how a Transformer handles a sentence: split, embed, attend, generate one token at a time
  2. Explain the three training stages of a chat model and what each stage solves
  3. Say why a model fabricates confidently, and why bigger context costs more
  4. Why do attention compute and memory grow quickly with context length?
  5. After embedding, why do similar words end up with nearby vectors?
  6. Why does autoregressive generation produce one token at a time instead of the whole passage at once?
  7. What can scaling laws predict, and what can they not?
  8. What data do pretraining and fine-tuning each need, and what do they solve?
  9. Does doubling the context window double model capability?
  10. In one sentence, relate hallucination to the generation objective, and give one check.

Try answering before opening the reference. Revisit the relevant step above if needed. These answers highlight key ideas; you do not need to repeat the wording.

Question 1 · Reference answer

For an autoregressive language model: tokenize, embed, apply layers with attention, obtain a next-token distribution, select a token and repeat. This sketch does not describe every Transformer task.

Revisit this concept

Question 2 · Reference answer

A common chat-model recipe uses pretraining, supervised fine-tuning and preference optimization: general patterns, task/response formats, and preferences or constraints. Actual recipes can merge, repeat or omit stages.

Revisit this concept

Question 3 · Reference answer

The generation objective does not guarantee factual support for every claim. More context adds computation and cache use. Distinguish input length, output length and runtime; a long window does not guarantee reliability.

Revisit this concept

Question 4 · Reference answer

Standard self-attention compares every token with every other token; doubling length roughly squares the number of pairs, while the KV cache grows linearly. Sparse, chunked or linear attention trades approximation for implementation complexity.

Revisit this concept

Question 5 · Reference answer

Training gives nearby representations to words that appear in similar contexts, so similarity reflects usage rather than dictionary meaning. Polysemy can still collide; vector distance alone does not settle meaning.

Revisit this concept

Question 6 · Reference answer

The model is trained to predict the next token given prior text; the new token is fed back before the next step. Whole-passage output needs a different non-autoregressive model, with different quality and speed trade-offs.

Revisit this concept

Question 7 · Reference answer

Given data, parameters and compute, they predict loss trends and diminishing returns; they do not guarantee task quality, factual correctness or the ceiling set by data quality. They are extrapolation tools, not product promises.

Revisit this concept

Question 8 · Reference answer

Pretraining learns general patterns from large unlabelled text; fine-tuning adjusts tasks and response formats with smaller, high-quality labelled or instruction data. Fine-tuning cannot replace pretraining or guarantee updated facts.

Revisit this concept

Question 9 · Reference answer

No. The window only sets how many tokens fit; effective use depends on attention, position extrapolation, where evidence sits and training length. Longer windows also add cost and latency.

Revisit this concept

Question 10 · Reference answer

The generation objective optimises next-token likelihood, not truth; so the model fills gaps without evidence. Check: trace each key claim to original material, and mark unknown if absent.

Revisit this concept

Apply this to a concrete task

Study pretraining data and objectives →

Where to practise after this route

This route gets the concepts across. Do not reread it; pick one place below and use what you just learned once.

Find a tool by task, check licence and deployment

Filter by the job first, then check where it runs, whether the licence allows commercial use, and where data goes.

Open →

Run a minimal project from source

Pick a repo with a clear licence, get the smallest example running, then decide whether to integrate it.

Open →

Reproduce a piece from its original prompt

Change one variable and see what differs. Do not treat one rerun as a conclusion about the model.

Open →