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. 1647+ practice problems, each with a clear explanation.
Free forever. No subscriptions. Supported by sponsors and donations.
1647
Problems
12
Topics
Start easy, finish hard: 466 beginner · 633 intermediate · 298 advanced problems.
0+
Learners and growing
Based on signup email domains. Not an endorsement, see footer.
Explore the curriculum
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.
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 studiesConvert 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) 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.
Understand the theoryBuild intuition before jumping into implementation.
Recognize reusable patternsConnect ideas across algorithms and data structures.
Practise with purposeWork through curated questions and difficulty levels.
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
← key idea
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
... 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.
The problem, from first principlesWhat the paper is actually solving, in plain terms
From theory to codeThe exact function to write, with real shapes and defaults
Constraints that matterThe edge cases the paper assumes, spelled out
Check it against hidden testsPass everything and the paper is yours
Beyond writing code
It's to help you understand what your code is actually doing underneath
We don't charge users and we don't sell your data. TrenTorch runs entirely on sponsorships and donations.