Optimizing Attention Flash
Flash Attention drop-in for transformers that cuts attention memory and speeds up long-sequence training and inference.
- CCM score
- 59 of 100
- skills.sh installs
- 1.1K
- GitHub stars
- 14.9K
- last updated
- Aug 21, 2026
Own this skill? Claim it
What it does
- Covers PyTorch native
F.scaled_dot_product_attentionand theflash-attnlibrary, with a step-by-step integration checklist and benchmarking workflow - Includes three workflows: enabling the backend in an existing model, using
flash_attn_funcfor multi-query and sliding-window attention, and FlashAttention-3 FP8 on H100 - Verifies correctness by comparing outputs against standard attention, with a float16 tolerance of under 1e-3
- Designed for transformers with sequences over 512 tokens, GPU out-of-memory errors in attention, or slow inference
Install
$ npx -y skills add orchestra-research/ai-research-skills --skill optimizing-attention-flash -yInstalls into .agents/skills for every agent it finds here, and .claude/skills for Claude Code.
Files
Flash Attention - Fast Memory-Efficient Attention
Quick start
Flash Attention provides 2-4x speedup and 10-20x memory reduction for transformer attention through IO-aware tiling and recomputation.
PyTorch native (easiest, PyTorch 2.2+):
import torch
import torch.nn.functional as F
q = torch.randn(2, 8, 512, 64, device='cuda', dtype=torch.float16) # [batch, heads, seq, dim]
k = torch.randn(2, 8, 512, 64, device='cuda', dtype=torch.float16)
v = torch.randn(2, 8, 512, 64, device='cuda', dtype=torch.float16)
# Automatically uses Flash Attention if available
out = F.scaled_dot_product_attention(q, k, v)
flash-attn library (more features):
pip install flash-attn --no-build-isolation
from flash_attn import flash_attn_func
# q, k, v: [batch, seqlen, nheads, headdim]
out = flash_attn_func(q, k, v, dropout_p=0.0, causal=True)
Common workflows
Workflow 1: Enable in existing PyTorch model
Copy this checklist:
Flash Attention Integration:
- [ ] Step 1: Check PyTorch version (≥2.2)
- [ ] Step 2: Enable Flash Attention backend
- [ ] Step 3: Verify speedup with profiling
- [ ] Step 4: Test accuracy matches baseline
Details
- Repository
- github.com/orchestra-research/ai-research-skills
- Categories
- Data Science & Analytics, AI Agents & LLM Apps
- First seen
- Jun 3, 2026
Questions
What does the optimizing-attention-flash skill do?
optimizing-attention-flash speeds up transformer attention with Flash Attention, reporting 2-4x speedup and 10-20x memory reduction through IO-aware tiling and recomputation. It supports PyTorch native SDPA, the flash-attn library, H100 FP8 and sliding window attention.
When should I use optimizing-attention-flash instead of standard attention?
The optimizing-attention-flash skill is aimed at training or running transformers with sequences longer than 512 tokens, or at GPU memory problems caused by attention. Its own guidance says standard attention is better for sequences under 256 tokens, where the overhead is not worth it.
How do I install the optimizing-attention-flash skill?
Run npx -y skills add orchestra-research/ai-research-skills --skill optimizing-attention-flash -y in your project to install optimizing-attention-flash. Once installed, the agent can apply Flash Attention to your existing PyTorch attention code.
What does optimizing-attention-flash need to run?
optimizing-attention-flash expects PyTorch 2.2 or newer and an NVIDIA GPU, since Flash Attention does not run on CPU. The flash-attn library is needed for advanced features, and H100 FP8 support requires an H100 or H800 GPU.
More from orchestra-research/ai-research-skills
All 92- Quantizing Models Bitsandbytes1.1K
- Deepspeed1.1K
- Dspy1.1K
- Grpo Rl Training1.1K
- Qdrant Vector Search1.1K
- Pytorch Fsdp21.1K
- Pytorch Lightning1.1K
- Transformer Lens Interpretability1.1K
- Axolotl1.1K
- Clip1.1K
- Langchain1.1K
- Sentence Transformers1.1K
- Huggingface Tokenizers1.1K
- Verl Rl Training1.1K
- Awq Quantization1.1K
- Nanogpt1.1K
- Instructor1.1K
- Long Context1.1K
- Presenting Conference Talks1.1K
- Speculative Decoding1.1K
- Hqq Quantization1.1K
- Model Merging1.1K
- Moe Training1.1K
- Sglang1.1K
Similar to Optimizing Attention Flash
More Data Science & AnalyticsoptimizationPluginOrchestra-Research/AI-Research-SKILLs14.8K starsModel optimization and quantization including Flash Attention, bitsandbytes, GPTQ, AWQ, GGUF, and HQQ. Use when reducing memory, accelerating inference, or quan
peft-fine-tuningSkillorchestra-research/ai-research-skills1.2K installsParameter-efficient fine-tuning for large language models, covering LoRA, QLoRA, and more than 25 adapter methods.
transformers-huggingfaceSkillmindrally/skills802 installsCoding guidance for Hugging Face Transformers, Datasets, and Tokenizers across NLP, vision, and multimodal models.
turboquant-pytorchSkillreason-machines/trending-skills772 installsTwo-stage PyTorch KV cache compressor that preserves attention inner products at 2 to 4 bits per coordinate.
train-sentence-transformersSkillhuggingface/skills1.8K installsGuided training for sentence-transformers bi-encoders, cross-encoders, sparse, and multi-vector models with production-ready templates.
llmSkillmindrally/skills767 installsBroad LLM development guidance covering architecture, fine-tuning, distributed training, evaluation, and deployment.