Area 01 / 08 · LLM

LLM

Phase 1 · Weeks 3–6

How the model works inside, and how to talk to it so you get what you want.

Everything else in this roadmap sits on top of one API call. This area explains what happens inside that call (tokens, attention, the KV cache) and how to steer it (system prompts, examples, reasoning, structured outputs). The second half covers what you meet in production: cost, caching, hallucinations, fine-tuning and choosing a model.

0 of 20 used in code

01–10 · The base

Learn these first.

  • 01TokenizationText is cut into tokens (word pieces) before the model reads it. Limits and prices are counted in tokens.
  • 02Transformer ArchitectureThe network design behind GPT, Claude and Llama: stacked attention and feed-forward layers.
  • 03Self-AttentionEvery token looks at the other tokens and decides which ones matter for its meaning.
  • 04Context WindowsThe most tokens (prompt + answer) a model can handle in one call.
  • 05KV CacheSaved keys and values of earlier tokens, so each new token doesn’t redo the whole prompt.
  • 06Temperature and Top-pSampling knobs. Low values give predictable answers, high values give varied ones.
  • 07System PromptsStanding instructions that set the model’s role, rules and output style.
  • 08Few-shot PromptingPut 2–5 worked examples in the prompt so the model copies the pattern.
  • 09Chain of ThoughtAsk the model to reason step by step before it answers. Helps on multi-step problems.
  • 10Reasoning ModelsModels trained to think at length before answering. Slower and pricier, better on hard tasks.

11–20 · Production level

Come back after you have shipped something.

  • 11Structured OutputsForce the reply into JSON that matches your schema, so your code can parse it every time.
  • 12Prompt CachingReuse an unchanged prompt prefix across calls to cut cost and latency.
  • 13Token PricingInput, output and cached tokens cost different amounts. Know your cost per call.
  • 14HallucinationsConfident but wrong answers. Reduce them with grounding, citations and permission to say ‘I don’t know’.
  • 15Multimodal InputsSending images, PDFs or audio to the model along with text.
  • 16Fine-tuning with LoRATrain small adapter matrices instead of all the weights. A cheap way to specialise a model.
  • 17QLoRALoRA on top of a 4-bit quantized base model, so fine-tuning fits on one GPU.
  • 18QuantizationStore weights in fewer bits (8-bit, 4-bit) to save memory and run faster, at a small quality cost.
  • 19DistillationTrain a small ‘student’ model to copy the answers of a big ‘teacher’ model.
  • 20Open vs Closed ModelsOpen weights you can host yourself (Llama, Qwen, Mistral) vs API-only models (GPT, Claude, Gemini).
BUILD THIS

A command-line chatbot with a system prompt, streaming replies, a JSON output mode and a live token + cost counter for every message.

Project guide →