optimizing-attention-flash SKILL.md skillA

This file is byte-identical to the first copy the registry indexed, one of 4 indexed copies. Same content hash, so the same checks give both the same grade.

optimizing-attention-flash from jensen-yao/agents-skills is an agent skill: a SKILL.md folder an AI agent loads when a task calls for it.

Install it, pinned
mdr add jensen-yao/agents-skills/optimizing-attention-flash@v1.0.0

Pins v1.0.0 in mdr.lock. Pin the fingerprint instead.

Audit grade
A, 17 of 17 checks passed
Kind
SKILL.md skill
Repository
jensen-yao/agents-skills
Path
skills/flash-attention/SKILL.md
Versions recorded
1
Latest version
v1.0.0, committed Aug 15, 2026
Size
10,201 bytes
Repository stars
5
License
MIT

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.

Collected from public GitHub. Every version is saved exactly as it was and never changes. Install it at an exact version with the mdr tool, and every file is checked before it reaches your agent. The main file is checked against the SHA-256 fingerprint recorded here, and the others against the fingerprints GitHub keeps for its source commit. The automatic checks below grade the latest version, and the same checks always give the same file the same grade.

What the file says

# 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)

# Automatically uses Flash Attention if available
out = F.scaled_dot_product_attention(q, k, v)
```

**flash-attn library (more features)**:
```bash
pip install flash-attn --no-build-isolation
```

```python
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
```
…

Read the whole file at its exact version.

How to install

The exact contents, by fingerprint
mdr add jensen-yao/agents-skills/optimizing-attention-flash@sha256:e0c1da83766332e0

The line at the top of this page pins the label v1.0.0, which is what most people want. This one pins the sha256 fingerprint of the contents instead, so it survives a label being moved. Either way the exact version is written to mdr.lock, and mdr install downloads and checks those contents again, so it installs them exactly or stops with an error.

Badge

mdr badge

[![mdr](https://markdownregistry.com/badge/art_w4blupsf3nox3zq5.svg)](https://markdownregistry.com/a/art_w4blupsf3nox3zq5)

0 badge image fetches in 30 days. What the badge shows.

Versions

The registry has recorded 1 version of this file, committed on Aug 15, 2026.

versioncommittedcommitsizeaudit
v1.0.0 latest2026-08-15 3e2d588 10,201 BA view

Audit of the latest version

A  17 of 17 checks passed. Fixed automatic checks with no AI involved, so the same checks give the same answer every run.
  • pass: Frontmatter block present
  • pass: Frontmatter declares a name
  • pass: Frontmatter declares a description
  • pass: Size between 200 bytes and 200 KB (10201 bytes)
  • pass: No zero-width or bidi control characters
  • pass: No instruction hidden inside an HTML comment
  • pass: No link to an exfiltration or paste host
  • pass: No credential-shaped string
  • pass: No instruction to send local credentials anywhere
  • pass: No text hidden with inline styles
  • pass: No prompt-injection phrasing
  • pass: No curl or wget piped into a shell
  • pass: No recursive delete of root, home or parent
  • pass: No instruction to read or print local credentials
  • pass: No base64 blob over 200 characters
  • pass: No link to a raw IP address
  • pass: No script tag

Source

GitHub

jensen-yao/agents-skills · 5 stars · license MIT · pushed 2026-10-26 · branch main

API

GET https://markdownregistry.com/api/v1/artifacts/art_w4blupsf3nox3zq5
GET https://markdownregistry.com/api/v1/resolve?ref=jensen-yao/agents-skills/optimizing-attention-flash
GET https://markdownregistry.com/api/v1/blob/e0c1da83766332e0f3db4bcca954c3a70be399632758dcec2680aa82e236438d

Your AI assistant does the legwork. You hear about the deals worth your word. Hand yours the standing instructions at modelranch.com and it joins the network that reads files like this one.

Guides: the SKILL.md format and its required fields · what to check before you install a skill · how to pin a skill to an exact version · where to find agent skills · keeping a team on the same skills · which agent file does what.

More from jensen-yao/agents-skills

autoresearch SKILL.md skill
jensen-yao/agents-skills · skills/0-autoresearch-skill/SKILL.md · Orchestrates end-to-end autonomous AI research projects using a two-loop architecture. The inner loop runs rapid…
v1.0.0 · audit A · 5 stars
evolving-ai-agents SKILL.md skill
jensen-yao/agents-skills · skills/a-evolve/SKILL.md · Provides guidance for automatically evolving and optimizing AI agents across any domain using LLM-driven evolution…
v1.0.0 · audit A · 5 stars
academic-plotting SKILL.md skill
jensen-yao/agents-skills · skills/academic-plotting/SKILL.md · Generates publication-quality figures for ML papers from research context. Given a paper section or description…
v1.0.0 · audit A · 5 stars
huggingface-accelerate SKILL.md skill
jensen-yao/agents-skills · skills/accelerate/SKILL.md · Simplest distributed training API. 4 lines to add distributed support to any PyTorch script. Unified API for…
v1.0.0 · audit A · 5 stars
alibabacloud-find-skills SKILL.md skill
jensen-yao/agents-skills · skills/alibabacloud-find-skills/SKILL.md · Use this skill when users want to search, discover, browse, or find Alibaba Cloud (阿里云) agent skills. Triggers include…
git:20260815.3e2d588 · audit A · 5 stars
animation-vocabulary SKILL.md skill
jensen-yao/agents-skills · skills/animation-vocabulary/SKILL.md · Reverse-lookup glossary that turns a vague description of a web animation or motion effect into its exact term ("the…
git:20261026.7e4054d · audit A · 5 stars
app-shell-ui SKILL.md skill
jensen-yao/agents-skills · skills/app-shell-ui/SKILL.md · Build or restyle an explicit App Shell UI or macOS-style desktop-tool shell with shared navigation and light/dark…
git:20260817.88cdab2 · audit A · 5 stars
apple-design SKILL.md skill
jensen-yao/agents-skills · skills/apple-design/SKILL.md · Apply Apple's interface and physical-motion principles to gesture, spring, drag, swipe, sheet, momentum, material, or…
git:20261026.7e4054d · audit A · 5 stars
audiocraft-audio-generation SKILL.md skill
jensen-yao/agents-skills · skills/audiocraft/SKILL.md · PyTorch library for audio generation including text-to-music (MusicGen) and text-to-sound (AudioGen). Use when you need…
v1.0.0 · audit A · 5 stars
awq-quantization SKILL.md skill
jensen-yao/agents-skills · skills/awq/SKILL.md · Activation-aware weight quantization for 4-bit LLM compression with 3x speedup and minimal accuracy loss. Use when…
v1.0.0 · audit A · 5 stars
axolotl SKILL.md skill
jensen-yao/agents-skills · skills/axolotl/SKILL.md · Expert guidance for fine-tuning LLMs with Axolotl - YAML configs, 100+ models, LoRA/QLoRA, DPO/KTO/ORPO/GRPO…
v1.0.0 · audit A · 5 stars
baseline-ui SKILL.md skill
jensen-yao/agents-skills · skills/baseline-ui/SKILL.md · Apply a fast spacing, hierarchy, typography, and small-layout cleanup. Use only when explicitly invoked or selected by…
git:20260817.88cdab2 · audit A · 5 stars

Every file in jensen-yao/agents-skills

Other files named optimizing-attention-flash

optimizing-attention-flash SKILL.md skill
orchestra-research/ai-research-skills · 10-optimization/flash-attention/SKILL.md · Optimizes transformer attention with Flash Attention for 2-4x speedup and 10-20x memory reduction. Use when…
v1.0.0 · audit A · 14,233 stars
optimizing-attention-flash SKILL.md skill
yichen-zju/claude-for-research · claude/skills/flash-attention/SKILL.md · Optimizes transformer attention with Flash Attention for 2-4x speedup and 10-20x memory reduction. Use when…
v1.0.0 · audit A · 12 stars
optimizing-attention-flash SKILL.md skill
yichen-zju/claude-for-research · skills/flash-attention/SKILL.md · Optimizes transformer attention with Flash Attention for 2-4x speedup and 10-20x memory reduction. Use when…
v1.0.0 · audit A · 12 stars

Browse by kind, by grade A, or by owner.