flashinfer-python
FlashInfer: Kernel Library for LLM Serving
What it is and what it does
FlashInfer is a kernel library and generator for high-performance LLM inference on NVIDIA GPUs. It provides unified APIs for attention (including paged/ragged KV-cache, decode, prefill, MLA, cascade, and sparse patterns), matrix multiplication (BF16, FP8, FP4), mixture-of-experts routing, and sampling operations. The library automatically selects the best backend—FlashAttention-2/3, cuDNN, CUTLASS, or TensorRT-LLM—for your hardware and workload.
It is designed for production serving with support for CUDAGraph and torch.compile, low-precision compute (FP8, FP4 quantization), and modern GPU architectures from Turing (SM 7.5) through Blackwell (SM 12.1). The package ships as a pure-Python wheel that compiles or downloads kernels on first use, with optional pre-compiled packages available for faster initialization and offline deployment.
Use it for:
- Accelerate attention computation in LLM inference servers (e.g., vLLM, SGLang, TensorRT-LLM).
- Optimize prefill and decode phases separately for mixed-batch serving scenarios.
- Deploy quantized (FP8/FP4) inference for memory-constrained or cost-sensitive GPU clusters.
- Implement custom attention patterns (sparse, cascade, MLA) without writing CUDA code.
- Reduce latency in speculative decoding and multi-node inference with AllReduce and NVSHMEM support.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
FlashInfer provides optimized GPU kernels for LLM inference operations—attention, GEMM, and mixture-of-experts—with support for multiple GPU architectures and low-precision quantization.
Yes. FlashInfer is worth installing if you are building or deploying LLM inference on NVIDIA GPUs. It is actively maintained, has no known vulnerabilities, carries a permissive license, and is already adopted by major projects (vLLM, SGLang, TensorRT-LLM). Install friction is low. The main constraint is GPU hardware: you must have an NVIDIA GPU with compute capability SM 7.5 or later and CUDA 12.6–13.1.
Install
flashinfer-python on PyPI
pip
pip install flashinfer-pythonuv
uv add flashinfer-pythonpoetry
poetry add flashinfer-pythonInstalling flashinfer-python
Before you install
Low friction; pure-Python wheel with optional pre-compiled kernel packages. Active maintenance with a release 3 days ago. Requires Python 3.10+, CUDA 12.6–13.1, and NVIDIA GPU with compute capability SM 7.5 or later.
License in practice
Apache-2.0 permissive license allows commercial and private use with minimal restrictions.
Quickstart
pip install flashinfer-python
import torch
import flashinfer
q = torch.randn(32, 128, device="cuda", dtype=torch.float16)
k = torch.randn(2048, 32, 128, device="cuda", dtype=torch.float16)
v = torch.randn(2048, 32, 128, device="cuda", dtype=torch.float16)
output = flashinfer.single_decode_with_kv_cache(q, k, v)
Requires NVIDIA GPU with compute capability SM 7.5 or later, CUDA 12.6–13.1, and Python 3.10+.
Verify before relying
- Whether pre-compiled kernel packages (flashinfer-cubin, flashinfer-jit-cache) are necessary for typical workloads or optional for faster startup.
- Performance gains relative to standard PyTorch attention on specific hardware (e.g., T4, A100, H100).
- Compatibility with non-NVIDIA GPUs or AMD ROCm.
Package facts
| License | Apache-2.0 (permissive) |
| Python support | supports the current Python release (<4.0,>=3.10) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 16 — apache-tvm-ffi, click, cuda-python, cuda-tile, einops, nccl4py, ninja, numpy, nvidia-cudnn-frontend, nvidia-cutlass-dsl, nvidia-ml-py, packaging, requests, tabulate, torch, tqdm |
| Maintenance | actively maintained — 3 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 5,180,758/month — #2,147 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: flashinfer_python-0.6.17-py3-none-any.whl
Tags
More Artificial Intelligence packages
LiteLLM provides a unified Python interface to…
permissive · top 100 on PyPI
huggingface-hubClient library and CLI tool for downloading,…
permissive · top 100 on PyPI
langchainLangChain provides a framework for building…
permissive · top 1,000 on PyPI
hf-xethf-xet provides chunk-based deduplication and…
permissive · top 1,000 on PyPI
tokenizersTokenizers converts raw text into token…
permissive · top 1,000 on PyPI
transformersTransformers provides a unified framework for…
permissive · top 1,000 on PyPI
flashinfer-cubinProvides pre-compiled GPU kernel binaries…
permissive · top 5,000 on PyPI
sageattentionSageAttention provides quantized attention…
permissive · top 15,000 on PyPI
fa3-fwdProvides a lightweight Flash-Attention-3…
permissive · top 15,000 on PyPI
tilelangTilelang is a domain-specific language for…
permissive · top 5,000 on PyPI
sgl-deep-gemmsgl-deep-gemm provides optimized GEMM (matrix…
permissive · top 15,000 on PyPI
sgl-kernelsgl-kernel provides optimized CUDA compute…
permissive · top 15,000 on PyPI
sglang-kernelsglang-kernel provides optimized CUDA compute…
permissive · top 15,000 on PyPI
tokenspeed-mlaProvides optimized MLA (Multi-head Latent…
permissive · top 5,000 on PyPI
nvidia-cudnn-frontendProvides Python and C++ APIs to NVIDIA's cuDNN…
permissive · top 5,000 on PyPI
humming-kernelsHumming is a JIT-compiled GEMM kernel library…
unclear · top 5,000 on PyPI