Learn machine learning by building it.

Don't just read about AI. Write it yourself, one small step at a time, and see exactly what your code does. 1639+ practice problems, each with a clear explanation.

Free forever. No subscriptions. Supported by sponsors and donations.

Learners signing up from top companies and campuses

xAI SpaceX Waterloo IIT Bombay BITS Pilani IISc NITs IIITs

xAI SpaceX Waterloo IIT Bombay BITS Pilani IISc NITs IIITs

Based on signup email domains. Not an endorsement, see footer.

What people are saying

Explore the curriculum

From real-world ML problems to rigorous DSA fundamentals.

TrenTorch combines hands-on machine learning challenges with a carefully structured data structures and algorithms sheet. Learn the reasoning, implement the solution, and understand why it works.

01Applied machine learning

Company case studies

Go beyond textbook exercises. Work through company-inspired scenarios in recommendation systems, experimentation, feature engineering, classification and decision trees. Each challenge turns a practical engineering need into a focused implementation problem.

Browse all company case studies

cases / netflix / stable-softmax-logitsMedium

Problem Theory Starter code Tests

Stable softmax for ranking scores

Netflix case · Medium · NumPy

Convert a model's raw ranking scores into probabilities, even when logits are large enough to make a naive exponential overflow.

def softmax(logits):
    shifted = logits - logits.max(axis=-1, keepdims=True)
    exp = np.exp(shifted)
    return exp / exp.sum(axis=-1, keepdims=True)

HIDDEN TESTS✓ 4 / 4 passed

✓ Large logits: no overflow

✓ Each row sums to one

02CUDA & GPU programming

Learn the GPU by writing the kernel.

39 theory chapters with interactive figures, 53 kernel problems that run right here, and the most advanced topics, up to multi-GPU. Over 60 interactive figures, from warps and bank conflicts to ring AllReduce and multi-GPU scaling. Every card is a live link: open a figure, change a number, then write the kernel.

01

Interactive theoryWatch a launch travel from the host to the GPCs, SMs, warps and threads.

02

Real kernels, real feedbackBytes moved, coalescing, bank conflicts and divergence for every run.

03

Multi-GPU problemsAllReduce, halo exchange, data-parallel training and deadlock hunts.

Explore the CUDA course

cudaSee it. Then write it.

Jump in anywhereLive links · TrenTorch CUDA

03Research papers · Read, annotate, implement

Read the paper. Mark it up.

Open the original paper in your browser. Highlight the lines that matter, draw on the page, and keep notes beside the text. Then implement the paper's ideas yourself, step by step.

Explore papers across every major topic

Explore all research papers

papers / attention-is-all-you-need1 / 15

ReadDrawHighlightTextErase Saved in
this browser

Attention Is All You Need

3.2.1  Scaled Dot-Product Attention

Attention(Q, K, V) = softmax(
QKᵀ / √dₖ) V

← key idea

transformers-llms / scaled-dot-product-attentionIntermediate

Attention Is All You Need: Scaled Dot-Product Attention

The problem, from first principles

Attention Is All You Need (Vaswani et al., 2017) drops recurrence entirely. Each position builds its output by comparing a query with every key, turning similarities into weights, and averaging the values with those weights. Dividing by the square root of the key dimension keeps the softmax from saturating.

From theory to code

Implement scaled_dot_product_attention(Q, K, V), which returns softmax(QK^T / sqrt(d)) V with a row-wise softmax.

Constraints

  • Q and K share the feature dimension d.
def scaled_dot_product_attention(Q, K, V):
    # softmax(QK^T / sqrt(d)) V, row-wise softmax
    ...

hidden testsRun · 0 / 5

04Research papers · Code

Then code the paper.

Every paper comes with questions that start from first principles and end in working code. Implement the idea yourself and run it against hidden tests.

01

The problem, from first principlesWhat the paper is actually solving, in plain terms

02

From theory to codeThe exact function to write, with real shapes and defaults

03

Constraints that matterThe edge cases the paper assumes, spelled out

04

Check it against hidden testsPass everything and the paper is yours

Code the paper

05Algorithms & problem solving

A DSA sheet built around understanding.

Prepare with a structured, Google-level data structures and algorithms curriculum. Learn the theory, recognize patterns, and practise with real questions from the TrenTorch DSA sheet—then track your progress as you improve.

01

Understand the theoryBuild intuition before jumping into implementation.

02

Recognize reusable patternsConnect ideas across algorithms and data structures.

03

Practise with purposeWork through curated questions and difficulty levels.

Explore the complete DSA sheet

dsa-sheetLearn the idea. Then solve.

Questions from your sheetLive links · TrenTorch DSA

Beyond writing code

The goal isn't just to teach you how to write the code

It's to help you understand what your code is actually doing underneath

Hosting & OSS support by

Thanks to Vercel and Mintlify for providing infrastructure

Free. Money shouldn't be the barrier to learning ML.

We don't charge users and we don't sell your data. TrenTorch runs entirely on sponsorships and donations.

Support TrenTorch