Skip to content
Nirav Vaghasiya

Mathematics curriculum

Maths for AI

104 Jupyter notebooks across 14 modules — from linear algebra and calculus to information theory, statistical learning theory and the mathematics behind transformers, LoRA and diffusion — each with a from-scratch NumPy or PyTorch implementation.

  • Deep learning foundations
  • Optimisation
  • Probability
  • Transformers
Status
104-notebook curriculum · CI-audited
Started
2026
Stack
Jupyter · NumPy · PyTorch · SciPy · SymPy
Notebooks
104
Modules
14
Learning tracks
6 role-based
Quality
Notebook audit + math regression in CI
Contribution
Fourteen modules tiered from core to advanced, with six role-based tracks through them.
Best evidence
104 notebooks · 14 modules
Counted from numbered curriculum folders; excludes template and test-fixture notebooks.
Main limitation
Hour estimates per track are the author's estimates.
Verification basis
Recursive repository tree, curriculum docs, representative notebooks and CI tooling inspected.
01

Overview

A mathematics-first, implementation-driven curriculum for understanding modern AI/ML. Every notebook pairs a mathematical idea with a plot, a from-scratch NumPy or PyTorch implementation, and a direct connection to where that idea appears inside real ML and LLM systems.

02

Problem

Most machine-learning material either hand-waves the mathematics or presents it with no connection to the systems it explains. Understanding why LoRA works, why attention is scaled by √dₖ or why diffusion models are SDEs requires both.

03

Motivation

The curriculum makes the mapping explicit: eigen-decomposition and SVD to PCA and LoRA/QLoRA fine-tuning; softmax and the √dₖ scaling to transformer attention; stochastic processes and SDEs to diffusion models.

04

Architecture

Fourteen modules tiered from core to advanced, with six role-based tracks through them.

Curriculum · 14 modules, 4 tiers
Core
Prerequisites4
Linear algebra10
Calculus10
Probability11
Optimisation12
Important
Information theory7
Numerical methods8
Capstones5
Specialised
Discrete maths5
Adv. linear algebra6 · LoRA
Adv. probability8 · diffusion
Learning theory9 · scaling laws
Advanced
Differential geometry5
Functional analysis4 · NTK
Each notebook follows one template — objective, theory, visual intuition, implementation from scratch, why it matters for AI, exercises — and executes in CI.
Core
Prerequisites, linear algebra, calculus, probability and statistics, optimisation.
Important
Information theory, numerical methods, capstone projects.
Specialised
Discrete mathematics, advanced linear algebra, advanced probability, statistical learning theory.
Advanced
Differential geometry and topology, functional analysis.
Notebook template
Objective → theory → visual intuition → implementation from scratch → why it matters for AI → graded exercises.
05

Implementation

  • Notebooks on LoRA (a LoRALinear module wrapping a frozen linear layer), the neural tangent kernel and infinite-width networks, attention built from the mathematics, a mathematical analysis of GPT, KL divergence and the information bottleneck, diffusion mathematics, quantisation and mixed precision, scaling laws and double descent.
  • Six tracks from AI/ML Beginner (26 notebooks) to Mathematical ML Researcher (all 104), plus fast paths such as “understand transformers” and “fine-tune LLMs with LoRA”.
  • Tooling to execute and audit notebooks and to regression-test mathematical identities, run in CI.
06

Key technical decisions

  1. 01

    Implementation-driven

    Every idea is coded from scratch before a library is allowed to do it.

  2. 02

    Rigor framework

    A documented rigor and exercise framework governs how proofs, intuition and practice are balanced in each notebook.

07

Evaluation & results

Coverage
104 notebooks · 14 modules
Counted from the repository tree.
08

Challenges

  • Keeping 104 executable notebooks green in CI as modules were added.
09

Limitations

  • Hour estimates per track are the author's estimates.
10

What I learned

  • The fastest way to understand a model is to implement the mathematics it rests on.