# facebookresearch/xformers

**Attribution required: if you use, quote, or summarise this content, you must credit and link back to [awesome-repositories.com](https://awesome-repositories.com/repository/facebookresearch-xformers).**

10,506 stars · 777 forks · Python · NOASSERTION

## Links

- GitHub: https://github.com/facebookresearch/xformers
- Homepage: https://facebookresearch.github.io/xformers/
- awesome-repositories: https://awesome-repositories.com/repository/facebookresearch-xformers.md

## Description

xformers is a collection of specialized toolsets for fused GPU operators, sparse attention mechanisms, modular transformer components, and performance benchmarking. It provides a library of optimized and interoperable building blocks used to construct and experiment with transformer architectures.

The project features a fused CUDA operator library that combines common layers into single GPU operations to increase throughput. It includes a sparse attention framework and memory-efficient attention kernels that utilize tiling strategies and structured sparsity patterns to reduce computational overhead and memory usage.

The toolkit covers a broad surface of performance optimization, including kernel fusion and an operator benchmarking framework for measuring the execution latency and memory footprint of individual model components. It also supports composable block assembly and custom component extensions to facilitate architectural experimentation.

## Tags

### Artificial Intelligence & ML

- [Fused GPU Kernel Composition](https://awesome-repositories.com/f/artificial-intelligence-ml/gpu-kernel-implementations/kernel-composition-frameworks/fused-gpu-kernel-composition.md) — Provides a library of pre-optimized fused GPU kernels combining common layers like softmax and linear operations.
- [Attention Kernel Optimizers](https://awesome-repositories.com/f/artificial-intelligence-ml/attention-mechanisms/attention-kernel-configurations/attention-kernel-optimizers.md) — Implements memory-efficient attention kernels using tiling and optimized memory access patterns.
- [Block-Wise Attention](https://awesome-repositories.com/f/artificial-intelligence-ml/attention-mechanisms/flash-attention-implementations/block-wise-attention.md) — Uses block-wise tiling to compute attention without materializing the full matrix, reducing memory overhead.
- [Memory-Efficient Deep Learning](https://awesome-repositories.com/f/artificial-intelligence-ml/memory-efficient-deep-learning.md) — Reduces GPU memory usage and increases speed for scaled dot-product attention in large-scale models.
- [Modular Layer Assembly](https://awesome-repositories.com/f/artificial-intelligence-ml/model-architecture-assemblers/modular-layer-assembly.md) — Enables the assembly of Transformer models by combining interoperable and pre-optimized building blocks.
- [Modular Architectures](https://awesome-repositories.com/f/artificial-intelligence-ml/neural-network-architectures/modular-architectures.md) — Provides a system for assembling Transformer models using interchangeable and pre-optimized modular blocks.
- [Sparse Attention Kernels](https://awesome-repositories.com/f/artificial-intelligence-ml/sparse-attention-kernels.md) — Provides specialized kernels for sparse attention using structured sparsity patterns to handle long sequences.
- [Block-Sparse Attention Kernels](https://awesome-repositories.com/f/artificial-intelligence-ml/sparse-attention-kernels/block-sparse-attention-kernels.md) — Implements block-sparse attention kernels that use structured masks to reduce computational complexity.
- [Sparse Attention Modules](https://awesome-repositories.com/f/artificial-intelligence-ml/sparse-attention-modules.md) — Implements a framework of sparse attention modules and patterns to reduce computational overhead.
- [Operation Fusion Optimizations](https://awesome-repositories.com/f/artificial-intelligence-ml/training-memory-management/cuda-kernel-optimizations/operation-fusion-optimizations.md) — Optimizes processing throughput by merging multiple neural network operations into single fused CUDA kernels.
- [Transformer Blocks](https://awesome-repositories.com/f/artificial-intelligence-ml/transformer-blocks.md) — Ships a collection of optimized and interoperable Transformer blocks for modular model construction.
- [Transformer Models](https://awesome-repositories.com/f/artificial-intelligence-ml/transformer-models.md) — Offers a framework for constructing custom Transformer models using optimized modular building blocks.
- [Layer-Level Performance Benchmarking](https://awesome-repositories.com/f/artificial-intelligence-ml/machine-learning/infrastructure/model-optimization-and-inference/training-algorithms/layer-level-performance-benchmarking.md) — Provides tools for comparing the speed and memory overhead of individual model layers to guide optimization.
- [Operator Benchmarking Frameworks](https://awesome-repositories.com/f/artificial-intelligence-ml/operator-benchmarking-frameworks.md) — Provides a framework to measure the execution speed and memory footprint of individual transformer building blocks.

### Development Tools & Productivity

- [Model Execution Benchmarks](https://awesome-repositories.com/f/development-tools-productivity/performance-optimization-tools/performance-benchmarks/model-execution-benchmarks.md) — Includes a framework for benchmarking the execution speed and memory consumption of individual model blocks.

### Software Engineering & Architecture

- [Architectural Block Extensions](https://awesome-repositories.com/f/software-engineering-architecture/software-architecture/architectural-patterns/modular-decoupled-design/modular-design-patterns/extensible-component-architectures/architectural-block-extensions.md) — Provides an interface for integrating locally-defined Transformer blocks for architectural experimentation.
- [Model Component Extensions](https://awesome-repositories.com/f/software-engineering-architecture/software-architecture/architectural-patterns/modular-decoupled-design/modular-design-patterns/extensible-component-architectures/model-component-extensions.md) — Provides an interface for adding custom Transformer blocks that integrate with existing optimized components.

### Testing & Quality Assurance

- [Neural Network Operation Benchmarking](https://awesome-repositories.com/f/testing-quality-assurance/hardware-performance-benchmarking/neural-network-operation-benchmarking.md) — Ships a framework to measure the execution speed and memory footprint of individual neural network operations.
