// zero dependencies. just math.
Single-file, zero-dependency Python implementations of the algorithms that power modern AI.
Every script runs with python script.py — no frameworks, no abstractions.
Four progressive tiers. Pick the one matching what you want to learn next, or jump into the full catalog.
The architectures the rest is built on. Tokenization, embeddings, RNNs, attention, GPT, BERT, ResNet, diffusion, GANs.
Explore arrow_forwardSteering model behavior post-training. LoRA, QLoRA, DPO, PPO, GRPO, MoE, regularization.
Explore arrow_forwardMaking models fast and small. Flash Attention, KV-cache, quantization, RoPE, parallelism, SSMs.
Explore arrow_forwardSearch and reasoning for autonomous agents. MCTS, ReAct, bandits, minimax, memory networks.
Explore arrow_forwardStructured tracks through the collection. Pick one based on your interest or time budget.
No local imports, no utils.py, no companion files. Everything in one place.
Python standard library only. If it needs pip install, it doesn't belong here.
python script.py runs the whole program. Most scripts train, either one model followed by inference or variants compared side by side; a few run untrained mechanisms or non-learning algorithms. Each script's kind is recorded in no-magic/docs/catalog.json; this site does not display it yet. Some scripts download a small names dataset on first run.
30-40% comment density. Math-to-code mappings. Why, not what. Read top-to-bottom like a tutorial.
random.seed(42) at the top of every script. Same input, same output, every time.
The target for every script is a laptop CPU in under 10 minutes. No GPU required. No cloud. Recorded timings are historical (some, such as RAG at 12m 30s and RNN vs. GRU at 18m 30s, exceeded the target), and there is no current full-corpus runtime check.
48 single-file Python implementations of AI/ML algorithms. Zero dependencies, pure stdlib. The core collection.
Manim-powered algorithm visualizations. Animated explainers showing each algorithm's mechanics in motion.
This website. Algorithm catalog, learning paths, and live GitHub stats. Pure static HTML/CSS/JS.
Paper cards and lessons. Primary sources only. One markdown per paper, plus companion code walkthroughs.
Maintainer-side agent pipeline that drafts algorithm entries from papers for human review. Implemented (v0.4.0); autonomous activation deferred.