You can call loss.backward() a thousand times and still not know what it does. TrenTorch fixes that by making you build it. It is two things in one repo: a terminal course of 20 modules where you write your own machine learning framework in raw NumPy, from tensors and autograd up to transformers, and a browser site with 350+ graded coding questions across 12 topic areas. There is no import torch anywhere in the curriculum.
No GPU needed. Everything runs on the CPU with NumPy. The CLI needs Python 3.10+, and the web questions run Python 3.12 inside your browser through Pyodide.
This guide covers both tracks, plus how to run the question checks if you want to contribute.
Track 1: the browser, nothing to install
Open trentorch.com, sign in with GitHub, Google or an email link, and start a question. Each one has a problem statement, a theory section, a starter file, tests and a reference solution. Your code runs and is graded in the browser, no server round trip, and progress is saved to your account. There is also a Problem of the Day.
The 12 areas go well beyond the usual "implement softmax" drills:
- Math and statistics, classical ML, deep learning core, training
- Sequence modeling, transformers and LLMs
- Inference: attention, KV cache and decoding, quantization, batching and serving metrics
- Vision, systems performance, distributed systems
- RL and alignment, production ML (tracking, deployment, drift)
If you are preparing for ML engineering interviews, the Inference and Systems performance tracks are the ones that most courses skip.
Track 2: build the framework in your terminal
git clone https://github.com/TrenTorch/TrenTorch.git
cd TrenTorch/TrenTorch_CLI
python3 -m venv .venv && source .venv/bin/activate
pip install -r requirements.txt && pip install -e .
tren setup
tren module start 01
On Windows PowerShell, activate with .venv\Scripts\Activate.ps1 and run the two pip installs separately.
tren setup puts tren on your PATH, so later terminals do not need the virtualenv activated. tren module start 01 opens the first module, which you work through in a notebook. Progress is saved locally under user_data/.
The 20 modules are grouped in four parts:
- Foundations (01 to 08): tensors, activations, layers, losses, dataloader, autograd, optimizers, training
- Vision (09): Conv2d and CNNs for image classification
- Language (10 to 13): tokenization, embeddings, attention, transformers
- Optimization (14 to 20): profiling, quantization, compression, acceleration, memoization, benchmarking and a capstone
As you progress you unlock recreations of landmark results on your own framework: the 1958 perceptron, the 1969 XOR problem, 1986 backpropagation, a 1998 style CNN, a 2017 transformer generating text, and MLPerf style optimization. Other commands worth knowing: tren tui, tren serve, tren milestone and tren benchmark.
Let a coding agent set it up
If you use Claude Code, Cursor or Codex, paste this:
Clone https://github.com/TrenTorch/TrenTorch, enter TrenTorch_CLI, create a virtualenv, install requirements and the package, run `tren setup`, then `tren module start 01`. Report the path of the generated notebook and confirm the stub file has no import of torch.
Then do the module yourself. Letting the agent write your autograd defeats the point.
Contribute a question: run the checks locally
The web app is SvelteKit. To verify every question's reference solution passes its own tests in a real Pyodide before opening a pull request:
cd TrenTorch_Web
npm install
npm run test:pyodide
Other scripts: npm run check (types), npm run lint, npm run test (Vitest) and npm run dev for a local server. Sign in uses Supabase, so copy .env.example to .env with your own project keys if you need auth locally.
Honest caveats
- The license is PolyForm Noncommercial 1.0.0. Free for personal, educational and noncommercial use. Using it in a paid course or inside a company needs permission from the authors.
- Web and CLI progress are separate. Pick one track to start.
- The CLI curriculum is the team's implementation of Harvard CS249r's TinyTorch, rebuilt and extended. The web question bank is their own.
Use cases with copy-paste prompts
Each page has who it is for, the steps and a prompt you can paste into your coding agent.
Use case: Build a working ML framework from raw NumPy modules
Use case: Solve ML coding questions in the browser with instant grading
Use case: Run the web question checks locally before a pull request
Get one email every Monday with the week's hottest AI repos and exactly how to use them: subscribe free at dedupedai.com
Top comments (0)