How to Debug a PyTorch Training Loop

A PyTorch training loop that is not learning is one of the most common and frustrating situations in deep learning. The loss is flat, or NaN, or oscillating — and the model is right, the data is right, so what is wrong? This guide covers the systematic debugging process: how to isolate whether the problem … Read more

PyTorch Distributed Training Tutorial

Distributed training lets you use multiple GPUs — on one machine or across many — to train models faster or to fit models that do not fit on a single GPU. PyTorch’s DistributedDataParallel (DDP) is the standard approach: each GPU runs a full copy of the model on a shard of the data, and gradients … Read more

PyTorch DataLoader Optimization Guide

The DataLoader is often the bottleneck that prevents your GPU from training at full utilisation. If your GPU sits at 30–60% utilisation between batches, the problem is almost certainly data loading — the CPU cannot prepare and transfer batches fast enough to keep the GPU busy. This guide covers every meaningful optimisation: worker count, pinned … Read more

TabNet vs XGBoost: Which Should You Use?

TabNet is a deep learning architecture designed specifically for tabular data. It uses sequential attention to select which features to focus on at each decision step — essentially learning feature selection and transformation jointly rather than relying on hand-crafted engineering. XGBoost is gradient boosted trees, the dominant tabular baseline for the past decade. The comparison … Read more

PyTorch vs JAX: Which Should You Learn in 2026?

PyTorch and JAX both dominate modern deep learning research, but they make fundamentally different design choices. PyTorch is object-oriented, eager by default, and built around mutable tensors and a familiar Python programming model. JAX is functional, pure, and built around function transformations — you write plain Python functions and apply jit, grad, vmap, and pmap … Read more

PyTorch 2.0 Compile Mode: A Practical Guide

PyTorch 2.0 introduced torch.compile(), a one-line speedup for PyTorch models. It compiles your model’s computation graph using TorchDynamo and TorchInductor, fusing operations and generating optimised kernels for your hardware. On NVIDIA GPUs, compile mode typically delivers 10–50% speedup with no changes to model architecture or training loop. This guide covers how to use it, what … Read more

Getting Started with JAX for Machine Learning

JAX is NumPy with automatic differentiation, JIT compilation, and hardware acceleration baked in. It is not a deep learning framework in the way PyTorch is — there are no built-in layers or optimisers. Instead, JAX gives you the primitives for building them: pure functional transformations (jit, grad, vmap, pmap) that compose cleanly and run efficiently … Read more

How to Use PyTorch with Apple MPS Backend

Apple Silicon (M1, M2, M3, M4) brings a capable GPU integrated into the same die as the CPU, with shared memory that eliminates the PCIe data transfer bottleneck of discrete GPUs. PyTorch supports it via the Metal Performance Shaders (MPS) backend, available since PyTorch 1.12. For ML workloads that fit in the Mac’s unified memory, … Read more

XGBoost Multiclass Classification Guide

XGBoost handles multiclass classification with the same API as binary classification — just change the objective and let XGBoost figure out the rest. The model trains one set of trees per class (one-vs-all internally), outputs a probability for each class, and predicts the class with the highest probability. This guide covers the full workflow: training, … Read more