Learn ML by writing `loss.backward()` yourself, in NumPy
TrenTorch teaches machine learning by having you build a PyTorch-shaped framework from scratch, plus 350+ browser-graded coding questions.

What it does
TrenTorch is an educational project with two faces: a CLI curriculum of 20 modules where you build a deep learning framework in raw NumPy — tensors, autograd, optimizers, convolutions, attention, all the way to a capstone — and a web app with 350+ coding questions across 12 topic areas, from linear algebra to production ML serving. The browser version runs Python via Pyodide and grades your code instantly, no install required. There is no import torch anywhere in the curriculum; you know what loss.backward() does because you wrote it.
The interesting bit
The CLI curriculum is a rebuild and extension of TinyTorch (Harvard CS249r), and as you progress you unlock recreations of landmark results — the 1958 perceptron, the 1969 XOR crisis, backprop in 1986, CNNs in 1998, transformers in 2017 — all running on the framework you built yourself. It’s a LeetCode-shaped delivery vehicle for ML fundamentals, aimed partly at interview prep.
Key highlights
- Two delivery modes: browser (SvelteKit + Pyodide, instant grading, GitHub/Google/email sign-in) and terminal/Jupyter via the
trenCLI - Coverage spans math foundations, classical ML, deep learning core, transformers/LLMs, inference (KV cache, quantization, batching), systems performance, RL, and production ML
- Every question ships a problem statement, theory section, starter file, tests, and a reference solution
- A Problem of the Day keeps the web side fresh; CLI progress is saved locally under
user_data/ - 18 contributors, CI-validated, CodeFactor A+
Caveats
- PolyForm Noncommercial license — fine for learning, not for building a product on top of it
- The web app’s local development requires your own Supabase keys; the hosted version is the frictionless path
- The CLI curriculum is derived from TinyTorch rather than wholly original, which the authors state plainly
Verdict
If you’ve ever imported a framework and felt uneasy about not knowing what’s underneath, this is the antidote — especially strong for ML interview prep. If you just want to train models rather than understand them, keep importing.
Frequently asked
- What is TrenTorch/TrenTorch?
- TrenTorch teaches machine learning by having you build a PyTorch-shaped framework from scratch, plus 350+ browser-graded coding questions.
- Is TrenTorch open source?
- Yes — TrenTorch/TrenTorch is an open-source project tracked on heatdrop.
- What language is TrenTorch written in?
- TrenTorch/TrenTorch is primarily written in Python.
- How popular is TrenTorch?
- TrenTorch/TrenTorch has 602 stars on GitHub.
- Where can I find TrenTorch?
- TrenTorch/TrenTorch is on GitHub at https://github.com/TrenTorch/TrenTorch.