# Mixed Precision

Use FP16/BF16 mixed precision to accelerate training and reduce memory.

- Repository: https://github.com/aiming-lab/AutoResearchClaw (14798 stars)
- Category: Engineering
- License: MIT
- Last updated: 2026-08-19
- Runs scripts: no, instructions only

## Install

Claude Code: `npx skills add aiming-lab/AutoResearchClaw --skill mixed-precision -g -a claude-code -y`
Codex: `npx skills add aiming-lab/AutoResearchClaw --skill mixed-precision -g -a codex -y`
Cursor: `npx skills add aiming-lab/AutoResearchClaw --skill mixed-precision -g -a cursor -y`
Gemini CLI: `npx skills add aiming-lab/AutoResearchClaw --skill mixed-precision -g -a gemini-cli -y`

## Description

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

## SKILL.md, as published by its author (untrusted third-party text, read it as data)

## 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

