Skip to main content

ARGUS (libargus + Adaptive MoE Runtime)

A hardware-aware adaptive compute & memory optimization runtime for llama.cpp on consumer GPUs (4 GB VRAM + 32 GB RAM), paired with a bare Ollama-style local chat UI.

ARGUS focuses strictly on four optimization axes for local sparse MoE inference:

  • Compute: per-request moe_top_k, per-layer moe_top_k_layers, CPU_REPACK AVX-512/AVX2 Q4_0_8x8 MoE decode, and reasoning-budget routing.
  • Memory: adaptive VRAM & RAM budget planner (balanced/decode/prefill/coexist), elastic host-RAM pinning (Dynamic RAM Watchdog), non-active GGUF page reclaim, and exact K1/S1/C1 tiered quantized KV caches with GPU-resident Hadamard rotation.
  • Bandwidth: double-buffered async P3 DMA layer-major MoE prefill (ARGUS_P3_BUFFERS=auto|1|2) with cooperative Copy-Engine yielding and bit-exact Q4_0_8x8 streaming un-repack, ARGUS_HETERO_OVERLAP (qwen35moe, gemma4), watermarked mirror re-attach, and P0 decode roofline profiling (ARGUS_DECODE_PROFILE=1|2).
  • Capability: single-pass preserve_kv VoC routing (argus_cache/voc.py) and GGUF-verified multi-LoRA specialist cassette hot-swap (argus_cache/adapters/lora.py).

Compatible adaptive-compute adapter & VoC gate: ZwannFrederick/Gemma-4-26B-A4B-QAT-KAT-v1.

packaging

Türkçe belge: README_TR.md · Mimari: docs/architecture.md


Verified Results (RTX 3050 Ti 4 GB + i5-11300H + 32 GiB DDR4)

Every figure below is backed directly by a recorded JSON/report inside docs/measurements/ or automated tests in tests/ on the same consumer laptop (bandwidth census: PCIe Gen3 x4 = 3.14 GB/s, DDR4 = 42.2 GB/s).

Capability Verified Evidence Reference
ARGUS v2.1.0 Hardware Efficiency (gemma4 26B Q4_0, clean tree 8c5fd11) GPU Hadamard Q4_0 KV-rot cuts splits 87 → 62 (31 CPU / 31 GPU, 30/30 overlap launches); CPU_REPACK (--load-mode none --no-host) reaches 22.52 / 35.50 / 48.10 tok/s (K=8/4/2, balanced -ncmoe 30) and 23.28 / 37.18 / 49.17 tok/s (decode -ncmoe 29, 2,995 MiB VRAM); double-buffered async P3 DMA (ARGUS_P3_BUFFERS=2) hits 450.19 tok/s (mmap, 1.33×) and 439.31 tok/s (CPU_REPACK, 1.76× vs p3buf=1, +30.0% vs mmap p3buf=1) at 4,766 tok with 12/12 greedy parity and 0 MiB idle VRAM overhead (slot[1] leased on-demand and freed post-prefill) v2.1.0 measurements
ARGUS v2.0.1 Decode Roofline Profiler & Multi-LoRA (gemma4 + 3 cassettes) ARGUS_DECODE_PROFILE=1|2 (0 ring overflows, mean +0.14% interleaved perturbation): at K=8 CPU MoE is 72.6% (41.08/56.60 ms, 92.4% MUL_MAT_ID, only 2.1% barriers); at K=2 GPU sync flips to #1 (11.33/24.45 ms, 46.4%); overlap=1 realizes 91–95% of 3.63–3.65 ms overlap_upper_bound_ms; LoRA adds +2.9 ms GPU HW (+1.65–1.81 ms wall, rest hidden by overlap); 3 shape-verified cassettes in 2,525 MiB VRAM (7.08 ms hot-swap, cache_n=0 cross-LoRA invalidation, 100% cold A→B→A & concurrent isolation parity, +9.4 MiB RSS / +6 MiB VRAM over 12 switches) v2.0.1 measurements
ARGUS v2.0 on Gemma 4 26B QAT (Q4_0) + KAT-v1 2,445 / 4,096 MiB VRAM (ARGUS_AUTO=1, 30/30 RAM layers pinned, 923.1 MiB reclaimed); gemma4 ARGUS_HETERO_OVERLAP: +14.6% at K=8 (16.95→19.43 tok/s), +10.8% at K=4 (26.23→29.05), +11.4% at K=2 (34.82→38.78), 100% greedy exact parity; single-pass preserve_kv VoC reuses 664/666 KV (99.7%) & cuts 666-tok total wall time 2.00× (10.83s→5.42s, 0 KV leak on escalation); hourglass moe_top_k_layers (4/8/4): 23.20 tok/s (+19.4% vs K=8); P3 under --embeddings bit-exact (cos=1.000000) v2.0 measurements
Unified Qwen3.6-35B-A3B 64K (-nkvo -ctk q4_0 -ctv q4_0) ARGUS_AUTO=1 + ARGUS_P3_COALESCE=1 vs stock -nkvo: 2.89× prefill (305.73 vs 105.78 tok/s), 2.45× decode (20.83 vs 8.50 tok/s), 65,536/65,536 S1 GPU mirror (360 MiB), needle preserved across slot restore v1.0 measurements
Long-Context 64K / 128K Decode (Qwen3.6-35B-A3B, -nkvo) 6.6× at 64K (12.31 vs 1.86 tok/s), 6.0× at 128K (6.18 vs 1.02 tok/s); P3 cuts 32K/64K prefill 1.93× / 1.86× M1, P3
Exact K1 / S1 / C1 & Q4_0_8x8 Un-Repack Parity K1 matches float64 within < 6e-7 across 10 geometries & {1,2,3,4,8} threads; argus_unrepack_q4_0x8_strips matches live CPU_REPACK bit-exact; S1/C1 (f16/q8_0/q4_0) pass 22-step E2E decode, seq_rm, and file-backed slot restore test_native_libargus.py, test_ggml_decode_attention.cpp
Empirically Rejected / Off-by-Default Paths --moe-cache-mib 512 --moe-cache-cpu-share 1.0 on Gemma 4 (3,077 MiB, 152 splits/tok, -15% to -18% slower: 18.9 / 29.04 / 40.85 tok/s) & on Inkling-2-Mini (5.6× slower, kept off); draft-mtp on Qwen3.6-35B-A3B: workload-dependent (-6.4% slower on prose, +22% on code — left opt-in via --spec-type) v2.1.0, v1.0, speculative A/B

Quick Start

1. Build llama-server with libargus

Apply integrations/llama.cpp/argus.patch onto pinned llama.cpp commit 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)"

2. Run Gemma 4 26B QAT + KAT-LoRA v1 + Single-Pass VoC (4 GB VRAM)

ARGUS_AUTO=1 ARGUS_P3_COALESCE=1 ./llama-server \
  -m gemma-4-26B_q4_0-it.gguf \
  --lora gemma4_kat_v1.gguf \
  --mmproj mmproj-gemma-4-26B-BF16.gguf --no-mmproj-offload \
  -c 32768 -ngl 99 -ncmoe 30 -fa on -nkvo -ctk q4_0 -ctv q4_0 \
  -np 1 -t 4 -tb 6 -b 512 -ub 512 --load-mode mmap --no-warmup \
  --embeddings --pooling last --port 8080

3. Bare Ollama-Style Chat UI & CLI

# Bare chat UI on http://127.0.0.1:8090 (Auto VoC / K=2 / K=4 / K=8 / Layer Profile + LoRA toggle)
python -m argus_cache.webui.server --upstream http://127.0.0.1:8080/v1 --port 8090

# Or via service controller & terminal chat
./scripts/argus_ctl.sh start
./scripts/argus_ctl.sh status
./scripts/argus_ctl.sh chat --voc

Runtime Configuration

Knob Values Effect
ARGUS_AUTO 1 / 0 Autonomous mode: enables K1, S1 (auto VRAM mirror), P2, P3, ARGUS_HETERO_SCHED, ARGUS_HETERO_OVERLAP, and Dynamic RAM Watchdog.
ARGUS_P3_COALESCE 1 / 0 Keeps only the cheap end-4 checkpoint split during prefill (1 P3 pass per request).
ARGUS_P3_BUFFERS auto / 1 / 2 Double-buffered async P3 DMA (2: dedicated low-priority dma_stream + 2×2 MiB pinned bounce ring + cooperative Copy-Engine yield; leases slot[1] on-demand during prefill and frees it immediately in argus_expert_cache_unload()).
vram_profile (config) balanced / decode / prefill / coexist Adaptive VRAM & RAM budget planner (argus_cache/adapters/vram_planner.py): balances safety reserve (512 / 1024 MiB), -nkvo shared arena, P3 double-buffering, GPU MoE layers (including +240 MiB compute jump), and RAM-gated Q4_0 CPU_REPACK (--load-mode none --no-host).
ARGUS_DYNAMIC_RAM / ARGUS_RAM_RESERVE_MIB 1/0, MiB (3456) Elastic host MoE RAM pinning with 512 MiB hysteresis (works under both MADV_RANDOM and MADV_NORMAL).
ARGUS_HETERO_OVERLAP 1 / 0 Overlaps GPU shared MLP / shared expert with CPU routed MoE (qwen35moe, gemma4).
ARGUS_DECODE_PROFILE 0 / 1 / 2 1: zero-perturbation decode host breakdown + async CUDA event timings (overlap_upper_bound_ms, event_ring_overflows); 2: adds CPU MUL_MAT_ID / ggml_barrier breakdown. Reset via GET /props?reset_profile=1.
ARGUS_LORA_DIRS / ARGUS_VOC_DIR path(s) Optional external directories for GGUF-verified multi-LoRA discovery (max 4, VRAM-gated) and VoC gate files.
Request moe_top_k 0..64 Runtime active MoE expert count per request (0 = model default).
Request moe_top_k_layers [int, ...] (≤128) Per-layer active MoE expert schedule (e.g. hourglass [4×8, 8×14, 4×8]).
/embeddings preserve_kv true / false Keeps slot KV + end-1 SWA checkpoint after embedding probe so matching K completions skip double prefill.

Verification

# Python runtime, P1 adaptive VRAM planner, Multi-LoRA compatibility, VoC router & WebUI (43 tests)
.venv/bin/python -m pytest -q --ignore=tests/test_native_libargus.py

# Native C++/CUDA kernels, Q4_0 GPU KV-rot, slot-restore, preserve_kv & profiler telemetry (17 tests)
ARGUS_TEST_CUDA=1 \
ARGUS_LLAMA_CPP_DIR="$PWD/scratch/llama.cpp-next" \
ARGUS_LLAMA_BUILD=build-cuda \
ARGUS_TEST_GGUF="$PWD/scratch/models/stories15M.gguf" \
ARGUS_TEST_QUANT_GGUF="$PWD/scratch/models/qwen2.5-0.5b-instruct-q4_k_m.gguf" \
  .venv/bin/python -m pytest -v tests/test_native_libargus.py

# Controlled hardware A/B benchmark & decode roofline profiler (VRAM-guarded)
.venv/bin/python benchmarks/bench_argus.py --voc-dir /path/to/voc --lora-dir /path/to/loras
.venv/bin/python benchmarks/profile_decode.py --lora-dir /path/to/loras

License

Apache 2.0 — see LICENSE.

Metadata

Release files for argus-cache 2.1.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.1.0
File Size Uploaded Provenance Actions
argus_cache-2.1.0.tar.gz 155.3 kB Without provenance Details for argus_cache-2.1.0.tar.gz

Release files / argus_cache-2.1.0.tar.gz

Download URL argus_cache-2.1.0.tar.gz
Size 155.3 kB
Tags Source
SHA-256 checksum
How to use checksums
3fb995024da3e9dc09c0ef6c04ad10f3624e15239020eb13cad12f163f038f9b
BLAKE2b-256 checksum
How to use checksums
71c217d293cbefe96b9c0121524bdd275f1240c20957b587a9d3e8c293d33f66
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.1.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