# Mixed Precision

> Use FP16/BF16 mixed precision to accelerate training and reduce memory. Use when optimizing GPU performance.

- Skill: `thada2402/mixed-precision` (Agent Skill)
- Install (CLI): `npx skillmds@latest add thada2402/mixed-precision`
- Raw SKILL.md: https://api.skillmd.com/api/skills/thada2402/mixed-precision/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Coding & Dev Tools
- Author: thada2402 (https://skillmd.com/u/thada2402)
- Updated: 2026-09-17
- Page: https://skillmd.com/skills/thada2402/mixed-precision

---


## Mixed Precision Training Best Practice
Use torch.cuda.amp for automatic mixed precision:
- Wrap forward pass in torch.cuda.amp.autocast()
- Use GradScaler for loss scaling
- BF16 preferred over FP16 on Ampere+ GPUs (RTX 3xxx, A100, RTX 4xxx)
- Watch for NaN gradients — reduce learning rate if needed
- Do NOT use amp with custom CUDA kernels unless tested

