SHI-Labs/NATTEN
Fast Multi-dimensional Sparse Attention
What it solves
NATTEN addresses the high computational cost of standard self-attention, which typically scales quadratically with the number of tokens. It provides a way to introduce locality and sparsity into the attention mechanism, making it more efficient for multi-dimensional data like images (2D) and volumes (3D).
How it works
NATTEN implements Neighborhood Attention (NA), a sliding window self-attention mechanism. Similar to convolutions, it allows users to define a kernel_size, stride, and dilation to control the attention span in each dimension. It also supports causal masking to prevent tokens from attending to future tokens.
To achieve high performance, the project provides Fused Multi-Headed Attention (FMHA) and Fused Neighborhood Attention (FNA) kernels optimized for NVIDIA GPUs, including native kernels for Hopper (SM90) and Blackwell (SM100, SM103) architectures.
Who it’s for
It is designed for researchers and developers building Transformers for multi-dimensional feature maps, particularly those working with computer vision or 3D data processing.
Highlights
- Multi-dimensional support: Native support for 2D and 3D token layouts.
- High-performance kernels: Optimized fused kernels for all NVIDIA architectures from Maxwell (SM50) to Blackwell (SM100/103).
- Flexible configuration: Control over kernel size, stride, and dilation per dimension.
- Causal masking: Ability to toggle causal attention for multi-dimensional sparse attention.
Related
- Project
- Project
- Project
- Project
- Project