flash-attention

Configure FlashAttention variants and alternative backends for CUDA GPUs.

Updated Aug 23, 2026
One-click install
npx skills add https://github.com/tylertitsworth/skills --skill flash-attention
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: flash-attention
Source: https://github.com/tylertitsworth/skills/tree/main/flash-attention
Command: npx skills add https://github.com/tylertitsworth/skills --skill flash-attention

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Enables selecting and configuring high-performance attention backends (FlashAttention 2/3, SDPA, PagedAttention, Ring Attention) for ML workloads on modern GPUs, reducing memory footprint and increasing throughput.

Core Features & Use Cases

  • Backend landscape overview for different GPUs, dtypes, and head dimensions.
  • Guidance on selecting between FA2, FA3, SDPA, and memory-efficient options like PagedAttention and Ring Attention based on workload (training vs inference) and hardware.
  • Practical integration tips with PyTorch and Hugging Face transformers to control the attention backend at runtime.

Quick Start

To begin, identify your GPU architecture and desired throughput and configure the appropriate attention backend in your training script or inference pipeline.

Frequently Asked Questions about flash-attention

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I select the best attention backend in PyTorch for high-throughput training?

PyTorch attention backend selection depends on your GPU architecture, dtype, and workload. FlashAttention 2 or 3 maximizes training throughput, while SDPA provides reliable fallbacks for unsupported hardware configurations or specific head dimension limits.

What is the difference between FlashAttention, SDPA, and PagedAttention for inference?

FlashAttention optimizes training and inference speed by reducing memory footprint. SDPA serves as a framework default fallback, whereas PagedAttention specifically optimizes KV-cache memory management for long sequence inference workloads on compatible CUDA-enabled GPUs.

Does FlashAttention 3 work with all GPU architectures and data types?

FlashAttention 3 does not work universally. Backend selection enforces strict compatibility checks validating specific GPU architectures, supported data types, and head dimension limits before applying the attention mechanism to your workload.

How do I configure Ring Attention for long sequence workloads in Hugging Face transformers?

To configure Ring Attention in Hugging Face transformers, apply runtime integration tips to select the appropriate attention backend. This optimizes memory efficiency for long sequences by leveraging framework defaults and optional features like window_size and alibi.

When should I use SDPA fallback instead of FlashAttention for my ML model?

Use SDPA fallback instead of FlashAttention when hardware compatibility checks fail due to GPU architecture, dtype, or head_dim limits. SDPA provides the framework default attention implementation when high-throughput FA2 or FA3 backends are unsupported.