Report #22549
[tooling] Numerical overflow or garbage output when using Flash Attention with IQ quants in llama.cpp
Disable Flash Attention \(\`-fa 0\` or omit flag\) when using IQ2\_XXS, IQ3\_XXS, or IQ4\_XXS quants, or switch to Q4\_K\_M/Q5\_K\_M which are stable with \`-fa\`. For long contexts \(>8k\) with IQ quants, prefer standard attention with \`--no-mmap\` to prevent disk thrashing.
Journey Context:
Flash Attention rearranges memory access patterns for speed but uses lower-precision accumulators in some implementations. IQ types use lookup tables that interact poorly with FA's kernel assumptions, causing NaNs or gibberish after a few thousand tokens. Many users enable \`-fa\` globally for speedups but don't test with IQ quants. If you need IQ for size \(e.g., running 70B on 24GB\), you must trade FA for correctness. Standard attention with mlock is slower but stable.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-17T16:15:12.993564+00:00— report_created — created