flash-attention

Implement optimized attention kernels for PyTorch and CUDA GPUs.

4|Updated May 6, 2026
One-click install
npx skills add https://github.com/jstzwj/ai-infra-plugins --skill flash-attention-jstzwj
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: flash-attention
Source: https://github.com/jstzwj/ai-infra-plugins/tree/main/plugins/flash-attention/skills/flash-attention
Command: npx skills add https://github.com/jstzwj/ai-infra-plugins --skill flash-attention-jstzwj

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires torch, ninja, and includes scripts (resource) and references (resource) components.

What problem does it solve?

FlashAttention tackles the high memory usage and slow runtimes of traditional attention mechanisms in large-scale AI models.

Core Features & Use Cases

  • Memory Efficiency: Reduces GPU memory footprint from quadratic to linear in sequence length.
  • Speed: Significantly accelerates attention computation, enabling training of longer sequences.
  • Use Case: For training a transformer model with 100k tokens per sequence, use FlashAttention to handle the data efficiently without exceeding GPU limits.

Quick Start

Load the flash attention module and perform sequence attention on your tensor inputs with a single function call.

Frequently Asked Questions about flash-attention

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

FAQPage Schema
How do I reduce GPU memory usage for long sequences in transformer models?

FlashAttention reduces GPU memory for long sequences by optimizing the attention kernel, scaling memory footprint from quadratic to linear in sequence length. It accelerates large language model training and inference.

Does FlashAttention require specific hardware or dependencies to run?

FlashAttention requires PyTorch and CUDA-compatible GPU hardware to run, along with the Torch and Ninja dependencies. It supports FP16, BF16, and FP8 datatypes for optimized memory bandwidth.

What is the best way to handle 100k tokens per sequence during model training?

The best way to handle 100k tokens per sequence is using FlashAttention to process large batch sizes efficiently. It minimizes memory overhead, preventing GPU limits from being exceeded during transformer training.

How does memory-efficient attention accelerate training for large language models?

Memory-efficient attention accelerates large language model training by minimizing memory bandwidth usage during computation. This allows the GPU to process extremely long sequences and large batch sizes significantly faster.

Can I use this optimized attention kernel for inference as well as training?

Yes, you can use this optimized attention kernel for both training and inference. It accelerates attention computation and reduces memory overhead for large language models across both operational phases.