Skip to content
@TrenTorch

TrenTorch

Learn frontier ML by building your own PyTorch on our CLI and Web versions !
TrenTorch: learn ML by building it

Learn ML by building it: a from-scratch machine learning framework in NumPy, and hundreds of coding questions that run in your browser.

CI Problems Contributors CodeFactor A+ Python License

Vercel OSS Program

Try it in the browser · Quickstart · Curriculum · Contributing · FAQ

1647
coding problems
12
topic areas
20
framework modules
0
import torch needed

The TrenTorch questions page: a list of tracks with question counts and a progress bar The TrenTorch in-browser editor: problem statement on the left, Python editor and test results on the right


Note

The CLI curriculum is our implementation of TinyTorch (Harvard CS249r), rebuilt and extended in our own style. The browser version is our own, built independently.

Quickstart

In the browser: open trentorch.com, sign in with GitHub, Google, or email, and start a question. Nothing to install. Python runs in your browser (Pyodide) and your code is graded instantly.

In your terminal:

Important

Python 3.11.5 or newer is required (3.11.5 is the oldest supported version; 3.11 to 3.13 are tested). Python 3.10 and 3.11.0 to 3.11.4 are no longer supported, because some of our dependencies have security fixes that only ship for 3.11.5 and up. Check yours with python3 --version (or python --version on Windows). pip install will refuse to install the CLI on an older Python.

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
Windows (PowerShell)
git clone https://github.com/TrenTorch/TrenTorch.git
cd TrenTorch\TrenTorch_CLI
python -m venv .venv
.venv\Scripts\Activate.ps1
pip install -r requirements.txt
pip install -e .
tren setup
tren module start 01

tren setup adds tren to your PATH, so later terminals just need tren, no activating first. The command reference covers the rest (tren tui, tren serve, tren milestone, tren benchmark).

Run the web app locally
# Requires Node.js 22 (what CI uses)
cd TrenTorch_Web
npm install
npm run dev

Sign-in uses Supabase. Copy .env.example to .env and fill in your own project keys to use it locally.

Command What it does
npm run check Type check
npm run lint Prettier and ESLint
npm run test Unit tests (Vitest)
npm run test:pyodide Runs every question's reference solution and tests in a real Pyodide
npm run build Production build (fully prerendered)

Why build it yourself

Most people learn ML frameworks by importing them. We wanted to know how they work, so we built one. Every operation traces back to raw NumPy, the architecture matches what production frameworks use, and there is no import torch anywhere in the curriculum. You know what loss.backward() does because you wrote it.

1. Pick a problem
Each one comes with a problem statement, a theory section and a starter file.
2. Write the code
Python runs in your browser (Pyodide), or in your terminal with the CLI. Nothing to set up for the web version.
3. Get graded
Tests run instantly, and a reference solution is there once you want to compare.

Curriculum

The same ground, two ways:

TrenTorch Web TrenTorch CLI
Where Your browser Your terminal and Jupyter
What 1647 coding problems in 12 topic areas 20 modules that build a framework, from tensors to a capstone
Progress Saved to your account Saved locally under user_data/
Code TrenTorch_Web/ (SvelteKit) TrenTorch_CLI/ (Python)

A Problem of the Day features one new web question every day.

Web: 12 topic areas and their tracks

Every question has a problem statement, a theory section, a starter file, tests, and a reference solution.

Area Tracks
Math and statistics Linear algebra, calculus, probability, information theory, data preprocessing, exploratory analysis, statistical inference
Classical ML Linear regression, classification, decision trees, regularized models, ensembles, SVMs, instance-based and probabilistic models, unsupervised learning, evaluation, tabular foundation models
Deep learning core Tensors, activations, losses, autograd
Training Optimizers, layers, the training loop, regularization, why deep networks work
Sequence modeling Tokenization, embeddings, recurrent networks, attention
Transformers and LLMs The transformer block, modern architectures, language model assembly, LLM engineering
Inference Attention mechanisms, KV cache and decoding, quantization, batching and serving metrics
Vision Convolutions, pooling, CNN architecture and history, modern CNN concepts, vision transformers
Systems performance Profiling, quantization, mixed-precision training, compression, acceleration, kernels
Distributed systems Memoization, parallelism
RL and alignment Reinforcement learning, post-training alignment, fine-tuning, benchmarking and a capstone
Production ML Experiment tracking and versioning, deployment and serving, monitoring and drift
CLI: 20 modules
Part Modules What you build
I. Foundations 01-08 Tensors, activations, layers, losses, dataloader, autograd, optimizers, training
II. Vision 09 Conv2d, CNNs for image classification
III. Language 10-13 Tokenization, embeddings, attention, transformers
IV. Optimization 14-20 Profiling, quantization, compression, acceleration, memoization, benchmarking, capstone
CLI: historical milestones

As you progress, you unlock recreations of landmark ML results, run on your own framework:

Year Milestone What you reproduce
1958 Perceptron Binary classification with gradient descent
1969 XOR Crisis Multi-layer networks solving non-linear problems
1986 Backpropagation Multi-layer network training
1998 CNN Revolution Image classification with convolutions
2017 Transformer Era Language generation with self-attention
2018+ MLPerf Production-grade optimization
Repository structure
TrenTorch/
├── TrenTorch_CLI/                 # The `tren` CLI and the framework curriculum
│   ├── data/
│   │   ├── src/                       # Curriculum source (edit here), 01_tensor to 20_capstone
│   │   ├── modules/                   # Generated notebooks (student-facing, stubs only)
│   │   ├── solutions/                 # Reference implementations (maintainer and CI only)
│   │   ├── datasets/                  # Small training datasets
│   │   ├── milestones/                # Historical ML recreations
│   │   └── trentorch/                 # Generated package you import from
│   ├── platforms/
│   │   ├── cli/                       # The `tren` CLI
│   │   │   ├── core/                      # Config, console, theme, runtime
│   │   │   ├── cli_platform/              # Setup, system, package and dev commands
│   │   │   ├── processes/                 # Module workflow, milestone, benchmark, olympics, convert
│   │   │   ├── tui/                       # Terminal dashboard
│   │   │   ├── server/, companion_ui/     # Local companion web UI
│   │   │   └── tests/
│   │   └── dev_tools/                 # Maintainer scripts
│   ├── docs/                          # Command reference, design notes, contributing guide
│   ├── user_data/                     # Your progress and benchmarks (not committed)
│   └── tests/                         # Integration, end-to-end and environment tests
│
├── TrenTorch_Web/                 # The browser version (SvelteKit, trentorch.com)
│   ├── platform/                      # Routes, components, assets
│   ├── processes/                     # Question runner, IDE content, POTD, auth, progress
│   ├── data/                          # Curriculum, question content (app_data/), POTD schedule
│   ├── pyodide-check/                 # Runs every question in Pyodide as a repo check
│   ├── e2e/                           # End-to-end and build-output checks
│   ├── supabase/migrations/           # Auth and user-data schema, with RLS policies
│   └── docs/                          # Design specs and plans
│
└── .github/                       # CI, bots and shared assets

The CLI workflow: TrenTorch_CLI/data/src/*.py becomes TrenTorch_CLI/data/modules/*.ipynb (you solve it), and your solutions end up in TrenTorch_CLI/data/trentorch/*.py.

CLI: how a module flows
flowchart TD
    src["data/src/NN_name.py<br/>curriculum source"] -->|"built into"| nb["data/modules/*.ipynb<br/>stubs for you to fill in"]
    nb -->|"tren module start NN"| you(["You implement it"])
    you -->|"tren module complete NN<br/>(tests, then export)"| pkg["data/trentorch/*.py<br/>your own framework"]
    pkg -->|"unlocks"| ms["tren milestone run<br/>landmark ML results"]
Loading

Contributing

Issues and pull requests are welcome. Start with the contributing guide: open an issue first, and ask to be assigned before you start on it. CI has to be green and one review from someone other than the author is required to merge. The first-contribution bot greets you on your first PR. Code quality is tracked on CodeFactor, where the repository is graded A+.

Found a security problem? Do not open a public issue. Read SECURITY.md.


Team Engineers

The maintainers, code owners first and then most active first (PRs plus issues). Counts are recomputed whenever a PR merges, from real issue/PR activity via .github/workflows/update-contributors.yml.

Rocky
Principal Maintainer & Infrastructure Architect
IIT Guwahati
Debugs autograd for fun, ships before sunrise

Issues: 18 · PRs: 189
 
Shivtej Gaikwad
Maintainer & Head of EngOps
IIT Guwahati
Shows up, builds systems, moves on to the next thing

Issues: 6 · PRs: 130
 
Maanas Tyagi
Maintainer & Core Engineer
Catches bugs, builds solutions & ships fast
Issues: 14 · PRs: 69
 
Aadityansha
Maintainer & Growth Lead
Processor engineer, breathes Assembly & CUDA
Issues: 1 · PRs: 18
 

Open-Source Contributors

Everyone else who has had a PR merged, most active first (PRs plus issues), or is credited as a Co-authored-by: on one. Want to show up here? Get a PR merged, or get credited as a co-author on someone else's: the first-contribution bot will say hello on your first PR, and this grid updates automatically after it merges. A closed-without-merging PR doesn't count, and neither does an issue on its own.

Show all 20 contributors
JashT14
JashT14
Spots bugs, fixes them & contributes
Issues: 10 · PRs: 3
AllenGeorge08
AllenGeorge08
Spots bugs, fixes them & contributes
Issues: 5 · PRs: 5
this-AR
this-AR
Spots bugs, fixes them & contributes
Issues: 7 · PRs: 2
shatrughantwt
shatrughantwt
Spots bugs, fixes them & contributes
Issues: 2 · PRs: 3
VrajVed
VrajVed
Spots bugs, fixes them & contributes
Issues: 1 · PRs: 2
KeuqS
KeuqS
Spots bugs, fixes them & contributes
Issues: 0 · PRs: 2
lux-liang
lux-liang
Spots bugs, fixes them & contributes
Issues: 0 · PRs: 2
shivamraut747-ux
shivamraut747-ux
Spots bugs, fixes them & contributes
Issues: 0 · PRs: 2
NaveenChandraAdhikari
NaveenChandraAdhikari
Spots bugs, fixes them & contributes
Issues: 1 · PRs: 1
pendi1901
pendi1901
Spots bugs, fixes them & contributes
Issues: 1 · PRs: 1
ReetikaMishra23
ReetikaMishra23
Spots bugs, fixes them & contributes
Issues: 1 · PRs: 1
Shreyacodess20
Shreyacodess20
Spots bugs, fixes them & contributes
Issues: 1 · PRs: 1
abhay2geek
abhay2geek
Spots bugs, fixes them & contributes
Issues: 0 · PRs: 1
bernalalexis-try
bernalalexis-try
Spots bugs, fixes them & contributes
Issues: 0 · PRs: 1
devsterxyz
devsterxyz
Spots bugs, fixes them & contributes
Issues: 0 · PRs: 1
MahekPatel-2403
MahekPatel-2403
Spots bugs, fixes them & contributes
Issues: 0 · PRs: 1
mayuriphad
mayuriphad
Spots bugs, fixes them & contributes
Issues: 0 · PRs: 1
MayurK-cmd
MayurK-cmd
Spots bugs, fixes them & contributes
Issues: 0 · PRs: 1
pushkarkumarvats
pushkarkumarvats
Spots bugs, fixes them & contributes
Issues: 0 · PRs: 1
Saaarthak0102
Saaarthak0102
Spots bugs, fixes them & contributes
Issues: 0 · PRs: 1

Credit

TrenTorch's CLI is our implementation, built on the curriculum and foundation of TinyTorch, created by Prof. Vijay Janapa Reddi and the ML Systems Book community at Harvard University.

Related educational frameworks
  • tinygrad: George Hotz's minimalist framework
  • micrograd: Andrej Karpathy's tiny autograd
  • MiniTorch: Cornell's educational framework

License

PolyForm Noncommercial License 1.0.0: free for personal, educational, and noncommercial use. Not licensed for commercial use.

Code of Conduct

This project follows the Contributor Covenant. It applies in issues, pull requests, discussions, and on trentorch.com.

FAQ

Is TrenTorch free?

Yes, for personal, educational, and noncommercial use, under the PolyForm Noncommercial License 1.0.0. Commercial use is not covered. If you want to use it in a paid course or inside a company, get in touch at rocky@trentorch.com or through trentorch.com/contact.

Web or CLI: which should I start with?

Start with the web app if you want to try questions right now with nothing to install. Use the CLI if you want to build the framework yourself, module by module, in notebooks on your own machine. They cover the same ground, and progress is not shared between them.

Do I need a GPU, PyTorch, or TensorFlow?

No. Everything runs on the CPU with NumPy, and the curriculum never imports PyTorch or TensorFlow. The CLI needs Python 3.11.5 or newer (older versions, including 3.10, are not supported). The web app runs Python 3.12 inside your browser.

Where does my code run on the web app?

In your browser, using Pyodide (Python compiled to WebAssembly). Running and grading a question does not need a server. Your progress (which questions you have solved) is saved to your account, which you create by signing in with GitHub, Google, or an email link.

How is this different from TinyTorch?

The CLI curriculum is our own implementation of TinyTorch from Harvard's CS249r: same foundation, rebuilt and extended in our style. The web app is a separate, independent project built on its own question bank.

How do I add or fix a question?

Open an issue first and ask to be assigned, as described in the contributing guide. Web questions are plain files under TrenTorch_Web/data/app_data/, and the authoring guide explains the layout. CLI modules are edited in TrenTorch_CLI/data/src/.

How do I get listed under Open-Source Contributors?

Get a pull request merged. A workflow updates the grid automatically after each merge. A closed-without-merging PR does not count, and neither does an issue on its own.

I found a bug. Where do I report it?

Open a GitHub issue with steps to reproduce. For a security problem, do not open a public issue: follow SECURITY.md.


Build it yourself. Understand it fully.

Pinned Loading

  1. TrenTorch TrenTorch Public

    Don't memorize ML. Understand it from first principles including Inference, Cuda, Deep Learning, Data Science and Reinforcement Learning

    Python 923 86

Repositories

Showing 2 of 2 repositories
  • .github Public
    TrenTorch/.github's past year of commit activity
    0 0 0 0 Updated Dec 1, 2026
  • TrenTorch Public

    Don't memorize ML. Understand it from first principles including Inference, Cuda, Deep Learning, Data Science and Reinforcement Learning

    TrenTorch/TrenTorch's past year of commit activity
    Python 923 86 1 3 Updated Dec 1, 2026

Top languages

Python

Most used topics

Loading…