Skip to content
FollowtheDamnCode

AI and ML

The beginner AI lessons are free. The later AI lessons, the ML maths and the ML concepts are part of Pro.

Beginner — AI Literacy

What AI actually is, the vocabulary you need, and how to use it well before going any deeper.

Intermediate — How It Actually Works

Under the hood of an LLM, and the patterns (RAG, MCP, agent skills) built on top of it.

ML Maths — From First Principles

The linear algebra, calculus, and probability every model is built from, one idea at a time with numbers you can check by hand.

  1. Vectors & Dot ProductsA list of numbers that is also an arrow — and the one operation that measures how much two arrows agree. Pro
  2. Matrices & Matrix MultiplicationA grid of numbers that transforms vectors — and why one multiplication runs a whole neural-network layer for a whole batch. Pro
  3. Derivatives & the Chain RuleThe slope of a function at a point, and how slopes multiply through a chain of functions — the whole of backpropagation in one rule. Pro
  4. Gradients & Partial DerivativesSlopes for functions of many inputs — one per input, stacked into the arrow that points uphill. Pro
  5. Probability Basics & Bayes' RuleThe handful of rules for reasoning about uncertainty, and the one formula that turns evidence into updated beliefs. Pro
  6. Distributions: Bernoulli, Normal, SoftmaxThe few shapes of randomness ML relies on — coin flips, bell curves, and the softmax that turns scores into a distribution. Pro
  7. Expectation & VarianceThe long-run average of something random, and how far it typically strays — the two numbers behind losses, batches, and the bias–variance trade-off. Pro
  8. Maximum LikelihoodPick the parameters that make the data you actually saw most probable — the idea that quietly produces log-loss and squared error. Pro
  9. Eigenvectors & EigenvaluesThe special directions a matrix only stretches, never turns — and why they are exactly what PCA keeps. Pro
  10. Maths Notation DecoderΣ, ∏, argmax, ∇, ‖·‖, E[·], ~ and friends — read out loud, and written as the few lines of code they stand for. Pro

Advanced — Internals & Production Systems

The math and infrastructure behind real systems — from a single neuron to shipping at scale.

  1. Neural Networks From ScratchNeurons, weights, activation functions, and the forward pass that turns an input into a prediction. Pro
  2. Gradient Descent and Back-PropagationLoss functions, learning rate, and how a network actually updates its weights from a single wrong answer. Pro
  3. Deep Learning Architectures, ComparedCNNs vs. RNNs vs. Transformers, and why the Transformer specifically won for language. Pro
  4. Multi-Head Attention, in DepthThe full Query/Key/Value math, why multiple heads help, and what positional encoding is actually for. Pro
  5. Vector Databases and How Indexing WorksApproximate nearest neighbor search and HNSW's layered graph — how a search over millions of vectors stays fast. Pro
  6. Advanced RAG PatternsAgentic RAG, hybrid keyword-plus-vector search, reranking, and how you'd actually evaluate any of it. Pro
  7. Multi-Agent Systems and OrchestrationPlanning, reflection, tool orchestration, and stateful workflows across a team of subagents. Pro
  8. Advanced MCP: Production PatternsAuth, orchestrating multiple servers at once, and managing a context budget that doesn't blow up. Pro
  9. Fine-Tuning vs. Prompting vs. RAGThe cost, latency, and accuracy trade-offs between the three levers, and when each one actually fits. Pro
  10. Fine-Tuning Methods: Full, LoRA, QLoRA, RLHF, DPOThe ways to change a model's weights — which parameters you train, what data you need, and when each method is worth it. Pro
  11. Embeddings Beyond RetrievalThe same vectors that power RAG also cluster, classify, deduplicate, and flag the odd one out — often with no model training at all. Pro
  12. Structured Outputs & Function Calling ReliabilityGetting machine-readable output from a model every time — schemas, constrained decoding, validation, retries, and why small failure rates compound. Pro
  13. Safety, Alignment, and EvaluationRed-teaming, bias detection, eval harnesses, and guardrails — how you'd know a model is behaving before shipping it. Pro
  14. Evals in DepthOffline suites, online signals, LLM-as-judge and its traps, and the regression suite that stops a "better" prompt from shipping a broken one. Pro
  15. AI Safety in PracticePrompt injection, data leaking out through tools, and the defences that hold — written for the people building and protecting AI features. Pro
  16. Shipping to ProductionMonitoring, cost and latency optimization, caching, and rate limits for a real, live AI system. Pro
  17. Inference EngineeringWhat actually limits LLM serving — prefill vs decode, the KV cache and its memory maths, batching, quantization, runtimes, and capacity planning with real numbers. Pro
  18. Capstone: Build and Ship an Agentic RAG + MCP ApplicationDesign, build, deploy, and present a system that pulls every earlier topic together into one working thing. Pro

Machine learning concepts

The ideas that come up in almost every ML interview.

  1. Bias-Variance TradeoffThe two ways a model can be wrong, and why fixing one usually makes the other worse. Pro
  2. Overfitting & UnderfittingMemorizing the training set vs. never really learning it — and the signals that tell them apart. Pro
  3. Train / Validation / Test SplitWhy one held-out set isn't enough once you start tuning anything. Pro
  4. Regularization (L1 / L2)Penalizing complexity on purpose so a model generalizes instead of memorizing. Pro
  5. Precision, Recall & F1Why "accuracy" quietly lies to you the moment classes are imbalanced. Pro
  6. ROC, AUC & Choosing a ThresholdJudge a model's ranking across every threshold at once, then pick the one threshold your costs actually call for. Pro
  7. Class ImbalanceWhen the thing you're hunting for is 1 row in 100 — metrics that don't lie, and the fixes that actually help. Pro
  8. Gradient DescentHow a model actually learns — take a step downhill, repeat, using the loss's own slope as a guide. Pro
  9. Feature EngineeringThe unglamorous work that usually moves the needle more than the model choice does. Pro
  10. Feature Scaling & LeakagePut features on comparable scales for the models that care — and learn every preprocessing step from training data only. Pro
  11. Cross-ValidationGetting a trustworthy performance estimate out of a dataset too small to just split once. Pro
  12. Linear RegressionThe straight-line model everything else is measured against — least squares, the normal equations, and the gradient that trains it. Pro
  13. Logistic RegressionA linear model that outputs a probability — the sigmoid, log-loss, and the straight-line decision boundary underneath. Pro
  14. k-Nearest NeighboursThe model with no training step — predict by asking the k most similar examples you've already seen. Pro
  15. Naive BayesBayes' rule plus one bold simplification — a classifier that trains by counting and still holds its own on text. Pro
  16. Decision TreesA flowchart of yes/no questions learned from data — entropy, Gini impurity, and how a tree picks its splits. Pro
  17. Random Forests & BaggingMany deliberately different trees, each trained on a resampled dataset, averaged into one steady prediction. Pro
  18. Gradient BoostingA team of small trees built one at a time, each trained to fix what the ones before it still get wrong. Pro
  19. Support Vector MachinesDraw the boundary with the widest possible gap between classes — and bend it with kernels when a straight line won't do. Pro
  20. k-Means & Clustering EvaluationGrouping unlabelled data around k centres, and the honest ways to tell whether the groups mean anything. Pro
  21. PCA & Dimensionality ReductionFind the few directions where the data actually varies, and describe every row with just those. Pro