Skip to content
AI & Machine Learning Rich #mixed-precision#fp16#bf16

Mixed Precision Training

Compute in fp16/bf16, accumulate in fp32. Half the memory, near-full quality.

A free, animated mixed precision training you can read here or embed on any website, from Scrollchart.

Mixed Precision Training

Mixed Precision Training (AMP)fp16/bf16 compute with fp32 master weights: 2x tensor-core speed, near-identical convergenceMemory per Parameter (bytes)AMP saves ~40% GPU memory vs fp32; GPT-3 and LLaMA-2 train in bf16 with fp32 master weights and AdamW moments

Forward pass in fp16/bf16 (fast tensor cores). Loss scaled to keep gradients above fp16 underflow threshold. Gradients converted to fp32 for the optimizer step on master weights. Memory layout side-by-side: full fp32, full fp16, mixed precision. fp16 vs bf16 dynamic range chart annotated.

Good for

  • Training-speedup tutorials
  • Multi-GPU efficiency content
  • LLM infrastructure guides covering memory and throughput tradeoffs

Source & accuracy

This mixed precision training is an editorial illustration built to represent the concept accurately. Where it shows figures, they are typical or representative values chosen to make the relationship clear, not a single underlying dataset. The diagram and its explainer are reviewed and maintained centrally, and updated over time as understanding improves.

Computing in lower precision to save memory

Float32 (standard precision) uses 4 bytes per number; float16 (half precision) uses 2 bytes. Half the memory overhead is huge at scale: a 100-billion parameter model in fp32 requires 400GB of memory, while fp16 requires 200GB. This difference often determines whether training fits on available hardware.

The catch: fp16 has less numerical precision and smaller range. Very small gradients underflow to zero, and large values overflow. Mixed precision solves this: compute forward and backward passes in fp16 (fast, compact), but keep a master weight copy in fp32 for the optimizer step.

Maintaining numerical stability

Loss scaling is the key trick: multiply loss by a large scale factor (e.g., 2^16) before computing gradients in fp16. This shifts all gradient values to larger, representable numbers. After computing gradients, unscale them back. The scale factor is dynamic: if overflow occurs, reduce the scale; if no overflow, increase it.

With proper loss scaling, mixed precision achieves near-identical convergence curves to pure fp32, with the memory and speed benefits of fp16.

When to use which precision

Bfloat16 (brain float) offers better stability than fp16 because it preserves the full fp32 range, only losing precision in the mantissa. Modern GPUs (NVIDIA's A100+, Google TPUs) support bfloat16. If available, prefer it over fp16. Standard fp32 is reserved for the optimizer state and master weights, not the compute path.

Embed this diagram

Add this animated mixed precision training to your own site. Copy one line of HTML, or use the embed builder for theme and sizing options.

Reference

What this is
A free, embeddable, animated mixed precision training for any website.
Who uses it
AI/ML blogs, DevOps / SRE sites.
How to embed
Copy one line of HTML. No signup. No watermark. Works in WordPress, Webflow, Ghost, Substack, plain HTML.
File size
iframe embed, ~80 KB gzipped (loads on demand, does not block your page paint).
License
Free forever. Editorial explainer text included; updated centrally over time.

Embed format options

Copy the universal HTML snippet, the WordPress shortcode, or an iframe fallback - see the WordPress plugin page for details. Any format keeps the same Core Web Vitals profile and the same explainer text.

Embed snippet
<div data-scrollchart="mixed-precision" data-scrollchart-v="1"></div>
<script src="https://scrollchart.com/embed.js" async></script>

Frequently asked questions

Where can I get a free animated "Mixed Precision Training" for my website?
Scrollchart provides "Mixed Precision Training" as a free, embeddable animated diagram you can add to any website with one line of HTML. No signup is required and there is no watermark. The diagram and its explainer text are served from scrollchart.com, so the embed stays current without any maintenance on your end.
How do I embed a mixed precision training in a developer or tech blog?
Copy the one-line snippet from the Scrollchart diagram page and paste it into your post HTML. It works in any static site generator, CMS, or hand-coded HTML page. The embed is a thin loader, not an iframe, so the content is fully in your DOM.