KohakuFA: Attention Kernel with Fixed Backward-Pass Precision
Summary
New attention kernel claiming severe backward-pass precision bugs in cuDNN SDPA, FlashAttention-4, and flex attention: when attention logits get huge (DINOv3 reportedly hits ~1e5 out of the box), backward gradients can be wrong by 10-1000x or become inf, while forward and loss look completely normal — so instability surfaces only late in training when reruns are expensive. Implication: some reported fp16 instability, QKNorm benefits, or 'failed runs' may be kernel artifacts, not model-design flaws. KohakuFA fixes 3 precision bugs, keeping gradients at the fp16 error floor for ~5% extra cost; fast for ViT/DiT/video. Figures: DINOv3 ViT-B/16 fine-tuning backward error over training — FA4 highest error (~0.05-0.6), KohakuFA tracks the fp64 correct-kernel floor; whole-model fp16 gradient vs fp64 across 50k-200k steps — cuDNN SDPA gradients collapse after ~100k-125k steps (cosine→0, relative error >10x), KohakuFA stays near-correct. Blackwell (SM100) only for now; sm120 support planned (flex attention reportedly has the same issue on sm120). Directly relevant to user's training-run debugging (CUDA OOMs aside, kernel-precision bugs are the same class of hard-to-diagnose training instability).
- Venue
- GitHub release, announced 3 Oct 2026
- Source
- github
- Access
- free
- Language
- en
- Added
- Oct 3, 2026
- Verified
- Oct 3, 2026
- Found via
- #random-papers
Tags
Topics
attention kernels, mixed-precision, backward pass, FlashAttention, cuDNN, flex attention, training stability, fp16
Research notes
- Discovery: @KBlueleaf (Kohaku Blueleaf, graduate student in Taiwan, leader of KohakuLab, researcher/dev in ComfyOrg) X thread 2026-10-03 1:51 PM ET (https://x.com/KBlueleaf/status/2106441948722868685), ~1.8K views, 3 self-thread replies
- No arXiv/HF/blog links at announcement time
Similar entries
- Paper Broken Symmetry in BF16 Attention: Why FlashAttention Gradients Blow Up Late in Training
- Paper You Need Better Attention Priors
- Paper DualKV: Shared-Prompt Flash Attention for Efficient RL Training with Large Rollouts and Long Contexts
- Code xattn
- Paper EasyPPO: Stabilizing the Critic Is Key
- Paper ID Balancing: Stable Training of Extremely Sparse MoE via PID-Based Load Control