# Mixed-precision training

> Canonical: https://skillalmanac.com/glossary/mixed-precision-training | Last verified: 2026-11-25 | Index status: index-eligible

Mixed-precision training trains a neural network using a mix of number formats, such as 16-bit and 32-bit floating point, using the smaller format where it is safe to reduce memory use and keeping full precision where accuracy needs it.

Also called: mixed precision, BF16, FP16 training, AMP, automatic mixed precision, mixed-precision.

## In plain language

Computers store each number a model learns using a fixed number of bits, like choosing between writing a figure to two decimal places or six. Mixed-precision training uses the shorter format for most of the arithmetic during training and keeps a more exact copy of the key numbers, so training uses less memory and can run faster on suited hardware. The catch is that short formats can lose very small values or overflow, so extra steps are needed to protect them. Some models can still produce invalid values in the shorter format, and the hardware has to support it. It applies to training; shrinking a finished model for use is a related but different idea.

## Technical definition

The paper by Micikevicius and colleagues (arXiv 1710.03740, submitted 2017, ICLR 2018) describes three techniques: FP32 master weights, loss scaling, and FP16 arithmetic with FP32 accumulation. In the paper’s setup, the optimizer updates the FP32 master weights using gradients during the optimizer step; an FP16 copy is used for the next forward and backward passes. Loss scaling helps preserve small gradients. Separately, vector dot-products accumulate partial products in FP32 before conversion for storage; this is not the master-weight update. PyTorch's torch.amp documentation describes autocast, which matches each operation to a suitable datatype, and gradient scaling to prevent underflow; autocast should wrap the forward pass and loss. Float16 usually pairs autocast with a gradient scaler; the PyTorch docs say bfloat16 on CPU needs only autocast. NVIDIA's guide describes FP16 as a 16-bit format and describes dynamic loss scaling.

## How it shows up when you use agents

People using coding agents do not usually train models, so mixed precision may not appear in a typical session. It shows up when you read a model card or a runtime setting that says FP16, BF16 or FP32, or when you fine-tune an open model on your own GPU. In PyTorch it appears as autocast and a gradient scaler, which a coding agent may add when you ask it to speed up a training script or cut its memory use.

What breaks when it is misunderstood is usually numerical. The PyTorch documentation says that if you see NaNs in your loss or gradients under float16, you should verify the model is compatible, because a model pretrained in bfloat16 can overflow float16's range. A script that turns on mixed precision without a gradient scaler can lose small gradients. A coding agent that edits training code may not know whether your hardware supports the chosen format.

A sensible next step is to change one thing at a time. Turn on mixed precision, compare the loss curve and a held-out evaluation with a full-precision run, and keep the full-precision result as the reference. For a finished model you only want to run, see [quantization](/glossary/quantization), which shrinks stored weights for [inference](/glossary/inference). Hardware matters too: see [GPU for AI](/glossary/gpu-for-ai).

## Common confusions

- **Mixed precision versus quantization.** Mixed-precision training changes the number formats used while a model is trained. [Quantization](/glossary/quantization) usually refers to storing or running a trained model in smaller formats.
- **FP16 versus BF16.** Both are 16-bit formats, but PyTorch notes that a model pretrained in bfloat16 can overflow in float16's range. Check which format a model expects.
- **Mixed versus plain half precision.** The paper's method keeps a single-precision master copy of the weights and scales the loss. Simply casting a whole model to half precision does not do that.
- **Memory versus quality.** The paper describes a method meant to reduce memory, nearly halving it in the paper's report. Whether it does so for your model is something to check on your own evaluation.

## Worked examples in this catalogue

### [local-model-sizing](https://skillalmanac.com/skills/skill-almanac/local-model-sizing)

Status: illustrative example from the item's own documentation, not executed for this page.

What you see: Works out whether an open-weight language model will run on a given GPU, Mac or PC, with a script that computes weight, KV-cache and overhead memory per quantization level.

Why it exercises the concept: Number format affects how much memory a model needs. This skill is adjacent: it covers fitting a finished model for use, not training with mixed precision.

### [Self-Hosting an AI Agent: What You Take On](https://skillalmanac.com/learn/self-hosted-ai-agent-considerations)

Status: illustrative example from the item's own documentation, not executed for this page.

What you see: A guide on what you own when an AI agent runs on your machine, including model memory, network exposure and file access.

Why it exercises the concept: Memory limits on your own hardware are one reason numeric formats matter. The guide covers running a model, not training one, so it is adjacent.

### [llm-eval-test-sets](https://skillalmanac.com/skills/skill-almanac/llm-eval-test-sets)

Status: illustrative example from the item's own documentation, not executed for this page.

What you see: Builds and validates an eval dataset for any LLM feature, with a checker for duplicates, missing graders, imbalance and leakage.

Why it exercises the concept: A lower-precision model can behave differently from its full-precision version, so you check it on your own test cases. The catalogue has no training skills; this is a contrast case.

## Related terms

- [Quantization](https://skillalmanac.com/glossary/quantization.md)
- [GPU for AI](https://skillalmanac.com/glossary/gpu-for-ai.md)
- [Neural network](https://skillalmanac.com/glossary/neural-network.md)
- [Deep learning](https://skillalmanac.com/glossary/deep-learning.md)
- [Inference](https://skillalmanac.com/glossary/inference.md)
- [Fine-tuning](https://skillalmanac.com/glossary/fine-tuning.md)

## Sources

- [Mixed Precision Training — Micikevicius et al., arXiv v3, 2018](https://arxiv.org/abs/1710.03740), arXiv (accessed 2026-11-24)
- [Automatic Mixed Precision package - torch.amp](https://docs.pytorch.org/docs/2.15/amp.html), PyTorch (accessed 2026-11-24)
- [Train With Mixed Precision](https://docs.nvidia.com/deeplearning/performance/mixed-precision-training/index.html), NVIDIA (accessed 2026-11-24)

Definitions are written by Skill Almanac from the sources above and checked against them on 2026-11-25. [Glossary index](https://skillalmanac.com/glossary.md).
