Learning machine learning by building it yourself

TrenTorch is a free platform for learning machine writing code yourself rather than just reading about AI. The site offers 1639+ practice problems, each with a clear explanation. There are no subscriptions — access is free forever, supported by sponsors and donations.

The learner base grows based on signup email domains. Over 74 topics are covered, with 0+ learners currently enrolled. The curriculum combines hands-on ML challenges with a structured data structures and algorithms sheet.

From theory to code, one small step at a time

Each challenge turns a practical engineering need into a focused implementation problem. You might convert a model's raw ranking scores into probabilities when logits are large enough to cause naive exponential overflow. The site explains the theory first, then gives the exact function to write with real shapes and defaults.

Constraints are spelled out clearly. For example, the scaled_dot_product_attention function requires Q and K to share the feature dimension d. The implementation returns softmax(QK^T / sqrt(d)) V with row-wise softmax. Hidden tests verify your code works correctly.

Attention Is All You Need (Vaswani et al., 2017) is one paper covered from first principles. The key idea: 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 softmax from saturating.

Interactive figures and real kernels

Over 60 interactive figures illustrate concepts from warps and bank conflicts to ring AllReduce and multi-GPU scaling. Every figure is a live link: open it, change a number, then write the kernel. Real feedback shows bytes moved, coalescing, bank conflicts and divergence for every run.

Theory chapters include interactive figures that let you watch a launch travel from the host to GPCs, SMs, warps and threads. Open the original paper in your browser, highlight lines that matter, draw on the page and keep notes beside the text. Then implement the paper's ideas yourself, step by step.

Data structures and algorithms curriculum

A structured DSA sheet helps you build intuition before jumping into implementation. You can recognize reusable patterns that connect ideas across algorithms and data structures. Curated questions range across difficulty levels, letting you practice with purpose.

Beyond writing code, the goal is to help you understand what your code is actually doing underneath. TrenTorch doesn't charge users and doesn't sell data. The platform runs entirely on sponsorships and donations.

Practice problems with real-world scenarios

Company-inspired scenarios appear throughout. You might work on recommendation systems, experimentation, feature engineering, classification or decision trees. Each scenario starts from first principles and ends in working code.

For example, the softmax function implementation handles numerical stability:

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

This shifts logits before exponentiation to prevent overflow when values are large.

Multi-GPU and low-level CUDA practice

Advanced topics go up to multi-GPU. Multi-GPU problems include AllReduce, halo exchange, data-parallel training and deadlock hunts. Real kernels run here with feedback on bytes moved, coalescing, bank conflicts and divergence.

The site supports learning from first principles through to production-scale distributed training. Every card is a live link you can open, modify and test immediately.