# KohakuFA: Attention Kernel with Fixed Backward-Pass Precision

- **ID:** 1217
- **Kind:** code
- **URL:** https://github.com/KohakuBlueleaf/KohakuFA
- **Authors:** Kohaku Blueleaf (KohakuLab / ComfyOrg)
- **Venue:** GitHub release, announced 3 Oct 2026
- **Published:** 2026
- **Source:** github
- **Language:** en
- **Access:** free
- **Tags:** kohakufa, attention-kernel, backward-precision, flashattention, cudnn, fp16-instability, qknorm, training-stability
- **Topics:** attention kernels, mixed-precision, backward pass, FlashAttention, cuDNN, flex attention, training stability, fp16
- **Added:** 2026-10-03
- **Verified:** 2026-10-03
- **Page:** https://papers.projxon.ai/entries/1217

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

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

- [Broken Symmetry in BF16 Attention: Why FlashAttention Gradients Blow Up Late in Training](https://papers.projxon.ai/entries/1230) (paper, #1230)
- [You Need Better Attention Priors](https://papers.projxon.ai/entries/1216) (paper, #1216)
- [DualKV: Shared-Prompt Flash Attention for Efficient RL Training with Large Rollouts and Long Contexts](https://papers.projxon.ai/entries/500) (paper, #500)
- [xattn](https://papers.projxon.ai/entries/782) (code, #782)
- [EasyPPO: Stabilizing the Critic Is Key](https://papers.projxon.ai/entries/792) (paper, #792)
- [ID Balancing: Stable Training of Extremely Sparse MoE via PID-Based Load Control](https://papers.projxon.ai/entries/833) (paper, #833)
