The LLM algorithms wiki

A continuously maintained tutorial on LLM algorithms. It is organized in four parts, chapters follow a learning order, and every page states what you will be able to do afterwards and what to read first. Pages connect through prerequisites and related reading.

Browse labs on GitHub ↗

Where to start

Pick a study route

Each route lays out wiki pages week by week, with a deliverable for every week. Make one of them "my route" and every page you open will tell you which week of the route it belongs to and what the next stop is. Your progress and choice stay in your browser.

  1. Route 0about 10 hours

    Weekend crash course

    Build an overall picture of LLMs in one weekend, know what each stage does, and then decide which route to take

    7 pages

    Start hereWhat Is a Large Language Model? From Next-Word Prediction to General Assistants

    Weekly plan
  2. Route 18 weeks

    AI application developer

    Connect prompting, structured output, retrieval-augmented generation, tool calling, evaluation and security into one deliverable application loop

    23 pages

    Start hereWhat Is a Large Language Model? From Next-Word Prediction to General Assistants

    Weekly plan
  3. Route 214 weeks

    LLM engineer

    Understand the full chain from data and pre-training through fine-tuning to serving, estimate the compute and memory of a training run, complete a small fine-tuning run, and deploy an inference endpoint you can load-test

    39 pages

    Start herePython and tensor shapes

    Weekly plan
  4. Route 316 weeks

    LLM researcher

    Build a map of the literature, learn to pose verifiable questions and design minimal experiments, and write the results up as conclusions others can repeat

    21 pages

    Start hereFrom RNNs to Attention

    Weekly plan

All chapters

Part 1

Understand LLMs

What is an LLM, what is it made of, and why is each part designed the way it is?

  1. Getting Started

    New to large language models? Build an end-to-end picture first, then pick one of four study routes (weekend crash course, application development, engineering or research), and see how this wiki is organized and meant to be read.

    4 pages · 81 min

  2. Foundations

    Language modeling, neural networks, information theory, tokens and embeddings, and optimizers: the lowest-level primitives of an LLM, and the reason behind almost every design decision that follows.

    6 pages · about 2 h

  3. Model Architecture

    From the bottleneck of RNNs to attention, then the complete Transformer block, RoPE, GQA, MoE, long context, and the state space models and hybrids that trade the KV cache for a fixed-size state: the structure of modern LLMs and the reasoning behind each choice.

    9 pages · about 4.5 h

Part 2

Train LLMs

How do you train a model on a finite budget of compute and data, then teach it to follow instructions and reason?

  1. Compute and Systems

    GPU compute and bandwidth, the roofline model, numerical precision and collective communication. The same algorithm can differ tenfold in speed with another implementation, batch size or precision, so the hardware limits have to be understood first.

    5 pages · about 2.5 h

  2. Pre-training

    The training pipeline, data engineering (filtering, deduplication, mixing), scaling laws, the compute and memory ledger and distributed parallelism: the engineering and scientific decisions that turn raw text into usable weights for a base model.

    5 pages · about 3 h

  3. Post-training and Alignment

    SFT, LoRA, reward models, reinforcement learning basics (policy gradients, advantages, PPO), preference optimization (RLHF and DPO) and reinforcement learning for reasoning: how a base model is shaped into something useful and controllable that learns to solve problems deliberately.

    7 pages · about 5 h

Part 3

Deploy and apply

How do you run a model fast and cheaply, and turn it into a reliable application?

  1. Inference and Serving

    Decoding and sampling, the KV cache, quantization, inference serving, continuous batching and speculative decoding: how to run LLMs fast and cheaply, and how to see the trade-offs between latency, throughput and memory.

    8 pages · about 3 h

  2. Applications

    Prompt engineering, structured outputs and function calling, RAG, agents, and MCP and the tool ecosystem: the engineering methods that turn a model that can talk into a product that is reliable, measurable and easy to iterate on.

    8 pages · about 5.5 h

  3. Multimodal

    How vision and language are aligned, and how images are generated: from CLIP, LLaVA and the token cost of an image to how diffusion and flow matching build images, robot actions and text from noise, the core structures and limits of multimodal models.

    3 pages · about 1.5 h

Part 4

Evaluate, secure, look ahead

How do you know whether a model is good and safe, and where is the technology heading?

  1. Evaluation

    How to show that a model got stronger: what benchmarks measure, the statistics of evaluation (pass@k, confidence intervals, sample size), LLM-as-a-Judge, building an evaluation set with reliable labels, and how benchmark contamination arises and is detected.

    6 pages · about 2.5 h

  2. Safety and Alignment Risks

    LLMs make up plausible content, get hijacked by prompt injection, are talked past guardrails by jailbreaks, and repeat training-data secrets. This chapter sorts these risks into reproducible categories with threat models, measurements and defenses; most defenses are system design.

    3 pages · about 2.5 h

  3. Frontier

    The fastest-moving directions in LLMs and the lasting questions behind each. For now: test-time compute (how inference compute buys accuracy), synthetic data (when model-made data helps or collapses) and mechanistic interpretability (finding features and circuits inside the network).

    3 pages · about 2 h

Recently updated