mixed-precision
What it does
The skill explains how to train with lower-precision numbers safely. It is for practitioners who want faster training or lower memory use on a GPU.
When to use it
- ✓When you want to speed up training or reduce GPU memory use.
- ✓When you choose between FP16 and BF16 on a modern GPU.
- ✓When training produces NaN gradients and you need to stabilize it.
Skill link
https://github.com/aiming-lab/AutoResearchClaw/blob/main/researchclaw/skills/builtin/tooling/mixed-precision/SKILL.mdCopy it and paste it into your AI (Claude, ChatGPT or Cursor), asking it to follow the instructions.
How to use
The easiest way: copy the message and paste it into your AI. It reads the skill and follows the instructions.
Ready-to-paste message
For Claude Code, Codex or Cursor: run it in your project folder and the skill gets installed.
Download the SKILL.md and drop it into your agent’s skills folder.
Example of what to ask your AI
“Turn on mixed precision for my PyTorch training loop and fix the NaN losses I am seeing.”
5 new skills a week. 1 minute to read.
How it works
The agent wraps the forward pass in autocast, uses a gradient scaler for loss scaling, and prefers BF16 on newer GPUs. It also advises lowering the learning rate if gradients become NaN.
Technical content (original SKILL.md)
Original text by the author, straight from GitHub.
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
FAQ
Which is better, FP16 or BF16?
The skill prefers BF16 on Ampere and newer GPUs.
What should I do about NaN gradients?
The skill suggests reducing the learning rate when NaN gradients appear.
Is it safe with custom CUDA kernels?
Not unless they have been tested with mixed precision, according to the skill.
Details
Original description by the author
Use FP16/BF16 mixed precision to accelerate training and reduce memory. Use when optimizing GPU performance.
Popularity
- GitHub stars
- 15k
- Ranking position
- #11076
- License
- MIT
- Updated
- 8/19/2026
Comments
- …
More skills from this repository
a-evolve
15kHelps your agent improve over repeated runs by diagnosing failures, creating targeted skills from error patterns, and recording lessons for later use.
biology-biopython
15kHelps your agent work with DNA, RNA, and protein sequences using Biopython, including file parsing, sequence calculations, BLAST searches, and database access.
chemistry-rdkit
15kHelps your agent analyze molecules written as SMILES strings with RDKit, including descriptors, fingerprints, similarity, and substructure search.
hypothesis-formulation
15kHelps your agent turn an observation into testable hypotheses, with competing explanations and clear predictions that could prove them wrong.
Similar skills
pytorch-patterns
280kHelps your agent use PyTorch for machine learning models. It applies best practices for efficient model training and ensures reproducible results.
evm-token-decimals
280kHelps your agent avoid errors with decimal numbers across different blockchain networks. It ensures token values are accurate in transactions and calculations.
ito-inference
280kLets your agent check the availability of AI models for use. It connects the compute request with the ready model service.