← Math for ML/AI Workloads
Glossary
Terms used across the Math for ML/AI Workloads path.
- activation function
- The nonlinear squash applied to a neuron's weighted sum (e.g. sigmoid, ReLU, GELU). Without it a stack of layers would collapse to one linear layer; the nonlinearity is what lets a network learn curved, complex rules.
- all-reduce
- The collective that sums each device's gradient and hands every device the total — the dominant network cost of a distributed training step. A ring all-reduce moves roughly 2× the payload per device regardless of how many devices there are, so it scales gracefully; the per-step time is still bytes ÷ interconnect bandwidth.
- arithmetic intensity
- FLOPs performed per byte moved from memory — the single number that says whether you're compute-bound (good: the math units are busy) or memory-bound (bad: the math units sit starved, waiting on memory). Raising it — bigger batches, lower precision, op fusion — is most of performance tuning.
- backpropagation
- How a network finds each weight's gradient: run the forward pass, then send the output error backward layer by layer, giving each neuron a share of the 'blame' scaled by how much it contributed. Operationally it's why training must keep the forward activations in memory — a big reason training's HBM footprint dwarfs inference's.
- basis vector
- The agreed unit 'rulers' (x̂, ŷ, ẑ — length 1 along each axis) that turn a list of numbers into a real direction; the vector is each component times its basis vector, summed. In ML you rarely touch them — they are the convention that lets a stored array [x, y, z] mean a geometric arrow. (The physics origin of the word 'tensor'.)
- bf16
- bfloat16 — a 16-bit float that keeps fp32's full 8-bit exponent (the same dynamic range) but drops mantissa bits (coarser precision). Halves the bytes moved versus fp32 while staying numerically stable for training; a default matmul type on modern AI accelerators.
- bias
- A per-neuron offset added to its weighted sum before the activation — it shifts the threshold at which the neuron 'fires.' Learned alongside the weights; counted as part of the model's parameters.
- bisection bandwidth
- The links you must cut to split the network into two equal halves, times the per-link bandwidth — the cross-section throughput limit. It's the bottleneck a large all-reduce or all-to-all hits; a squarer grid (or a fat-tree) raises it.
- classification
- A model task that sorts an input into categories (buy/walk, cat/dog) rather than predicting a number (that's regression). The output is read as 'which class,' often via a 0–1 score past a threshold.
- coefficient
- The multiplier on a variable in an equation (the 1 and 4 in C + 4G). Strip the variable names off a system and you're left with just the coefficients — and that grid of coefficients is the matrix the computer stores.
- collective
- A communication operation that all devices in a group run together — all-reduce (sum and share), all-gather, reduce-scatter, broadcast. Training's gradient sync is an all-reduce; collectives are where distributed training spends its network budget.
- communication-bound
- When a distributed step spends as long (or longer) syncing gradients across the interconnect as it does computing — so adding more devices stops buying speed. The fixes are overlapping communication with compute, a faster interconnect, or bigger steps, not more devices. The distributed-training analogue of being memory-bound.
- convergence
- When the loss stops dropping meaningfully — the run has reached (a good enough) minimum. The opposite of divergence, where too large a learning rate makes the loss explode to inf/NaN and the run is dead.
- decision boundary
- The line (or surface) where a classifier flips from one class to the other — the rule it learned, drawn in input space. A single neuron can only draw a straight boundary; stacking neurons lets a network bend it into curves.
- dynamic range
- The span from the smallest to the largest magnitude a number format can represent — set by its exponent bits. Too small and values overflow to inf or underflow to 0 (training diverges). bf16 keeps fp32's range; fp16 sacrifices it for precision.
- fat-tree
- A tree-shaped switched fabric (a Clos / spine-leaf network) engineered for full, non-blocking bisection — any-to-any at line rate — at the cost of extra switches and links. The topology most large GPU/datacenter clusters use; the throughput-over-cost end of the spectrum versus a torus.
- fp16
- A 16-bit float that spends its bits on precision (10 mantissa), leaving only a 5-bit exponent — so it overflows to infinity past ~65,504. The cautionary contrast to bf16, which traded precision for range instead.
- fp32
- 32-bit floating point — full precision and range, 4 bytes per number. The baseline format; AI training deliberately moves off it to halve or quarter the bytes on the bus.
- fp4
- 4-bit floating point; the OCP-standard variant is E2M1 — 1 sign, 2 exponent, 1 mantissa bit, range ~0.5–6. A quarter of bf16's bytes (≈2× matmul throughput), but so little range/precision that values are scaled into range before use; mostly inference and parts of training.
- gradient
- The direction of steepest increase of the loss; training steps the opposite way (downhill). You use it as 'which way is down' — no need to compute the derivative yourself. As a payload it's the size of the model's weights, which is why syncing it across devices is a networking cost.
- gradient descent
- How models learn: start with random weights, take a small step 'downhill' on the loss, and repeat — thousands to millions of times. An iterative control loop, not a one-shot compute, which is why training jobs run for days/weeks, checkpoint, and carry optimizer state.
- hbm
- High-Bandwidth Memory — the fast on-package DRAM that feeds an accelerator's compute units (tens to ~100+ GB at several TB/s on modern GPUs and TPUs). Bandwidth to HBM is the wall that arithmetic intensity is measured against, and capacity is what an OOM runs out of.
- hidden layer
- A layer of neurons between the inputs and the output — not directly observed, hence 'hidden.' Its neurons learn intermediate features; depth (more hidden layers) is what makes a network 'deep.'
- hop count
- How many links a message traverses between two nodes. Average hop count drives typical latency; the maximum over all pairs is the network diameter.
- interconnect
- The high-speed links wiring accelerators together so they can exchange data directly — far faster than the cross-node datacenter network. Gradient all-reduce rides it; when training goes communication-bound, interconnect bandwidth (not device count) is the ceiling.
- intersection
- The point where constraint lines cross — the single combination that satisfies all of them at once, i.e. the solution to the system. No intersection (parallel lines) means no solution; the constraints conflict.
- learning rate
- The step-size multiplier in gradient descent — the control loop's gain. There's a stability band: too high and the loss oscillates or diverges to NaN; too low and it crawls, wasting compute. Tuning it is most of getting a run to train.
- linear dependence
- When one equation (or row of a matrix) is just a rescaling/combination of another — it adds no new information. Dependent constraints are the redundant case of a singular matrix: the lines overlap, so there's no single answer.
- loss
- A single number that measures how wrong the model currently is. Training minimizes it — the objective you're driving toward zero, like tuning a system to minimize p99 latency.
- mantissa
- The precision bits of a float — how finely it can distinguish nearby values (vs. the exponent, which sets the range). bf16 keeps fp32's exponent but cuts the mantissa: coarser steps, same reach.
- matrix
- A 2-D grid of numbers — a rank-2 tensor, shape (rows, cols). Two indices reach a value. A layer's weight grid, or a routing table.
- mesh
- A grid of nodes linked to their immediate neighbors, with no wrap-around — so edge and corner nodes have fewer links and the farthest corners are many hops apart. Wrap it into a torus to cut the diameter.
- momentum
- Carrying a running average of past gradients so the step keeps some velocity — it smooths the zig-zag and speeds convergence, at the cost of extra per-parameter state the optimizer must store.
- mxu
- Matrix unit — the matrix-multiply engine at the heart of an AI accelerator: a grid of multiply-accumulators that computes one matrix tile (often 128×128) per pass. The reason tensor dimensions want to align to the hardware's tile size.
- network diameter
- The worst-case shortest path between any two nodes — the most hops a message ever has to make. Your tail-latency bound in hops. Closing a line into a ring (wrap-around) roughly halves it.
- neural network
- Many neurons wired in layers — inputs feed a hidden layer (or many), which feed an output. Stacking nonlinear neurons lets it learn complex, curved rules a single neuron can't. The whole thing is still just weights and biases trained by gradient descent.
- neuron
- The smallest unit of a model — a weighted sum of its inputs plus a bias, squashed by an activation function into a single number. Stack billions of these into layers and you have a modern neural network; each one's weights are learned, not hand-set.
- optimizer state
- The per-parameter bookkeeping an optimizer keeps between steps (e.g. Adam's momentum + variance, plus an fp32 master copy of the weights) — making mixed-precision Adam cost ~16 bytes per parameter, not 2. The memory footprint that often OOMs before the model itself does.
- padding
- The compiler zero-pads tensor dimensions up to the hardware's matrix-tile size (commonly 128, or 256 on some units) and the memory lanes (multiples of 8). A dimension just over a multiple silently rounds up — burning compute and on-chip memory on padded zeros, a common cause of surprise OOMs.
- parameters
- All the learned numbers in a model — its weights and biases together. Parameter count (e.g. '70B') is the headline size: it sets the checkpoint size, the HBM the weights need, and (with optimizer state) the training footprint.
- projection
- The 'shadow' a vector casts onto an axis — its component along that axis. Reading the three projections of an arrow gives the array [x, y, z] the computer actually stores; the bridge from geometry to a flat list of numbers.
- rank
- A tensor's number of dimensions — how many indices you need to pin down one value (a.k.a. ndim or order). Rank 0 is a scalar, 1 a vector, 2 a matrix, 3+ higher tensors. Each added dimension multiplies the element count (and the memory), so rank — not just size — drives the memory footprint. Note this is tensor rank, unrelated to the linear-algebra 'matrix rank' (number of independent rows).
- roofline
- The performance model that plots achievable FLOP/s against arithmetic intensity. The 'ridge' is where you flip from memory-bound to compute-bound: below it you're starved on bandwidth, above it you're saturating the chip. The whole game is getting above the ridge.
- scalar
- A single number — a rank-0 tensor, shape (). A learning rate or a loss value; no index needed to read it.
- sigmoid
- An activation function that squashes any number to the 0–1 range (an S-curve). Handy for turning a raw score into a probability-like value; a decision threshold of 0.5 splits the two classes.
- singular matrix
- A coefficient matrix whose constraints have no unique solution — because they conflict (parallel lines, no intersection) or repeat (identical lines, infinite intersections). Its determinant is 0, so it can't be inverted. A property of solving constraint systems (classical ML, optimization), not of neural-net training.
- system of equations
- Two or more constraints (linear equations) that must all hold at once. Its solution is the set of values that satisfies every one — geometrically, where the constraint lines intersect. Capacity planning is full of these: rack space AND budget AND power, all true together.
- tensor
- An N-dimensional array of numbers — a batch of inputs, a weight matrix, a layer's activations. Its shape (the size of each dimension) is what sets its memory footprint and how it tiles onto the hardware's matrix unit.
- topology
- The shape of a cluster's interconnect as a graph — which devices link to which. Common shapes: ring, mesh, torus (a wrapped mesh), and fat-tree/Clos (the spine-leaf fabric). The topology, not just raw link speed, sets how fast collectives like all-reduce run.
- torus
- A mesh whose rows and columns wrap around into rings, so every node has neighbors on all sides with no edge. The wrap-around shortens the worst-case path (diameter) and doubles the bisection versus a plain mesh of the same size.
- vector
- A 1-D list of numbers — a rank-1 tensor, shape (n,). One index reaches a value. An embedding, a row of activations, or the [x, y, z] components of an arrow.
- weight
- A learned number that scales one input to a neuron — how strongly that neuron listens to that signal. The weights (plus biases) ARE the model: the thing training adjusts, the thing a checkpoint saves, and the thing that fills HBM (billions of them in an LLM).