模型权重需自行从 HuggingFace 下载到 models/Qwen3-4B,安装包不含权重;默认只启用 qwen3,其他模型线需用 --features 重新构建;服务默认监听 8000 端口,安装后可能需把 ~/.local/bin 加入 PATH;GPU 构建必须加 --release。
pegainfer
pegainfer-projectApache-2.0活跃维护纯 Rust + CUDA 实现的大模型推理引擎,不依赖 PyTorch,兼容 OpenAI 接口,可部署 Qwen3 到 Kimi-K2 等模型。
Pure Rust + CUDA LLM inference engine — no PyTorch, OpenAI-compatible, serves Qwen3 to Kimi-K2
curl -fsSL https://raw.githubusercontent.com/pegainfer-project/pegainfer/main/install.sh | bash
pegainfer --model-path models/Qwen3-4B预编译包需 Linux x86_64、NVIDIA GPU(compute capability 8.x–12.x)、驱动 580+、glibc 2.35+;源码构建默认 Qwen3 驱动下限 R545 / CUDA 12.3。README 未提及 CPU 运行。
纯 Rust + CUDA 的 LLM 推理引擎,无需 PyTorch,提供 OpenAI 兼容 API
纯 Rust + CUDA 实现的大模型推理引擎,不依赖 PyTorch,兼容 OpenAI 接口,可部署 Qwen3 到 Kimi-K2 等模型。
核心能力
- 用 Rust 前端实现 OpenAI 协议、分词与流式输出
- 每个模型自带调度器、状态与 kernel,共享 KV 基础设施
- 支持张量并行、前缀缓存与 KV offload
- 提供 DFlash / DSpark 投机解码(Qwen3-4B)
- 通过 Cargo feature 切换 Qwen3、Gemma 4、Kimi-K2 等模型线
容易踩的坑
- v0.1.1PegaInfer v0.1.1最新正式版2026-08-26 · 2026-08-26 10:58 UTC
Prebuilt Qwen3-only server for Linux x86_64. The archive contains CUDA 13.0 runtime libraries and supports NVIDIA compute capabilities 8.x through 12.x. NVIDIA driver 580 or newer, glibc 2.35 or newer, and OpenSSL 3 are required. Model weights are not included.
What's Changed
- fix(deepseek-v2-lite): widen EP2 HF correctness gate by @CAICAIIs in https://github.com/pegainfer-project/pegainfer/pull/381
- fix(build): probe CUDA toolkit layouts in a shared openinfer-build crate by @FeathBow in https://github.com/pegainfer-project/pegainfer/pull/343
- test(qwen3): add real PEFT LoRA accuracy gate by @FeathBow in https://github.com/pegainfer-project/pegainfer/pull/369
- test(qwen3): de-flake lora_golden_gate via own-distribution regret; add TP=2 pass by @FeathBow in https://github.com/pegainfer-project/pegainfer/pull/385
- fix(deepseek-v2-lite): precompute NCCL MoE route plan by @CAICAIIs in https://github.com/pegainfer-project/pegainfer/pull/383
- docs(readme): refresh Qwen3.5 benchmark against vLLM 0.23.0 by @CAICAIIs in https://github.com/pegainfer-project/pegainfer/pull/386
- docs(readme): add star history chart by @xiaguan in https://github.com/pegainfer-project/pegainfer/pull/387
- feat(scheduler): add engine-side request lifecycle logs (admitted/fin… by @lulululu-debug in https://github.com/pegainfer-project/pegainfer/pull/382
- fix(qwen35): align GDN chunk_state AOT pointers :16 to fix sm_90 crash by @FeathBow in https://github.com/pegainfer-project/pegainfer/pull/390
- fix(build): explicitly enable tracing log bridge by @xwxb in https://github.com/pegainfer-project/pegainfer/pull/391
- fix(qwen35): batch step-tail logits and sampling by @CAICAIIs in https://github.com/pegainfer-project/pegainfer/pull/392
- chore(vllm-support): remove unused load_tokenizer_async by @xiaguan in https://github.com/pegainfer-project/pegainfer/pull/394
- chore(vllm): bump git deps to latest main for long-prompt 400 fix by @xiaguan in https://github.com/pegainfer-project/pegainfer/pull/402
- refactor(server): own per-model engine launch in model crates by @xiaguan in https://github.com/pegainfer-project/pegainfer/pull/404
- refactor(scheduler): collapse per-request output fan-out into one channel + demux by @xiaguan in https://github.com/pegainfer-project/pegainfer/pull/405
- fix(ci): restore green CI — sim fixture vocab_size + rustfmt by @xiaguan in https://github.com/pegainfer-project/pegainfer/pull/406
- test(vllm-frontend): lift bridge demux tests to sibling file, cull low-value cases by @xiaguan in https://github.com/pegainfer-project/pegainfer/pull/407
- fix(qwen35): add __syncthreads() to close the warp_norms WAR race in GDN decode by @FeathBow in https://github.com/pegainfer-project/pegainfer/pull/411
- fix(qwen): batch mixed FlashInfer sampling by @CAICAIIs in https://github.com/pegainfer-project/pegainfer/pull/413
- refactor(sample): converge per-model token selection + logprobs into openinfer-sample by @xiaguan in https://github.com/pegainfer-project/pegainfer/pull/417
- feat(deepseek-v2-lite): start/load logging by @Kokoro2336 in https://github.com/pegainfer-project/pegainfer/pull/415
- perf(qwen35): fuse gate/up MLP and tune decode GEMMs by @CAICAIIs in https://github.com/pegainfer-project/pegainfer/pull/421
- feat(qwen3): add green context SM partitioning by @xiaguan in https://github.com/pegainfer-project/pegainfer/pull/388
- fix(vllm-frontend): reject logprobs=-1 and cache_salt with 400 by @Rushit in https://github.com/pegainfer-project/pegainfer/pull/426
- fix(deepseek-v2-lite): add NCCL decode graph probe by @CAICAIIs in https://github.com/pegainfer-project/pegainfer/pull/429
- feat(qwen3): add profile-based KV cache sizing by @wdlin233 in https://github.com/pegainfer-project/pegainfer/pull/430
- fix(qwen3-scheduler): route echo+logprobs requests to prefill, not unified by @Rushit in https://github.com/pegainfer-project/pegainfer/pull/427
- chore(qwen3-scheduler): prune redundant fake-loop tests, extract test module by @xiag
- v0.1.0OpenInfer 0.1.02026-06-13 · 2026-06-13 12:17 UTC
查看更新说明
OpenInfer 0.1.0
OpenInfer 0.1.0 is the first source release of OpenInfer: a pure Rust + CUDA LLM inference engine with an OpenAI-compatible
/v1/completionsAPI.This release marks the point where the Qwen3-4B/8B line is usable as a production-oriented small-model serving stack, while the large MoE model lines remain active work in progress.
What Is Included
- OpenAI-compatible completions serving through the vLLM Rust frontend.
- A Rust-native engine contract built around
EngineHandle, request submission, and streamedTokenEvents. - Per-model engines instead of one universal model abstraction.
- CUDA Graph decode path for stable steady-state serving.
- Continuous batching scheduler for Qwen3.
- Prefix cache backed by Dynamo KV block-management logic.
- Pegaflow KV offload integration for HBM to host memory recovery paths.
- Feature-gated model support:
- Qwen3-4B / Qwen3-8B
- Qwen3.5-4B
- DeepSeek-V4
- DeepSeek-V2-Lite
- Kimi-K2
- Kernel layer using a mix of handwritten CUDA, cuBLAS, FlashInfer, Triton AOT, TileLang, and CuTe DSL.
Qwen3 Status
The Qwen3-4B/8B path is the most mature line in this release.
It includes:
- BF16 weight loading
- full-attention prefill and decode
- paged KV cache
- prefix cache
- continuous batching
- CUDA Graph decode
- greedy and sampling support
- LoRA routing support
- integration and golden-logit accuracy gates
On a single RTX 5090, Qwen3-4B is broadly competitive with vLLM 0.22.1 under
vllm bench serveusing the same client, same request stream, and same seed.At low load, OpenInfer and vLLM are close on TTFT and TPOT. At medium load, vLLM is still ahead on decode TPOT. Under overload, OpenInfer reaches comparable or slightly higher saturated output throughput in the current sweep, but both engines are well past the healthy latency regime at that point.
Prefix Cache And KV Offload
OpenInfer is designed around a readable KV data plane.
For GPU prefix-cache hits, warm TTFT stays low as context grows. In the Qwen3-4B RTX 5090 sweep, OpenInfer stays ahead of vLLM on warm TTFT across tested prompt lengths up to 16k tokens.
Pegaflow integration provides a host-memory KV recovery path. In CPU-memory warm-hit mode, long prompts avoid full prefill and recover KV blocks from host memory, giving larger speedups as prompt length grows.
Why Rust
The goal of OpenInfer is not to rebuild every piece of the inference stack from scratch.
Instead, the project uses Rust to assemble components with explicit ownership boundaries:
- vLLM Rust frontend for protocol, tokenizer, streaming, and OpenAI compatibility.
- Dynamo KV block-management logic for prefix matching and KV lifecycle.
- Pegaflow for KV offload.
- Per-model engines for model-specific scheduling, state layout, and kernel DAGs.
- A kernel crate that keeps CUDA/Triton/TileLang/CuTe DSL assets feature-gated by model.
This keeps the serving path inspectable, avoids a large Python runtime in the hot service, and makes it easier to co-design routing, KV cache, scheduler, and kernels.
Known Limitations
- Qwen3 is the mature path in this release.
- DeepSeek-V4 and Kimi-K2 support exist, but serving performance and production polish are still catching up to vLLM.
- Some model lines require feature-specific build dependencies, such as Triton, TileLang, CuTe DSL, NCCL, or RDMA-related libraries.
- This is a source release, not a prebuilt binary distribution.
- No formal release workflow exists yet; this tag is intended as the first public 0.1.0 checkpoint.
Build
Default build targets Qwen3-4B:
cargo run --release -- --model-path /path/to/Qwen3-4BOther model lines are feature-gated:
cargo run --release --features qwen35-4b -- --model-path /path/to/Qwen3.5-4B cargo run --release --features deepseek-v4 -- --model-path /path/to/DeepSeek-V4 cargo run --release --features kimi-k2 -- --model-path /path/to/Kimi-K2Closing
OpenInfer 0.1.0 is both a working inference engine and a
用户点评
登录用户的真实使用记录,可按版本和硬件筛选还没有人点评。第一个说出真实体验的人最有价值。
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.
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_QWEN35_GDN_AOT_BUNDLE | Build-time FlashInfer GDN candidate directory; serving requires explicit backend selection |
PEGAINFER_TILELANG_PYTHON | Python interpreter for K3 TileLang kernel generation |
Qwen3.5 defaults to Triton even when a FlashInfer GDN candidate is linked. Explicit --qwen35-gdn-backend flashinfer-candidate selection requires SM120/Hv32/TP1 and fails on unsupported or unavailable candidates. Generation and production gates are described in the candidate README.
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.
$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-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 <feature>. 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. Qwen3.8-27B rides the same feature. Model page · Qwen3.8 support record |
| Gemma 4 · 12B and 26B-A4B | Sliding-window + global attention; NVFP4 routed experts on 26B | gemma4 | Text-only, batched decode and optional chunked prefill; the dense sizes also run at tensor parallel 2, one rank per device. 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 engine contract. Model schedulers decide how to batch work, manage state, and execute kernels on their target hardware.
The diagram shows ownership layers. Model engines select the components they need; cache integration and parallel strategies vary by model.
| Boundary | Responsibility |
|---|---|
pegainfer-server | Detect the model, validate its CLI, and launch the selected engine |
pegainfer-frontend | OpenAI protocol, tokenization, chat templates, streaming, metrics, and engine contracts; uses vLLM's Rust frontend crates |
| Per-model crates | Weights, scheduler, prefill/decode execution, state layout, and parallel strategy |
pegainfer-core / pegainfer-sample | Shared GPU and weight-loading primitives; batched token selection |
pegainfer-kernels | Native kernels, FFI, GPU-library integration, and feature-gated AOT builds |
| KV infrastructure | pegainfer-kv-store and the existing pegainfer-kv-cache / pegainfer-kv-offload paths; PegaFlow supplies host, SSD, and RDMA storage/transfer |
The step-based contract and legacy EngineHandle contract currently coexist. See the frontend architecture for the migration boundary and design direction for the reasoning behind model-owned engines.
API
Point an OpenAI-compatible client at http://localhost:8000/v1. Both /v1/completions and /v1/chat/completions support streaming.
curl -s http://localhost:8000/v1/completions \
-H "Content-Type: application/json" \
-d '{"model":"models/Qwen3-4B","prompt":"The capital of France is","max_tokens":32}'
curl -N http://localhost:8000/v1/chat/completions \
-H "Content-Type: application/json" \
-d '{"model":"models/Qwen3-4B","messages":[{"role":"user","content":"Write a haiku about Rust."}],"max_tokens":64,"stream":true}'
The model guides document supported sampling fields and model-specific limits. Documentation covers the serving interface; metrics and dashboards cover observability.
Development
scripts/setup_dev.sh prepares a fresh NVIDIA Ubuntu host using the pinned Rust toolchain and build dependencies. CUDA must already be installed. Container development is documented in docker/README.md.
bash scripts/setup_dev.sh
Run checks in release mode; accuracy and integration tests need a GPU and model weights:
cargo test --release --workspace --lib
PEGAINFER_TEST_MODEL_PATH=models/Qwen3-4B \
cargo test --release -p pegainfer-qwen3 --test hf_golden_gate
PEGAINFER_TEST_MODEL_PATH=models/Qwen3.5-4B \
cargo test --release -p pegainfer-qwen35 --features qwen35 --lib executor::hf_golden_gate -- --test-threads=1
PEGAINFER_TEST_MODEL_PATH=models/Qwen3.5-4B \
cargo test --release -p pegainfer-qwen35 --features qwen35 --lib scheduler::e2e_tests -- --test-threads=1
Browse the engineering docs index for model-specific gates, profiling, and benchmark methodology.
The getting started guide and model pages live at pegainfer.org. Read the engineering stories at pegainfer.org/blog: weight loading, speculative decoding, CUDA graph export, and prefill/decode overlap.
License
Apache-2.0. See NOTICE for third-party attributions. The Dynamo-derived kvbm/kvbm-logical crate retains its original Apache-2.0 headers and NVIDIA Dynamo notice.