ferrum-infer-rs
Rust-native LLM inference for OpenAI-compatible local and private serving.
One binary. No Python runtime. Apple Silicon Metal and NVIDIA CUDA acceleration.
Quick Start
Install Ferrum:
# macOS Apple Silicon
# Linux x86_64, NVIDIA CUDA sm89
Run a model directly:
# macOS Metal (GGUF)
# Linux CUDA (safetensors)
Serve the same model through an OpenAI-compatible API:
# macOS Metal
# Linux CUDA
Features
ferrum runandferrum servein one Rust binary.- OpenAI-compatible chat completions, streaming, tools, and structured output.
- Apple Silicon Metal and NVIDIA CUDA from the same runtime.
- Continuous batching, paged KV cache, prefix cache, and typed admission control.
- GGUF on Metal and GPTQ/safetensors on CUDA.
- v0.8 covers language-model inference only. Release scope: Qwen3.5 4B, Qwen3.5 35B-A3B, Qwen3 30B-A3B, and Llama 3.1 8B dense. Support matrix.
Performance Snapshot
Latest R2 development ferrum serve checkpoint. Metal uses random 64-token
input / 128-token output; CUDA uses 256 / 128. Values are mean tok/s with the
95% confidence-interval half-width across three repeats.
| Model | M1 Max 32 GB Metal | RTX 4090 CUDA |
|---|---|---|
| Qwen3.5 4B | c=16 · 61.9 ± 0.1 | c=32 · 241.3 ± 0.6 |
| Qwen3.5 35B-A3B | c=4 · 26.1 ± 0.2 | c=16 · 174.1 ± 1.0 |
| Qwen3 30B-A3B | c=16 · 39.6 ± 1.2 | c=32 · 214.9 ± 2.7 |
c is active server concurrency. Every row completed 100 requests × 3 repeats
with zero errors. Measurement details.
OpenAI-Compatible API
Ferrum supports:
- chat completions and streaming usage
- function tools with
auto,none,required, or a named function json_objectand strictjson_schemastructured output- multi-turn sessions, prefix cache, and session cache
- typed concurrency, memory, and scheduler controls
See OpenAI API compatibility for the exact request contract and cache product controls for prefix and session caching.
Installation
Homebrew:
# macOS Apple Silicon Metal
# Linux x86_64 CUDA sm89
Prebuilt release tarballs:
# Linux x86_64 CUDA sm89
|
LD_LIBRARY_PATH=/usr/local/cuda/lib64:
# macOS Apple Silicon Metal
|
Install from crates.io:
# macOS Apple Silicon Metal
# NVIDIA CUDA
The official prebuilt CUDA asset targets sm89. CUDA installation requires a
compatible NVIDIA driver, CUDA runtime, and NCCL runtime on the target host.
Architecture
- Contracts:
ferrum-types,ferrum-interfaces - Execution:
ferrum-engine,ferrum-scheduler,ferrum-kv,ferrum-sampler - Models and compute:
ferrum-models,ferrum-kernels,ferrum-native-ops,ferrum-quantization - Product surface:
ferrum-cli,ferrum-server,ferrum-tokenizer - Validation:
ferrum-bench-core,ferrum-testkit
License
MIT