alexai-mcp/hermes-ccc/flash-attention
Claude Code and agent skill by alexai-mcp/hermes-ccc
- community
Checking that the SKILL.md file is still in the repository.
Optimize transformer attention with Flash Attention — 2-4x speedup, 10-20x memory reduction for long sequences on CUDA GPUs.
Install
npx vskill@latest install alexai-mcp/hermes-ccc/flash-attentionSKILL.md
Flash Attention — Fast Memory-Efficient Attention
Flash Attention provides 2-4x training speedup and 10-20x memory reduction by replacing the standard O(N²) attention with an IO-aware tiling algorithm.
When to Use
- Sequences longer than 512 tokens → always use Flash Attention
- GPU OOM during training → Flash Attention is usually the fix
- Maximizing training throughput → 2-4x faster than standard attention
- H100/A100 with FP8/BF16 → critical for efficiency
Option 1: PyTorch Native SDPA (Easiest — PyTorch 2.2+)
Option 2: flash-attn Library (Maximum Performance)
Option 3: Enable in HuggingFace Transformers
Hardware Requirements
| GPU | FP16 | BF16 | FP8 | |
|---|---|---|---|---|
| A100 | ✅ | ✅ | ❌ | |
| H100 | ✅ | ✅ | ✅ | |
| A10/A30 | ✅ | ✅ | ❌ | |
| RTX 3090/4090 | ✅ | ✅ | ❌ | |
| V100 | ✅ | ❌ | ❌ | |
| T4 | ✅ | ❌ | ❌ |
Requirements:
- CUDA 11.6+
- PyTorch 2.0+
- Ampere GPU or newer (RTX 30 series, A100, H100) for best performance
Sliding Window Attention (Long Context)
Memory Savings
Standard attention: O(N²) memory Flash Attention: O(N) memory (recomputes on backward pass)
Benchmarking
Common Issues
Build fails: Ensure CUDA toolkit matches PyTorch CUDA version (python -c "import torch; print(torch.version.cuda)")
Wrong dtype: Flash Attention requires FP16 or BF16, not FP32
OOM despite Flash Attention: Use gradient checkpointing additionally: model.gradient_checkpointing_enable()
Not faster on short sequences: Flash Attention shines at >512 tokens; below that overhead can dominate
Security
- Security scanPassed, 100 of 100Pattern checks on the skill's files.
- Model reviewNot runA model review is scheduled for the next rescan.
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/flash-attention/SKILL.md
Popularity
- 7-day trend score
- 0
Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/alexai-mcp/hermes-ccc/flash-attention)