← Questions
Floating-point formats for training and an ablation study
0
I was asked this
No reports yet. Sign in to say where you were asked it.
An AI/ML design interview question asked in Amazon's system design round, last asked Dec 2025. It tests numerics, mixed precision and experiments.
Compare the floating-point formats used to train and serve neural networks (FP32, TF32, FP16, BF16, FP8 and integer formats such as INT8), then design an experiment that shows which change in a training run caused a change in quality.
Requirements
- Part 1: for each format, its bit layout (sign, exponent, mantissa), its range and precision, its speed and memory cost on current accelerators, and when it is the right choice for training, fine-tuning or inference.
- Part 2: how you tell that a model is losing accuracy because of low precision (overflow, underflow, rounding) rather than something else, and what you do about it.
- Part 3: design an ablation study for a training run that changed several things at once (for example precision, optimizer and data mix), to find which change is responsible for a gain or loss.
Clarifying questions
- Training from scratch, fine-tuning, or inference only?
- Which hardware? FP8 and TF32 support depends on the accelerator.
- How much compute is there for the ablation: how many runs, at what scale?
What a strong answer covers
- FP16 has more mantissa bits but a narrow range, so gradients underflow without loss scaling; BF16 keeps FP32's range with less precision and usually needs no loss scaling; FP8 has two variants (E4M3 for weights and activations, E5M2 for gradients) and needs per-tensor scaling.
- Mixed precision: low-precision matrix multiplies with FP32 master weights, optimizer state and accumulation; which operations stay in FP32 (softmax, layer norm, loss).
- Detecting precision problems: NaN and Inf counts, loss spikes, the fraction of gradients that are zero or saturated, and comparing a few steps against an FP32 reference on the same batch and seed.
- Ablation design: change one factor at a time from a fixed baseline, or remove one change at a time from the final recipe; fixed seeds and data order, several seeds per arm to measure noise, small-scale runs first, and metrics chosen before the runs.
- Reading the result: interactions between factors, and effects smaller than seed-to-seed noise.
Follow-ups
- Training in BF16 diverges after 50,000 steps but FP32 does not. How do you find the cause?
- Quantising a model to INT4 for serving loses 2 points on a benchmark. What do you try?
- There is only budget for five runs. Which ones do you run?
Where it's asked
- Amazon · System design · Last asked Dec 202555 min · Design discussion
What it tests
numerics · mixed precision · experiments
No official answer yet. Draw yours on the right; publish it and it shows under Community.
Nothing published yet. Publish your canvas and it shows here for others to open and remix.
Draw your answer hereBoxes, arrows and notes, saved for you to come back to.Sign in to start drawing
