Skip to main content

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.

Rust Control Plane CI Packaging & Patch Build License: Apache-2.0 PyPI

Türkçe · Architecture · Migration Guide (v2.2) · Benchmarks · 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 (argus), hardware planner, NVML telemetry, and bare chat WebUI all ship as native Rust binaries.
  • 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, and accelerates CPU MoE decode with ratio-gated Q4_0_8x8 / Q4_K_8x8 CPU_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, backend crash recovery, model-switch rollback, and D3cold-safe GPU telemetry.

Performance at a Glance

Measured on a clean tree (53ba951) on an everyday 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):

Model Active Experts (K=8 / K=4 / K=2) Long Prefill (7K+ tok, P3 DMA) Idle / Peak VRAM argusd RSS
Gemma 4 26B A4B (Q4_0) 23.4 / 36.9 / 50.0 tok/s 882.4 tok/s (7,769 tok) 2,393 / 2,479 MiB 13.3 MiB
Qwen 3.6 35B A3B (Q4_K_S) 29.5 / 41.9 / 52.2 tok/s 917.9 tok/s (7,019 tok) 2,073 / 2,133 MiB 12.6 MiB

Additional verified highlights (full measurement ledger):

  • Q4_K CPU_REPACK (Perf-2): +31.8% K=8 decode on Qwen 3.6 35B Q4_K_S (20.30 → 26.75 tok/s vs warm mmap) with bit-exact (cos = 1.0000000000, max_abs_diff = 0.0) P3 GPU prefill un-repack.
  • 2-Thread Parallel P3 Un-Repack (Perf-3): +5.2% long-context prefill on Gemma 4 Q4_0 and +2.2% on Qwen 3.6 Q4_K_S at 0 MiB extra VRAM.
  • Long-Context 64K / 128K (-nkvo): 6.6× faster at 64K and 6.0× faster at 128K decode vs stock CPU host KV attention via exact K1/S1 tiered KV mirrors.
  • Native C++ VoC (Perf-4): Single-HTTP auto-routing inside llama-server with 99.5% KV reuse (424/426 tokens) on easy K=2 turns and zero K=2 KV leak on K=8 + thinking escalations.

Architecture

flowchart LR
    UI["Embedded Bare WebUI<br/>(HTML/JS, XSS-safe)"] --> D
    CLI["argus CLI<br/>(13 commands + chat + doctor)"] --> 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)<br/>Queue · Cancel · LoRA Isolation · Rollback"]
        C["argus-core<br/>GGUF Parser · VRAM/RAM Planner · NVML/sysfs 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 inside llama-server across 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                   # Start argusd + supervised llama-server
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_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 (opt-in) Enables CUDA Graph capture for libargus S1 & tier_append ops (+2.3..4.8% at K=8, -2% at K=2).
ARGUS_DECODE_PROFILE 0 1: zero-perturbation decode host + async CUDA event breakdown (GET /props["argus"]["profile"]); 2: adds CPU MUL_MAT_ID breakdown.
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.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for argus-cache 2.2.0
File Size Uploaded Provenance Actions
argus_cache-2.2.0.tar.gz 153.0 kB Without provenance Details for argus_cache-2.2.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for argus-cache 2.2.0
File Interpreter ABI Platform Actions
argus_cache-2.2.0-py3-none-any.whl Python 3 none any Details for argus_cache-2.2.0-py3-none-any.whl

Total release size: 252.5 kB

Release files / argus_cache-2.2.0.tar.gz

Download URL argus_cache-2.2.0.tar.gz
Size 153.0 kB
Tags Source
SHA-256 checksum
How to use checksums
0004695c5efa7b1f6bb014ab2e7e5e44d84f96f93a3ee282dba4059a8ab73434
BLAKE2b-256 checksum
How to use checksums
afe8c472b058b5a762f2e674c62dafbcadf102f6441884cd5f8300cfa35de63f
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.0-py3-none-any.whl

Download URL argus_cache-2.2.0-py3-none-any.whl
Size 99.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
98a4d8b9a79d70fafcf5da013013e6703774d401e662467e099966b2004beb40
BLAKE2b-256 checksum
How to use checksums
7754debfb2f5366849f6ac6ac17a3245fba26f116d77fbd7a9e67b6c107dc74b
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.0

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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page