Pure Rust + CUDA LLM inference engine — no PyTorch, OpenAI-compatible, serves Qwen3 to Kimi-K2
Pure Rust + CUDA LLM inference engine — no PyTorch, OpenAI-compatible, serves Qwen3 to Kimi-K2
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.
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 | bashDownload Qwen3-4B into models/Qwen3-4B, then start the server:
pegainfer --model-path models/Qwen3-4BThe 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.
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-4BAlways 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
…bash
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](https://pegainfer.org/) covers the serving interface; [metrics and dashboards](docs/subsystems/frontend/prometheus-metrics.md) cover observability.
## Development
[`scripts/setup_dev.sh`](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](docker/README.md).
```bash
bash scripts/setup_dev.shRun 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 --test e2e_schedulerBrowse 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.
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.
No open issues yet, or sync has not completed.