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-layermoe_top_k_layers, and reasoning-budget routing. - Memory: elastic host-RAM pinning (
Dynamic RAM Watchdog), non-active GGUF page reclaim, and exactK1/S1/C1tiered quantized KV caches. - Bandwidth: phase-shared
P3layer-major MoE prefill,ARGUS_HETERO_OVERLAPasync GPU shared-MLP ↔ CPU routed-MoE overlap (qwen35moe,gemma4), watermarked mirror re-attach, andP0decode roofline profiling (ARGUS_DECODE_PROFILE=1|2). - Capability: single-pass
preserve_kvVoC 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.
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.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 Kernel & E2E Parity |
K1 matches float64 within < 6e-7 across 10 geometries & {1,2,3,4,8} threads; S1/C1 (f16/q8_0/q4_0) pass 22-step E2E decode, seq_rm, and file-backed slot restore |
test_native_libargus.py |
| Empirically Rejected / Off-by-Default Paths | --moe-cache-mib on PCIe Gen3 x4 (Inkling-2-Mini): 5.6× slower (1.70 vs 9.5 tok/s, 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) |
v1.0 measurements, 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_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, Multi-LoRA compatibility, VoC router, bare WebUI & hygiene (40 tests)
.venv/bin/python -m pytest -q --ignore=tests/test_native_libargus.py
# Native C++/CUDA kernels, slot-restore, preserve_kv & decode profiler telemetry (16 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.0.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.0.1.tar.gz | 141.4 kB | Without provenance | Details for argus_cache-2.0.1.tar.gz |
Release files / argus_cache-2.0.1.tar.gz
| Download URL | argus_cache-2.0.1.tar.gz |
|---|---|
| Size | 141.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
4b984d47d731925a7e88e1b1fd828f823ac47a936022bd756d28eee52ed8d2b1
|
|
BLAKE2b-256 checksum How to use checksums |
a675ee7786983b967ca0e4201fb5ead88f29a289115b533a90ec652f8b4fbaf6
|
| 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.0.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.