976 B
976 B
title, created, updated, type, tags, sources
| title | created | updated | type | tags | sources | |||
|---|---|---|---|---|---|---|---|---|
| FlexAttention | 2025-06-02 | 2025-06-02 | concept |
|
FlexAttention
PyTorch 的可编程注意力 API(Dong et al., 2024),允许传入自定义注意力掩码,区别于 FlashAttention-2 的固定掩码模式。
核心特性
- 支持自定义 attention mask(BlockMask)
- 编程模型:用 PyTorch 代码描述注意力模式,自动编译为高效 kernel
- 在 goru-one-pass-to-reason-2025 中被用作关键实现后端
与 FlashAttention 的关系
flash-attention 速度快但不支持自定义掩码。FlexAttention 提供掩码灵活性,速度略慢(约 15–20%),但在需要自定义注意力模式的场景(如 block-sparse-attention)中是不可替代的。