pegainfer is a free, open source machine learning infrastructure project written in Rust and released under Apache-2.0. It has 704 GitHub stars, 107 forks and 89 open issues, and was last pushed 5 hours ago. On this registry it ranks #53 of 57 tracked projects in Machine Learning Infrastructure, with 5 head-to-head comparisons available. It gained 6 stars over the last 3 tracked days.

What is pegainfer?

PegaInfer is a pure Rust and CUDA large language model inference engine that serves models ranging from Qwen3 to Kimi-K2 behind an OpenAI-compatible API, with no PyTorch or Python runtime in the default serving path.

What it is

PegaInfer is an inference engine written in Rust that runs large language models directly on NVIDIA GPUs through hand-written CUDA kernels. Each model owns its own scheduler, state, and kernels, while the serving layer and KV cache infrastructure are shared across models. The engine ships as a server binary named pegainfer (with pegainfer-server as the server entrypoint, and model crates holding model implementations and diagnostics), and it exposes an OpenAI-compatible HTTP API, so existing clients can point at it without protocol changes.

The concrete problem it addresses is the Python and PyTorch runtime layer that usually sits between a model checkpoint and a GPU. PegaInfer removes that layer for the default Qwen3 build: the release bundles CUDA 13 and cuBLAS, and the compiled binary serves the model with no Python interpreter involved. It replaces the common pattern of a Python inference stack — the same role that vLLM occupies, which PegaInfer benchmarks against directly. The ecosystem it lives in is GPU-accelerated LLM serving for Rust and CUDA, distributed under Apache-2.0.

Key capabilities

  • Serves multiple model families from one engine: Qwen3, Qwen3.5, Gemma 4 26B-A4B, GLM-5.2, DeepSeek, and Kimi-K2, with K3 kernels generated through TileLang.
  • Exposes an OpenAI-compatible API, with the server listening on port 8000 by default.
  • Ships a prebuilt binary installed by install.sh, bundling CUDA 13 and cuBLAS for the Qwen3-only release; PEGAINFER_VERSION pins an exact release instead of the latest.
  • Runs without a Python runtime on the default Qwen3 build; the model crates separate implementation from diagnostics.
  • Supports model-specific kernel compilation paths: Qwen3.5 uses Triton AOT kernels, and K3 uses TileLang kernel generation.
  • Configures builds through environment variables including CUDA_HOME, PEGAINFER_CUDA_SM for explicit GPU architecture targets, PEGAINFER_TRITON_PYTHON, and PEGAINFER_TILELANG_PYTHON.
  • Supports distributed serving topologies, including co-located EP4 across 4 GPUs and disaggregated TP4 prefill plus EP4 decode across 8 GPUs total for GLM-5.2.

Who uses it and how

  • Single-GPU deployments: Qwen3-4B served in BF16 with TP1 on one RTX 5090, benchmarked against vLLM 0.24.0.
  • Concurrency-driven capacity planning: Qwen3.5 at 8B, 2B, 9B, and 27B measured in a GH200 concurrency sweep using random 1,024-token prompts and 128-token outputs.
  • Long-context and MoE workloads: Gemma 4 26B-A4B served in four-round long-context reports with BF16 KV cache.
  • Multi-GPU cluster serving: GLM-5.2 with native MTP, either co-located on 4 GPUs or split across 8 GPUs for prefill and decode.
  • Windows developers building from source through PowerShell with cargo run --release -p pegainfer-server.

Getting started

Install the prebuilt Qwen3 release with curl -fsSL https://raw.githubusercontent.com/pegainfer-project/pegainfer/main/install.sh | bash, download Qwen3-4B into models/Qwen3-4B, then run pegainfer --model-path models/Qwen3-4B. Source builds use the toolchain pinned in rust-toolchain.toml and cargo run --release -- --model-path models/Qwen3-4B, with --release required for GPU builds.

How it compares

The README benchmarks PegaInfer directly against vLLM 0.24.0, measuring Qwen3-4B serving footprint on a single RTX 5090 in BF16 with TP1, and running separate BF16 and default-FP8 vLLM comparisons. PegaInfer is Apache-2.0 and self-hosted, with model weights downloaded separately rather than bundled.

When to use it — and when not to

A self-hoster must supply the hardware and toolchain: Linux x86_64, an NVIDIA GPU with compute capability 8.x through 12.x, driver 580 or newer, glibc 2.35 or newer, and OpenSSL 3 for the prebuilt binary, plus a CUDA Toolkit with nvcc and cuBLAS and a compatible driver for source builds. Qwen3.5 additionally requires Python and Triton at build time, and K3 requires Python and TileLang, so builds that need those kernel paths are not Python-free. If the target platform is not Linux x86_64, or the team cannot manage CUDA driver floors, this engine is a poor fit; the repository also carries 89 open issues, and several model lines come with their own build requirements that a reader must verify before committing.

project readme (upstream, from github) — read inline

Docs and engineering blog Join the PegaInfer Slack Apache 2.0 license

Quickstart · Performance · Models · Architecture · API · Development

PegaInfer serves LLMs through an OpenAI-compatible API. Each model owns its scheduler, state, and kernels; serving and KV infrastructure are shared. No PyTorch or Python runtime.

Quickstart

Prebuilt binary · Qwen3 on Linux

The Qwen3-only release bundles CUDA 13 and cuBLAS. It requires Linux x86_64, an NVIDIA GPU with compute capability 8.x–12.x, driver 580+, glibc 2.35+, and OpenSSL 3. Model weights are downloaded separately.

curl -fsSL https://raw.githubusercontent.com/pegainfer-project/pegainfer/main/install.sh | bash

Download Qwen3-4B into models/Qwen3-4B, then start the server:

pegainfer --model-path models/Qwen3-4B

The server listens on port 8000. If the command is not on your shell's path:

export PATH="$HOME/.local/bin:$PATH"

The installer selects the latest release by default. PEGAINFER_VERSION selects an exact version; see releases.

Build from source

Use the Rust toolchain pinned in rust-toolchain.toml, a CUDA Toolkit with nvcc and cuBLAS, and a compatible NVIDIA driver. The default Qwen3 build needs no Python. Its driver floor is R545 / CUDA 12.3; newer toolkits and model-specific kernels can require a newer driver.

From the repository root, with the checkpoint downloaded:

export CUDA_HOME=/usr/local/cuda
cargo run --release -- --model-path models/Qwen3-4B

Always use --release for GPU builds. The server entrypoint is pegainfer-server; model crates contain the model implementation and diagnostics.

Feature builds and environment options

Qwen3.5 uses Triton AOT kernels, requiring Python and Triton at build time:

uv venv
uv pip install triton
export PEGAINFER_TRITON_PYTHON=.venv/bin/python
cargo run --release --features qwen35 -- --model-path models/Qwen3.5-4B
Variable Purpose
CUDA_HOME CUDA Toolkit location; defaults to /usr/local/cuda
PEGAINFER_CUDA_SM Target GPU architecture when it cannot be detected, e.g. 120
PEGAINFER_TRITON_PYTHON Python interpreter for Qwen3.5 Triton AOT compilation
PEGAINFER_TILELANG_PYTHON Python interpreter for K3 TileLang kernel generation

Other model lines have their own hardware and build requirements; follow the model guides below. Run cargo run --release -- --help for the compiled-in CLI.

Windows source builds
$env:CUDA_PATH = "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v12.x"
cargo run --release -p pegainfer-server -- --model-path models/Qwen3-4B

# Qwen3.5 additionally needs Triton at build time
uv venv .venv --python 3.12
uv pip install "triton-windows<3.7"
$env:PEGAINFER_TRITON_PYTHON = ".venv\Scripts\python.exe"
cargo run --release --features qwen35 -- --model-path models/Qwen3.5-4B

Performance

Selected serving measurements across dense, hybrid-attention, and MoE models. Each panel uses its own hardware, workload, and scale; the linked reports preserve the benchmark conditions.

Panel Measurement and source
Qwen3 · 4B DSpark vs PegaInfer baseline, single-request greedy decoding on ShareGPT and SPEED-Bench coding.
Qwen3.5 · 9B / 27B GH200 concurrency sweep, revision ffb959c4, random 1,024-token prompts and 128-token outputs.
Gemma 4 · 26B-A4B Four-round long-context report. Ratios use reported median end-to-end latencies; PegaInfer uses BF16 KV in both comparisons. The BF16 and default-FP8 vLLM comparisons were measured separately using PegaInfer revisions e7a41975 and ea02a9f7, respectively.
GLM-5.2 Native MTP serving sweep: co-located EP4 uses 4 GPUs; disaggregated TP4 prefill + EP4 decode uses 8 GPUs total.
Qwen3 serving footprint and additional measurements

Qwen3-4B on one RTX 5090, BF16, TP1: PegaInfer 70888b2 vs vLLM 0.24.0, loaded and serving the same model. PegaInfer is one process; the vLLM figure sums its process tree. This is a separate snapshot from the DSpark panel above.

Metric PegaInfer vLLM 0.24.0
Resident memory, loaded and idle 771 MB 3814 MB
Startup to HTTP ready, cold 2.99 s 70.0 s
Startup, warm compile cache ~3.0 s 32.7 s

The Qwen3 serving report also covers the 8B model, warm-prefix TTFT, host-tier restore, and the serving sweep against vLLM. Further reports cover DSpark vs matched DFlash, DFlash serving, and Gemma 4 12B long-context performance.

Supported Models

Only qwen3 is enabled by default, including in the prebuilt binary. Build other lines with --features . At launch, --model-path selects a checkpoint and its config.json identifies the model family.

Model line Attention / experts Cargo feature Serving scope and guide
Qwen3 · dense 0.6B to 32B Full attention, GQA qwen3 · default Greedy + sampling, tensor parallel, prefix cache, KV offload; DFlash / DSpark on 4B. Model page
Qwen3.5 · dense 0.8B to 27B Gated DeltaNet + full attention qwen35 Text-only BF16; build-time Triton. Model page
Gemma 4 · 12B and 26B-A4B Sliding-window + global attention; NVFP4 routed experts on 26B gemma4 Text-only, single GPU, batched decode and optional chunked prefill. Model page
DeepSeek-V2-Lite MLA + MoE deepseek-v2-lite 2-GPU EP2 correctness path. Status and limits
Kimi-K2 / K2.5 MLA + MoE, Marlin INT4 kimi-k2 8-GPU expert parallelism. Model roadmap
GLM-5.2 Sparse MLA + MoE, FP8 glm52 Blackwell; EP decode, TP4 prefill, native MTP speculative decoding, P/D disaggregation. Bring-up. Model page
Kimi-K3 KDA + MLA, latent MoE, MXFP4 k3 Text-only, Blackwell, EP and DSpark. Bring-up. Model guide

Capabilities and maturity differ by model. Quantized formats are model-specific; the Qwen paths listed here use BF16. DeepSeek-V2-Lite's retained correctness and benchmark gates are documented separately from production readiness.

Architecture

Share the infrastructure; let each model own its execution. The frontend submits requests through an

readme truncated — read the full docs on github

Frequently asked questions

Is pegainfer free to use?

pegainfer is open source under the Apache-2.0 licence. There is no licence fee and no seat count — you can self-host it or, where the project offers one, pay a vendor for a managed version instead.

What does pegainfer do?

Pure Rust + CUDA LLM inference engine — no PyTorch, OpenAI-compatible, serves Qwen3 to Kimi-K2

What is pegainfer written in?

pegainfer is primarily written in Rust. Its source is publicly available at https://github.com/pegainfer-project/pegainfer, and it has 704 GitHub stars.