Skip to content

Latest commit

 

History

History
170 lines (124 loc) · 8.14 KB

README.md

File metadata and controls

170 lines (124 loc) · 8.14 KB

RustingStrata

Reviewed by Aletheore

RustingStrata is a pure-Rust inference engine for GGUF models, built for MoE models that do not fit in VRAM. Experts that do not fit in VRAM run on the CPU at the same time as the GPU work. It runs on CUDA and Vulkan with no C++ build step and no ggml, and it has a chat page and an OpenAI-compatible server.

Supported models: Qwen3, Qwen3-Next, Qwen3.5/3.6, Qwen3.8-Flash-Next, Qwen4-35B-A3B, Recursive Flint, Gemma 4, DeepSeek-V4.1-Flash, GLM-5.3-Flash, Hy4-flash, Inkling 2 Mini, Kolibri 1.1, GigaChat 4 and Ternary Bonsai 2. The GGUF types and the notes for each model are in docs/MODELS.md.

Version 1.5.2.

Numbers

Qwen3.6-35B-A3B on an RTX 3060 12 GB (Ryzen 5 7600X, 32 GB RAM), CUDA, greedy, against llama.cpp tuned for the same file. Neither file fits in VRAM.

RustingStrata llama.cpp
UD-Q5_K_M (25.2 GiB), decode after a 4K prompt 80.5 tok/s 64.4
UD-Q5_K_M, prefill of a 4K prompt 1530 tok/s 1118-1122
UD-Q2_K_XL (11.7 GiB), decode after a 4K prompt 113.4 tok/s 66.5
UD-Q2_K_XL, prefill of a 4K prompt 2216 tok/s ~2236

Many users at once

serve --parallel N decodes the requests together in one batched forward (CUDA). The table is total decode tok/s on the same machine. The load script is tools/loadtest.py: N streamed chats at once, 128 reply tokens each, greedy.

Clients Qwen3-4B, RustingStrata (Q4_K_M) Qwen3-4B, vLLM 0.33 (bf16) Qwen3.6-35B-A3B UD-Q5_K_M, RustingStrata
1 91.3 36.7 49.0
4 228.1 139.9 88.9
16 799.0 520.1 100.7
64 1698 1688-1765 129.3
  • vLLM runs bf16 weights and RustingStrata runs Q4_K_M, so the Qwen3-4B columns are not like for like.
  • The 27 GB MoE file does not fit on the 12 GB card, so vLLM was not run on it.
  • The MoE column moves by about 30% between runs on this machine.

The method, Vulkan, the other models and the quality checks are in docs/BENCHMARKS.md.

Install

# Windows: installs to %LOCALAPPDATA%\Programs\RustingStrata, adds it to PATH, makes a Start menu entry
irm https://raw.githubusercontent.com/RustingStudio/RustingStrata/main/install.ps1 | iex
# Linux x86_64: installs to ~/.local/bin
curl -fsSL https://raw.githubusercontent.com/RustingStudio/RustingStrata/main/install.sh | sh

# Arch Linux (AUR)
yay -S rustingstrata-bin

# From source (Rust 2024 edition; on Windows install the Visual Studio C++ Build Tools first)
cargo build --release    # the binary is target/release/rustingstrata

Binaries are also on the releases page.

rustingstrata update replaces the binary with the newest release. rustingstrata update --check only says whether one is out, and serve prints a line at start when one is. A binary from a package manager (the AUR package) is updated with that package manager.

GPU requirements

--gpu picks CUDA when it loads, else Vulkan. --backend cuda, --backend vulkan or --backend hip chooses one.

Backend Needs
CUDA An NVIDIA driver with the CUDA NVRTC library. Volta (sm_70), Turing (sm_75) and Ampere or newer (sm_80+).
Vulkan A Vulkan 1.3 driver with shaderFloat64, int8/16/64 and subgroup size 32 or a fixed 64.
HIP A ROCm runtime with hiprtc (libamdhip64.so, libhiprtc.so). Experimental: see docs/HIP.md.
  • The first CUDA run compiles the kernels (~15 s) and caches them. HIP compiles for the card's gfx target on first use.
  • CUDA 13 dropped Volta, so a V100 needs the 12.x toolkit. Pascal and older cards use Vulkan.
  • NVRTC is found by name: libnvrtc.so, or nvrtc64_130_0.dll or nvrtc64_120_0.dll on Windows (on PATH or under %CUDA_PATH%\bin). STRATA_NVRTC names another file. Without NVRTC the run falls back to Vulkan.
  • A Vulkan driver without one of the features is refused at start, with the list of what it lacks.
  • A user runs Inkling 2 Mini on an Intel Arc B580 with Vulkan.

Every GPU tried so far is in docs/SUPPORTED_GPUS.md.

Uninstall

Delete the binary and the data folders. The models folder can be large: keep it if other tools use the files.

rm ~/.local/bin/rustingstrata           # AUR: yay -R rustingstrata-bin
rm -r ~/.cache/rusting_strata           # kernels, calibration, expert profiles
rm -r ~/.local/share/rusting_strata     # downloaded models, usage stats

Windows (PowerShell):

Remove-Item -Recurse "$env:LOCALAPPDATA\Programs\RustingStrata", "$env:LOCALAPPDATA\rusting_strata"
Remove-Item "$([Environment]::GetFolderPath('Programs'))\RustingStrata.lnk"
$d = "$env:LOCALAPPDATA\Programs\RustingStrata"
[Environment]::SetEnvironmentVariable('Path', ((([Environment]::GetEnvironmentVariable('Path','User')) -split ';') -ne $d) -join ';', 'User')

XDG_CACHE_HOME, XDG_DATA_HOME and --models-dir move these folders: delete them where you pointed them. Models that the chat page found in the Hugging Face or llama.cpp cache stay there.

Quick start

Run rustingstrata with no arguments, or double-click rustingstrata.exe on Windows. It starts a server on http://127.0.0.1:8080 and opens the chat page. The chat page downloads models from Hugging Face and switches between the models in your models folder.

Any app that takes an OpenAI-compatible address can use http://127.0.0.1:8080/v1 (Open WebUI, Jan, SillyTavern, code editors).

rustingstrata interface asks a few questions in the terminal, prints the command they make and runs it.

With flags:

M=path/to/model.gguf

rustingstrata serve --gpu --open               # the chat page; it downloads models
rustingstrata calibrate --model $M --dry-run   # preview what calibrate will measure
rustingstrata calibrate --model $M             # once per model and machine: finds the fastest settings
rustingstrata chat --model $M --gpu            # --think false turns thinking off, --temp 0.7 samples
rustingstrata generate --model $M --gpu --prompt "Write a haiku about rivers." -n 128
rustingstrata serve --model $M --gpu --addr 127.0.0.1:8080
rustingstrata serve --model $M --gpu --pretty --graph --status-interval 250ms   # live metrics and speed graphs
rustingstrata bench --model $M --gpu --pp 512,4096 --tg 128

Without --gpu the model runs on the CPU reference, which is slow and meant for checking. On a machine without a usable GPU, use --fast-cpu. DeepSeek, GLM, Hy4 and Inkling 2 open the GPU by themselves.

Docs

Development

cargo build --release
cargo test --release      # GPU tests need the model: STRATA_MODEL=path/to/model.gguf
python -I tools/parity.py $M --extra "--gpu" --tag gpu   # agreement with llama.cpp (needs llama-server once)

CI only builds, so run the tests before a pull request.

The command line is in src/main.rs, the HTTP server in src/serve.rs, the CPU reference forward in src/model.rs and the GPU forward in src/gpu_model.rs. The GPU backends are src/cuda/, src/vulkan/ and src/hip/.

License

RustingStrata is released under the RustingStrata License 1.0. You may use, modify and distribute it, including for commercial services, as long as you keep the license and credit Vasyl Trefilov as the original author. You may not sell RustingStrata itself.