Individual skill
optimizing-attention-flash
Optimizes transformer attention with Flash Attention for 2-4x speedup and 10-20x memory reduction. Use when training/running transformers with long sequences (>512 tokens), encountering GPU memory issues with attention, or need faster inference. Supports PyTorch native SDPA, flash-attn library, H100 FP8, and sliding window attention.
10-optimization/flash-attention/SKILL.md
Source commit 773a52944ba4747a18bd4ae9ade53fff041adcbc
What was checked
- Matches the observed repository HEAD
- Yes
- Scanner rules are current
- No
- Repository scan complete
- No
- Skill scan complete
- No
- Observed behavior
- Not checked yet
- Last checked
- Nov 9, 2026
These are observations at the recorded commit, not a guarantee of safety. Review the source before running it.
Install this skill
Choose an agent in your Stack or copy a command below. Commands fetch the pinned commit and copy only this skill directory. Existing destinations are refused. Copying a command does not install anything.
An install command is unavailable: current rules, complete repository and skill scans, an eligible behavior level and a permitted license are required.
Repository context
- Repository stars (not skill ratings)
- 14,489
- Repository last updated
- Oct 11, 2026
- License
- MIT
Observed agent integration: No specific integration evidence. Standard SKILL.md installation does not imply verified compatibility.
- ai Repository topic
- ai-research Repository topic
- claude Repository topic
- claude-code Repository topic
- claude-skills Repository topic
- codex Repository topic
- gemini Repository topic
- gpt-5 Repository topic
- grpo Repository topic
- huggingface Repository topic
- optimization Declared skill tag
- flash-attention Declared skill tag
- attention-optimization Declared skill tag
- memory-efficiency Declared skill tag
- speed-optimization Declared skill tag
- long-context Declared skill tag
- pytorch Declared skill tag
- sdpa Declared skill tag
- h100 Declared skill tag
- fp8 Declared skill tag
- transformers Declared skill tag
- engineering Derived category
Files and excerpt
File metadata and permitted, redacted excerpts come from the recorded scan. Source links are pinned to that commit.
Browse files
SKILL.mdcore · 10,201 bytesSKILL.mdcore · 10,201 bytesSKILL.mdcore · 10,201 bytesSKILL.mdcore · 10,201 bytesSKILL.mdcore · 10,201 bytesSKILL.mdcore · 10,201 bytesSKILL.mdcore · 10,201 bytesSKILL.mdcore · 10,201 bytesSKILL.mdcore · 10,201 bytesSKILL.mdcore · 10,201 bytesSKILL.mdcore · 10,201 bytesSKILL.mdcore · 10,201 bytesSKILL.mdcore · 10,201 bytesSKILL.mdcore · 10,201 bytesSKILL.mdcore · 10,201 bytesSKILL.mdcore · 10,201 bytesSKILL.mdcore · 10,201 bytesSKILL.mdcore · 10,201 bytesSKILL.mdcore · 10,201 bytesSKILL.mdcore · 10,201 bytesSKILL.mdcore · 10,201 bytesSKILL.mdcore · 10,201 bytesSKILL.mdcore · 10,201 bytesreferences/benchmarks.mddoc · 7,129 bytesreferences/transformers-integration.mddoc · 7,427 bytes
Read excerpt
# 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+)**:
```python
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)