flashinfer-python 0.7.0


pip install flashinfer-python

  Latest version

Released: Sep 22, 2026

Project Links

Meta
Author: FlashInfer team
Requires Python: <4.0,>=3.10

Classifiers

FlashInfer

High-Performance GPU Kernels for Inference

| Documentation | Latest Release | Blog | Slack | Discussion Forum |

Build Status Documentation

FlashInfer is a library and kernel generator for inference that delivers state-of-the-art performance across diverse GPU architectures. It provides unified APIs for attention, GEMM, and MoE operations with multiple backend implementations including FlashAttention-2/3, cuDNN, CUTLASS, and TensorRT-LLM.

Why FlashInfer?

  • State-of-the-art Performance: Optimized kernels for prefill, decode, and mixed batching scenarios
  • Multiple Backends: Automatically selects the best backend for your hardware and workload
  • Modern Architecture Support: Support for SM75 (Turing) and later (through Blackwell)
  • Low-Precision Compute: FP8 and FP4 quantization for attention, GEMM, and MoE operations
  • Production-Ready: CUDAGraph and torch.compile compatible for low-latency serving

Core Features

Attention Kernels

  • Paged and Ragged KV-Cache: Efficient memory management for dynamic batch serving
  • Decode, Prefill, and Append: Optimized kernels for all attention phases
  • MLA Attention: Native support for DeepSeek's Multi-Latent Attention
  • Cascade Attention: Memory-efficient hierarchical KV-Cache for shared prefixes
  • Sparse Attention: Block-sparse and variable block-sparse patterns
  • POD-Attention: Fused prefill+decode for mixed batching

GEMM & Linear Operations

  • BF16 GEMM: BF16 matrix multiplication for SM10.0+ GPUs.
  • FP8 GEMM: Per-tensor and groupwise scaling
  • FP4 GEMM: NVFP4 and MXFP4 matrix multiplication for Blackwell GPUs
  • Grouped GEMM: Efficient batched matrix operations for LoRA and multi-expert routing

Mixture of Experts (MoE)

  • Fused MoE Kernels
  • Multiple Routing Methods: DeepSeek-V3, Llama-4, and standard top-k routing
  • Quantized MoE: FP8 and FP4 expert weights with block-wise scaling

Sampling & Decoding

  • Sorting-Free Sampling: Efficient Top-K, Top-P, and Min-P without sorting
  • Speculative Decoding: Chain speculative sampling support

Communication

  • AllReduce: Custom implementations
  • Multi-Node NVLink: MNNVL support for multi-node inference
  • NVSHMEM Integration: For distributed memory operations

Other Operators

  • RoPE: LLaMA-style rotary position embeddings (including LLaMA 3.1)
  • Normalization: RMSNorm, LayerNorm, Gemma-style fused operations
  • Activations: SiLU, GELU with fused gating

GPU Support

Architecture Compute Capability Example GPUs
Turing SM 7.5 T4, RTX 20 series
Ampere SM 8.0, 8.6 A100, A10, RTX 30 series
Ada Lovelace SM 8.9 L4, L40, RTX 40 series
Hopper SM 9.0 H100, H200
Blackwell SM 10.0, 10.3 B200, B300
Blackwell SM 11.0 Jetson Thor
Blackwell SM 12.0, 12.1 RTX 50 series, DGX Spark

Note: Not all features are supported across all compute capabilities.

News

Latest: GitHub Release

Notable updates:

  • [2025-10-08] Blackwell support added in v0.4.0
  • [2025-03-10] Blog Post Sorting-Free GPU Kernels for LLM Sampling, which explains the design of sampling kernels in FlashInfer.

Getting Started

Installation

Quickstart:

pip install flashinfer-python

Package Options:

  • flashinfer-python: Core package that compiles/downloads kernels on first use
  • flashinfer-cubin: Pre-compiled kernel binaries for all supported GPU architectures
  • flashinfer-jit-cache: CUDA-specific shim that installs architecture-specific pre-built kernel providers

For faster initialization and offline usage, install the optional packages to have most kernels pre-compiled:

pip install flashinfer-python
flashinfer install-cubin-wheel
flashinfer install-jit-cache-wheel

For Blackwell (SM100+) CuTe DSL kernels, install with the CUDA 13 extra to enable Blackwell-optimized kernels:

pip install flashinfer-python[cu13]

Verify Installation

flashinfer show-config

Basic Usage

import torch
import flashinfer

# Single decode attention
q = torch.randn(32, 128, device="cuda", dtype=torch.float16)  # [num_qo_heads, head_dim]
k = torch.randn(2048, 32, 128, device="cuda", dtype=torch.float16)  # [kv_len, num_kv_heads, head_dim]
v = torch.randn(2048, 32, 128, device="cuda", dtype=torch.float16)

output = flashinfer.single_decode_with_kv_cache(q, k, v)

See documentation for comprehensive API reference and tutorials.

Install from Source

git clone https://github.com/flashinfer-ai/flashinfer.git --recursive
cd flashinfer
python -m pip install -v .

For development, install in editable mode:

python -m pip install --no-build-isolation -e . -v

Note: When using --no-build-isolation, pip does not automatically install build dependencies. FlashInfer requires setuptools>=77. If you encounter an error like AttributeError: module 'setuptools.build_meta' has no attribute 'prepare_metadata_for_build_editable', upgrade pip and setuptools first:

python -m pip install --upgrade pip setuptools

Build optional packages:

# flashinfer-cubin
python -m build --no-isolation --wheel flashinfer-cubin
python -m pip install flashinfer-cubin/dist/*.whl

Build one JIT-cache provider for the target GPU, then build a shim that depends on that provider. The example below builds an SM90a provider; both wheels must use the same version settings.

export FLASHINFER_JIT_CACHE_PROVIDER_ARCH=9.0a
python -m build --no-isolation --wheel flashinfer-jit-cache-provider

export FLASHINFER_JIT_CACHE_PROVIDER_ARCHS="9.0a"
python -m build --no-isolation --wheel flashinfer-jit-cache

python -m pip install \
  flashinfer-jit-cache-provider/dist/*.whl \
  flashinfer-jit-cache/dist/*.whl

For more details, see the Install from Source documentation.

Nightly Builds

pip install -U --pre flashinfer-python --index-url https://flashinfer.ai/whl/nightly/ --no-deps
pip install flashinfer-python  # Install dependencies from PyPI
flashinfer install-cubin-wheel --nightly
flashinfer install-jit-cache-wheel --nightly

CLI Tools

FlashInfer provides several CLI commands for configuration, module management, and development:

# Verify installation and view configuration
flashinfer show-config

# List and inspect modules
flashinfer list-modules
flashinfer module-status

# Manage artifacts and cache
flashinfer download-cubin
flashinfer install-cubin-wheel
flashinfer install-jit-cache-wheel
flashinfer download-kernels
flashinfer clear-cache

# For developers: generate compile_commands.json for IDE integration
flashinfer export-compile-commands [output_path]

For complete documentation, see the CLI reference.

API Logging

FlashInfer provides comprehensive API logging for debugging. Enable it using environment variables:

# Enable logging (levels: 0=off (default), 1=basic, 3=detailed, 5=statistics)
export FLASHINFER_LOGLEVEL=3

# Set log destination (stdout (default), stderr, or file path)
export FLASHINFER_LOGDEST=stdout

For detailed information about logging levels, configuration, and advanced features, see Logging in our documentation.

Custom Attention Variants

Users can customize their own attention variants with additional parameters. For more details, refer to our JIT examples.

CUDA Support

Supported CUDA Versions: 12.9, 13.0, and 13.4 (PyTorch nightly)

Note: FlashInfer strives to follow PyTorch's supported CUDA versions plus the latest CUDA release. CUDA 13.4 wheels are built with the preview toolkit and PyTorch nightly; runtime CI currently covers CUDA 12.9 and 13.0.

Adoption

FlashInfer powers inference in:

Acknowledgement

FlashInfer is inspired by FlashAttention, vLLM, stream-K, CUTLASS, and AITemplate.

Citation

If you find FlashInfer helpful in your project or research, please consider citing our paper:

@article{ye2025flashinfer,
    title = {FlashInfer: Efficient and Customizable Attention Engine for LLM Inference Serving},
    author = {
      Ye, Zihao and
      Chen, Lequn and
      Lai, Ruihang and
      Lin, Wuwei and
      Zhang, Yineng and
      Wang, Stephanie and
      Chen, Tianqi and
      Kasikci, Baris and
      Grover, Vinod and
      Krishnamurthy, Arvind and
      Ceze, Luis
    },
    journal = {arXiv preprint arXiv:2501.01005},
    year = {2025},
    url = {https://arxiv.org/abs/2501.01005}
}
0.7.0 Sep 22, 2026
0.7.0rc4 Sep 21, 2026
0.7.0rc3 Sep 16, 2026
0.6.18.post1 Sep 05, 2026
0.6.18 Aug 29, 2026
0.6.18rc10 Aug 28, 2026
0.6.17 Aug 11, 2026
0.6.17rc5 Aug 08, 2026
0.6.17rc1 Jul 31, 2026
0.6.16.post4 Aug 10, 2026
0.6.16.post3 Aug 08, 2026
0.6.16.post2 Aug 06, 2026
0.6.16.post1 Aug 02, 2026
0.6.16 Jul 31, 2026
0.6.16rc5 Jul 30, 2026
0.6.16rc4 Jul 29, 2026
0.6.16rc3 Jul 28, 2026
0.6.15.post1 Jul 21, 2026
0.6.15 Jul 17, 2026
0.6.14 Jul 02, 2026
0.6.13 Jun 24, 2026
0.6.13rc2 Jun 17, 2026
0.6.13rc1 Jun 10, 2026
0.6.12 May 29, 2026
0.6.12rc3 May 29, 2026
0.6.12rc2 May 26, 2026
0.6.12rc1 May 26, 2026
0.6.11.post3 May 15, 2026
0.6.11.post2 May 14, 2026
0.6.11.post1 May 13, 2026
0.6.11 May 09, 2026
0.6.11rc1 May 09, 2026
0.6.10.post1 May 07, 2026
0.6.10 May 04, 2026
0.6.10rc1 Apr 30, 2026
0.6.9 Apr 24, 2026
0.6.9rc1 Apr 23, 2026
0.6.8.post1 Apr 18, 2026
0.6.8 Apr 16, 2026
0.6.8rc1 Apr 14, 2026
0.6.7.post3 Apr 06, 2026
0.6.7.post2 Apr 04, 2026
0.6.7.post1 Apr 03, 2026
0.6.7 Mar 25, 2026
0.6.6 Mar 11, 2026
0.6.5 Mar 04, 2026
0.6.4 Feb 19, 2026
0.6.3 Feb 06, 2026
0.6.2 Jan 23, 2026
0.6.1 Jan 14, 2026
0.6.0 Jan 08, 2026
0.6.0rc2 Dec 20, 2025
0.6.0rc1 Dec 18, 2025
0.5.3 Nov 20, 2025
0.5.2 Nov 07, 2025
0.5.1 Nov 04, 2025
0.5.0 Nov 02, 2025
0.5.0rc3 Nov 01, 2025
0.5.0rc2 Oct 31, 2025
0.5.0rc1 Oct 30, 2025
0.4.1 Oct 14, 2025
0.4.0 Oct 09, 2025
0.4.0rc4 Oct 02, 2025
0.4.0rc3 Sep 24, 2025
0.4.0rc2 Sep 23, 2025
0.4.0rc1 Sep 19, 2025
0.4.0rc0 Sep 18, 2025
0.3.1.post1 Sep 26, 2025
0.3.1 Sep 05, 2025
0.3.0.post1 Sep 26, 2025
0.3.0 Sep 01, 2025
0.3.0rc1 Aug 29, 2025
0.2.14.post1 Aug 25, 2025
0.2.14 Aug 23, 2025
0.2.13 Aug 20, 2025
0.2.12 Aug 18, 2025
0.2.11.post3 Aug 14, 2025
0.2.11.post2 Aug 13, 2025
0.2.11.post1 Aug 11, 2025
0.2.11 Aug 10, 2025
0.2.10 Aug 05, 2025
0.2.9 Aug 05, 2025
0.2.9rc2 Jul 27, 2025
0.2.9rc1 Jul 23, 2025
0.2.8 Jul 21, 2025
0.2.8rc1 Jul 08, 2025
0.2.7.post1 Jul 01, 2025
0.2.7 Jun 30, 2025
0.2.6.post1 Jun 07, 2025
0.2.6 Jun 06, 2025
0.2.5 Apr 04, 2025
0.2.4 Mar 30, 2025
0.2.3 Mar 11, 2025
0.2.2.post1 Feb 27, 2025
0.2.2 Feb 23, 2025
0.2.1.post2 Feb 19, 2025
0.2.1.post1 Feb 14, 2025
0.2.1 Feb 13, 2025
0.2.0.post2 Jan 31, 2025
0.2.0.post1 Jan 09, 2025

Wheel compatibility matrix

Platform Python 3
any

Files in release

Extras:
Dependencies:
apache-tvm-ffi (<0.2,>=0.1.11)
click
cuda-python (>=12.0)
cuda-tile (>=1.4.0)
einops
nccl-extensions (>=0.1.0)
nccl4py (>=0.4.1)
ninja
numpy
nvidia-cudnn-frontend (>=1.29.0)
nvidia-cutlass-dsl (>=4.6.2a0)
nvidia-ml-py
packaging (>=24.2)
requests
tabulate
torch
tqdm