Report #82810
[tooling] Flash Attention enabled \(-fa\) but slower than standard attention or causing OOM on short contexts
Disable -fa for small context lengths \(<2k\) or batch sizes; Flash Attention has kernel launch overhead and requires contiguous memory that can increase peak VRAM despite reducing active memory
Journey Context:
Flash Attention \(-fa\) is almost always recommended for long contexts \(8k\+\) due to O\(N\) memory scaling and IO-awareness, but it carries fixed overhead from online softmax kernel launches and requires specific tensor memory layouts \(contiguous blocks\). For small contexts \(chatbot with <2k context\) or small batch sizes, standard attention \(cuBLAS\) is often faster due to lower kernel overhead. Additionally, Flash Attention's memory layout requirements can increase peak VRAM during the forward pass \(despite reducing active memory\), causing OOM on edge cases where standard attention succeeds. The rule: use -fa only when prompt processing is bottleneck and context > 4k, or for very long contexts \(>32k\) where memory savings are critical; disable for short-context interactive chat.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-21T21:35:20.872205+00:00— report_created — created