optimizing-attention-flash

Optimize transformer attention with Flash Attention for GPU training and inference.

97|8|Updated Mar 20, 2026
One-click install
npx skills add https://github.com/peteromallet/megaplan --skill optimizing-attention-flash-peteromallet
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: optimizing-attention-flash
Source: https://github.com/peteromallet/megaplan/tree/main/megaplan/agent/skills/mlops/training/flash-attention
Command: npx skills add https://github.com/peteromallet/megaplan --skill optimizing-attention-flash-peteromallet

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Transformer attention often bottlenecks training and inference due to memory usage and latency on long sequences. Flash Attention provides fast, memory-efficient attention to enable longer contexts and faster runs.

Core Features & Use Cases

  • Supports PyTorch native SDPA and the flash-attn library for speedups
  • Enables H100 FP8 and sliding window attention for long-context models
  • Applicable to both training and inference workflows to reduce memory footprint

Quick Start

Install flash-attn and configure your model to use Flash Attention for faster, memory-efficient attention during training or inference.

Frequently Asked Questions about optimizing-attention-flash

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

FAQPage Schema
How do I reduce PyTorch transformer memory usage and latency on long sequences?▼

Reduce transformer memory usage and latency by implementing Flash Attention, which delivers 2-4x speedups and major memory reductions during training and inference on long sequences.

Can I use Flash Attention for H100 FP8 and sliding window long-context models?▼

Yes, Flash Attention supports H100 FP8 and sliding window variants specifically to optimize long-context transformer models on compatible GPUs during both training and inference.

Does Flash Attention work with PyTorch native SDPA or do I need the flash-attn library?▼

Flash Attention works with both PyTorch native SDPA and the flash-attn library, allowing you to leverage fast, memory-efficient attention depending on your specific CUDA and PyTorch environment.

What's the best way to configure a transformer model for memory-efficient attention?▼

Configure your transformer model for memory-efficient attention by installing the flash-attn library and enabling Flash Attention to achieve faster execution and reduced memory footprint.

What CUDA and PyTorch versions are required to run Flash Attention on GPUs?▼

Running Flash Attention requires compatible CUDA and PyTorch versions to ensure your GPU supports the fast, memory-efficient attention operations needed for accelerated training and inference.