This project has exactly two dependencies: Python and pytest.
You need Python 3.10 or newer. To check your version:
python3 --versionIf you're on macOS or Linux, Python 3 is probably already installed. If not:
- macOS:
brew install python - Ubuntu/Debian:
sudo apt install python3 - Windows: Download from python.org
The tests use pytest. Install it with:
pip install pytestOr if you want it isolated in a virtual environment:
python3 -m venv .venv
source .venv/bin/activate # Windows: .venv\Scripts\activate
pip install pytestThat's it. No other packages needed.
Run the test suite for Tutorial 01 to confirm everything works:
python3 -m pytest tutorials/01-mlp-from-scratch/tests/ -vYou should see output like:
tests/test_01_math.py::test_vector_add_basic PASSED
tests/test_01_math.py::test_dot_product_basic PASSED
...
If you're running tests against your own starter_code/ implementations, they'll initially fail with NotImplementedError — that's expected. The goal is to make them pass.
Every solution file is a standalone script with a built-in demo. You can run any of them directly:
python3 tutorials/01-mlp-from-scratch/solution/01_math_foundations.py
python3 tutorials/01-mlp-from-scratch/solution/07_final_project.pyThe final project files train and evaluate a complete model end to end.
As you implement each chapter, run its tests:
# Tutorial 01
python3 -m pytest tutorials/01-mlp-from-scratch/tests/test_01_math.py -v
python3 -m pytest tutorials/01-mlp-from-scratch/tests/test_02_neuron.py -v
# ...
# All of Tutorial 01 at once
python3 -m pytest tutorials/01-mlp-from-scratch/tests/ -v
# Everything
python3 -m pytest tutorials/ -vChapter files are named with numeric prefixes (01_math_foundations.py, 02_single_neuron.py, etc.) because it makes the reading order obvious. Python can't import files whose names start with a digit using the normal import statement, so the solution files use:
import importlib
module = importlib.import_module('01_math_foundations')This is a minor quirk but it's intentional — it keeps the numbered names while staying valid Python. Each file that does this explains it inline.
smallest-ai-tutorial/
├── README.md — Start here
├── SETUP.md — This file
├── CONTRIBUTING.md
├── LICENSE
├── data/
│ └── phonics/ — Training data (CVC words, digraphs, phonics rules)
├── tutorials/
│ ├── 01-mlp-from-scratch/
│ ├── 02-lstm-from-scratch/
│ ├── 03-transformer-from-scratch/
│ └── 04-comparison-study/
└── bonus/
├── bitnet-to-c/ — Exporting BitNet weights to C
├── arm-qemu-testing/ — Testing on ARM via Docker/QEMU
└── architecture-decision-records/
Ready? Start with Tutorial 01.