ARGUS
Run 26B–35B Mixture-of-Experts LLMs at 23–52 tok/s on a 4 GB consumer GPU.
A hardware-aware adaptive MoE inference runtime built with a native Rust control plane, C++/CUDA libargus kernels for llama.cpp, an embedded Ollama-style WebUI, and a zero-dependency Python SDK.
Türkçe · Architecture · OpenAI Compatibility · Migration Guide (v2.2) · Benchmarks (v2.2.1) · Changelog
What is ARGUS?
Large sparse Mixture-of-Experts (MoE) models like Gemma 4 26B A4B and Qwen 3.6 35B A3B need only a fraction of their parameters per token, yet default inference stacks choke on 4–8 GB consumer GPUs due to PCIe prefill bottlenecks, KV-cache OOMs, and uncoordinated CPU/GPU scheduling.
ARGUS turns a standard consumer laptop or desktop GPU into a fast, predictable local MoE engine:
- Zero Python required at runtime: The daemon (
argusd, ~12 MiB RSS), CLI (arguswith nativebench/profile/replay), hardware planner, NVML telemetry, OpenAI/v1/*gateway (scoped todocs/openai-compatibility.md), and bare chat WebUI all ship as native Rust binaries (verified in a sanitized zero-PythonPATHsmoke test; not yet tested on a fresh OS image lacking a system Python install). - CPU/GPU Expert Orchestration: Automatically plans VRAM/RAM budgets (
balanced,decode,prefill,coexist), keeps attention & shared layers on GPU, streams host MoE layers over double-buffered async PCIe DMA during prefill (with default-ON coalescing, safe uncalibrated fallback thresholds, and optional fingerprint-keyed K-aware calibration profiles), and accelerates CPU MoE decode with ratio-gatedQ4_0_8x8/Q4_K_8x8CPU_REPACK+ heterogeneous GPU/CPU overlap. - Adaptive Compute per Request: Choose active experts (
K=2,K=4,K=8, hourglass per-layer schedules, or native C++ Value-of-Compute (VoC) auto-routing) without reloading the model. - Safe Multi-LoRA & Production Guardrails: Shape- and base-fingerprint-verified LoRA hot-swap with per-request isolation, automatic KV invalidation on LoRA/K change, ephemeral
0600backend.keyisolation blocking directllama-serverbypass (401),argus start --waitstartup rollback, backend crash recovery, model-switch rollback, and D3cold-safe GPU telemetry.
Performance at a Glance
Verified only on a consumer laptop (RTX 3050 Ti 4 GB VRAM + Intel i5-11300H + 32 GiB DDR4, ctx = 32,768, KV = q4_0, end-to-end through Rust argusd). Larger GPUs (>=8 GiB, e.g. L40S/GB10) and unified-memory systems have architectural abstractions in place but are untested — no performance claims are made for them.
v2.2.1 Controlled A/B/A Highlights (full ledger)
- P3 Adaptive Prefill (
430–3,661tokens,K=8/4/2):- Out-of-box (uncalibrated clean install, no
p3_profiles.json):ARGUS_P3_COALESCE=1default ON with safe fallback (CPU_REPACK512tok,mmap256tok) eliminates double-pass DMA (~1.7×–1.9×faster on>=512-token prompts). - With local fingerprint calibration (
~/.argus_runtime/p3_profiles.json):1.01×–2.10×on Gemma 4 26BQ4_0and1.06×–3.44×on Qwen 3.6 35BQ4_K_Sacross all 24/24 measured prefill points.
- Out-of-box (uncalibrated clean install, no
- Decode A/B/A (
128-token prompt,64-token gen viaargusdOpenAI SSE):- Gemma 4 26B
Q4_0:20.92 / 32.91 / 44.85 tok/s(K=8/4/2,2,756 MiBpeak VRAM;-4.30% / -2.11% / -2.58%vsA_avgwith45.5°C → 60.5°Ccold-start asymmetry). - Qwen 3.6 35B
Q4_K_S:25.34 / 38.03 / 47.36 tok/s(K=8/4/2,2,494 MiBpeak VRAM;-1.12% / -0.26% / -2.00%vsA_avg). - Historical
v2.2.0single-run peak ceiling (53ba951, cold laptop): Gemma 423.4 / 36.9 / 50.0 tok/s(882.4 tok/s7K prefill), Qwen 3.629.5 / 41.9 / 52.2 tok/s(917.9 tok/s7K prefill) — see v2.2.0 ledger.
- Gemma 4 26B
- 64K Long-Context & Parity: Both models hold
65,536/65,536(100%)S1GPU KV mirror with0OOM; Gemma 4 2×2 P3repackvsmmapparity is0.000000max logprob diff (136/136 tokens). - Honest Gate Status: Closed-mode
<1.5%instrumentation perturbation gate isNOISE_LIMITED_CANNOT_PROVE_1_5PCTon this thermally-constrained live-desktop laptop (80–81.4°Cdrift-8.5% / -11.7%).
Architecture
flowchart LR
UI["Embedded Bare WebUI<br/>(HTML/JS, XSS-safe)"] --> D
CLI["argus CLI<br/>(16 commands: start/bench/profile/replay/chat)"] --> D
OAI["OpenAI Clients<br/>(/v1/* scoped compatibility)"] --> D
SDK["Python SDK<br/>(argus_cache.ArgusClient, stdlib-only)"] --> D
subgraph Rust["Rust Control Plane (~12 MiB RSS, Zero Python)"]
D["argusd (Axum HTTP/SSE + /v1/*)<br/>backend.key Isolation · Cache · Queue · Rollback"]
C["argus-core<br/>GGUF Parser · VRAM/RAM Planner · P3 Profiles · Telemetry"]
D --- C
end
D <-->|"HTTP / SSE (Zero-FFI boundary)"| S
subgraph Cpp["C++ / CUDA Data Plane (llama-server + libargus)"]
S["llama-server (5bacb7c + argus.patch)<br/>Native C++ VoC · Dynamic K · Multi-LoRA"]
K["libargus Kernels<br/>P3 2-Thread Async DMA · Q4_0/Q4_K Un-Repack<br/>K1/S1 Tiered KV · GPU Hadamard · Hetero Overlap"]
S --- K
end
- Rust Control Plane (
rust/crates/{argus-core,argusd,argus-cli}): Owns model discovery, GGUF inspection, adaptive VRAM/RAM planning, LoRA compatibility verification, process supervision, bounded request queueing, cancellation, hardware telemetry, HTTP/SSE API, and embedded WebUI. - C++/CUDA Data Plane (
argus_cache/csrc+integrations/llama.cpp/argus.patch): Keeps all compute-critical MoE, KV mirror, DMA, and Native VoC kernels insidellama-serveracross a clean process boundary. - Thin Python Interface (
argus_cache/client.py): Optional zero-dependency stdlib client for scripts, notebooks, and integrations.
Quick Start
1. Build the Rust Control Plane & CLI
git clone https://github.com/Zwannfrederick/argus.git
cd argus
./scripts/install_argus.sh
Or build manually with Cargo:
cargo build --manifest-path rust/Cargo.toml --release
# Produces rust/target/release/argusd (~7.5 MB) and rust/target/release/argus (~4.8 MB)
2. Build llama-server with libargus
Apply integrations/llama.cpp/argus.patch onto pinned llama.cpp revision 5bacb7c868a2bc98682de15f447fc1ce17c9c49c:
git -C /path/to/llama.cpp apply /path/to/argus/integrations/llama.cpp/argus.patch
cmake -S /path/to/llama.cpp -B /path/to/llama.cpp/build-cuda \
-DCMAKE_BUILD_TYPE=Release -DGGML_CUDA=ON -DCMAKE_CUDA_ARCHITECTURES=86 \
-DGGML_CUDA_FA=ON -DGGML_CUDA_FA_QUANTS="q4_0-q4_0;q8_0-q8_0;f16-f16;bf16-bf16" \
-DGGML_NATIVE=ON -DARGUS_CORE_DIR=/path/to/argus/argus_cache/csrc
cmake --build /path/to/llama.cpp/build-cuda --target llama-server -j"$(nproc)"
3. Diagnose, Start, and Chat
argus doctor # Check CUDA/NVML, CPU SIMD, RAM/VRAM, backend & config
argus plan --model model.gguf # Inspect exact adaptive VRAM/RAM & P3 plan
argus start --wait # Start argusd + supervised llama-server with rollback on failure
argus profile --json # Inspect live Level-1/2 profiler & expert telemetry
argus bench --ks 8,4,2 # Native Rust TTFT/prefill/decode benchmark (zero Python)
argus chat # Interactive terminal chat (supports /k, /lora, /model, /stats)
argus web # Open embedded bare Ollama-style WebUI (http://127.0.0.1:8090)
Thin Python SDK (Optional)
pip install argus-cache
from argus_cache import ArgusClient
client = ArgusClient("http://127.0.0.1:8090")
print(client.status()["vram"])
for event in client.chat_stream(
[{"role": "user", "content": "Explain sparse MoE routing in 3 bullet points."}],
routing="auto", # "auto" (Native VoC) | "fast" (K=2) | "balanced" (K=4) | "deep" (K=8) | "hourglass"
):
if event.event == "token":
print(event.data["text"], end="", flush=True)
Core Features
| Area | Capabilities |
|---|---|
| Adaptive Memory Planner | 4 VRAM profiles (balanced, decode, prefill, coexist), automatic tied-embedding accounting, -nkvo shared P3/KV arena, ratio-gated Q4_0 & Q4_K CPU_REPACK (>=80% repackable MoE bytes + runtime AVX2/AVX-512/NEON check + >=6 GiB free RAM guard), and elastic host-RAM watchdog. |
| Fast PCIe Prefill (P3) | Layer-major MoE prefill with double-buffered async DMA (2 × 2 MiB pinned bounce ring), 2-thread parallel Q4_0_8x8 / Q4_K_8x8 / Q4_K_8x4 un-repacking, cooperative Copy-Engine yielding, and 0 MiB idle VRAM overhead (slot[1] leased on-demand during prefill only). |
| Dynamic Compute & Native VoC | Per-request moe_top_k, per-layer moe_top_k_layers, single-pass native C++ VoC inside llama-server (--argus-voc-dir / ARGUS_VOC_DIR, compatible with Gemma-4-26B-A4B-QAT-KAT-v1), plus experimental opt-in dynamic_k_policy (post_think / confidence, default OFF). |
| Multi-LoRA & Safety | GGUF tensor-shape + base-fingerprint compatibility verification, per-request LoRA isolation, automatic KV invalidation on LoRA/K change, bounded request queue & mid-stream cancellation, failed model-switch rollback, and strict localhost-by-default binding. |
| Hardware Telemetry & CLI | D3cold-safe multi-GPU sysfs → dynamic libnvidia-ml.so.1 NVML → nvidia-smi → CPU-only fallback. 13 native CLI commands (start, stop, restart, status, plan, chat, web, list, ps, inspect, logs, doctor, version) with --json output. |
| Bare Ollama-Style WebUI | Embedded directly inside argusd (no separate web server): model/profile/K/LoRA controls, image input, stop & regenerate, XSS-safe Markdown + code copy, Markdown export, compact hardware/profiler drawer, and quota-safe chat history. |
Key Runtime Knobs
| Knob | Default | Purpose |
|---|---|---|
ARGUS_AUTO |
1 |
Autonomous mode: K1/S1 tiered KV, P3 layer-major prefill, heterogeneous CPU/GPU overlap, and elastic RAM watchdog. |
ARGUS_P3_COALESCE |
1 (ON) |
Coalesces multi-ubatch P3 DMA passes into single-pass layer-major prefill (0 disables). |
ARGUS_P3_BUFFERS |
auto |
1 (sync) or 2 (double-buffered async DMA with on-demand slot[1]). |
ARGUS_P3_UNREPACK_THREADS |
2 (4+ cores) |
Parallel CPU strip un-repack threads (1 or 2) inside the P3 DMA worker. |
ARGUS_VOC_DIR / --argus-voc-dir |
unset | Trusted startup directory containing voc_gate_q40.npz + voc_calibration_q40.json for Native C++ VoC. |
ARGUS_CUDA_GRAPH_EXT |
0 (OFF) |
Opt-in CUDA Graph capture for libargus S1 & tier_append ops (default OFF: -5.29% K=2 regression on 4 GB single-stream hetero decode). |
ARGUS_DECODE_PROFILE |
0 (OFF) |
1: decode host + async CUDA event breakdown (argus profile); 2: adds CPU MUL_MAT_ID + lm_head/logits_d2h/sample_ms. |
ARGUS_EXPERT_STATS / ARGUS_EXPERT_TRACE |
0 / unset |
Opt-in router-level MoE expert counters (GET /argus/expert-stats) and binary ARGETRC v1 trace for argus replay. |
Request dynamic_k_policy |
"" (OFF) |
Experimental opt-in intra-generation K drop ("post_think" or "confidence"; hybrid-K KV is never reused by uniform-K turns). |
Verification
# Rust control plane: formatting, clippy, unit/golden/daemon integration tests
cargo fmt --manifest-path rust/Cargo.toml --check
cargo clippy --manifest-path rust/Cargo.toml --all-targets -- -D warnings
cargo test --manifest-path rust/Cargo.toml
# WebUI Markdown XSS suite & Python SDK / golden parity tests
node tests/webui_markdown_xss.test.mjs
pytest -q --ignore=tests/test_native_libargus.py
# Native CUDA kernels, K1/S1/C1, Q4_0/Q4_K un-repack & Native VoC tests
ARGUS_TEST_CUDA=1 ARGUS_LLAMA_CPP_DIR=/path/to/llama.cpp ARGUS_LLAMA_BUILD=build-cuda \
ARGUS_TEST_GGUF=/path/to/stories15M.gguf ARGUS_TEST_QUANT_GGUF=/path/to/qwen2.5-0.5b.gguf \
pytest -v tests/test_native_libargus.py
License
Apache 2.0 — see LICENSE.
Metadata
Release files for argus-cache 2.2.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| argus_cache-2.2.1.tar.gz | 149.2 kB | Without provenance | Details for argus_cache-2.2.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| argus_cache-2.2.1-py3-none-any.whl | Python 3 | none | any | Details for argus_cache-2.2.1-py3-none-any.whl |
Total release size: 239.3 kB
Release files / argus_cache-2.2.1.tar.gz
| Download URL | argus_cache-2.2.1.tar.gz |
|---|---|
| Size | 149.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
860b691b06b087279d67a19fe520b3e64248a79002d58ab296060ebe4cc8245e
|
|
BLAKE2b-256 checksum How to use checksums |
8c424f22a59f45da29d98aabe529b7e9a949ec8d2f5742388cd6a2c26e1170ea
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.10
|
Release files / argus_cache-2.2.1-py3-none-any.whl
| Download URL | argus_cache-2.2.1-py3-none-any.whl |
|---|---|
| Size | 90.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
5c98279f159aab20b49de0af557f5c0b963075604aa546ac0639cbdbb52fe2b2
|
|
BLAKE2b-256 checksum How to use checksums |
b0b2b3724b8aca86157cea8d52a957c6e86e4efcc8515a0c8d9a6628033e09fc
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.10
|
Security for argus-cache 2.2.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.