argus-cache 0.8.0__tar.gz → 2.0.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- argus_cache-2.0.1/CHANGELOG.md +50 -0
- {argus_cache-0.8.0 → argus_cache-2.0.1}/MANIFEST.in +1 -5
- argus_cache-2.0.1/PKG-INFO +162 -0
- argus_cache-2.0.1/README.md +112 -0
- argus_cache-2.0.1/README_TR.md +90 -0
- argus_cache-2.0.1/argus_cache/__init__.py +12 -0
- argus_cache-2.0.1/argus_cache/adapters/__init__.py +1 -0
- argus_cache-2.0.1/argus_cache/adapters/llama_server.py +723 -0
- argus_cache-2.0.1/argus_cache/adapters/lora.py +276 -0
- argus_cache-2.0.1/argus_cache/chat_cli.py +137 -0
- {argus_cache-0.8.0 → argus_cache-2.0.1}/argus_cache/csrc/argus_config.h +41 -79
- argus_cache-2.0.1/argus_cache/csrc/argus_decode_profile.h +187 -0
- argus_cache-2.0.1/argus_cache/csrc/argus_dynamic_ram.cpp +619 -0
- argus_cache-2.0.1/argus_cache/csrc/argus_dynamic_ram.h +19 -0
- {argus_cache-0.8.0 → argus_cache-2.0.1}/argus_cache/csrc/argus_hetero.h +0 -48
- argus_cache-2.0.1/argus_cache/csrc/argus_telemetry.h +80 -0
- argus_cache-2.0.1/argus_cache/csrc/ggml_cuda_external.cu +190 -0
- {argus_cache-0.8.0 → argus_cache-2.0.1}/argus_cache/csrc/ggml_cuda_external.h +4 -9
- {argus_cache-0.8.0 → argus_cache-2.0.1}/argus_cache/csrc/ggml_decode_attention.cpp +72 -410
- {argus_cache-0.8.0 → argus_cache-2.0.1}/argus_cache/csrc/ggml_decode_attention.h +8 -14
- {argus_cache-0.8.0 → argus_cache-2.0.1}/argus_cache/csrc/ggml_kv_tiers.cpp +113 -28
- {argus_cache-0.8.0 → argus_cache-2.0.1}/argus_cache/csrc/ggml_kv_tiers.h +4 -1
- argus_cache-2.0.1/argus_cache/csrc/ggml_layer_prefill.cpp +295 -0
- {argus_cache-0.8.0 → argus_cache-2.0.1}/argus_cache/csrc/ggml_layer_prefill.h +6 -26
- argus_cache-2.0.1/argus_cache/csrc/ggml_split_attention.cu +542 -0
- {argus_cache-0.8.0 → argus_cache-2.0.1}/argus_cache/csrc/ggml_split_attention.h +2 -1
- argus_cache-2.0.1/argus_cache/voc.py +334 -0
- argus_cache-2.0.1/argus_cache/webui/__init__.py +4 -0
- argus_cache-2.0.1/argus_cache/webui/server.py +576 -0
- argus_cache-2.0.1/argus_cache/webui/static/app.js +442 -0
- argus_cache-2.0.1/argus_cache/webui/static/index.html +61 -0
- argus_cache-2.0.1/argus_cache/webui/static/styles.css +425 -0
- argus_cache-2.0.1/argus_cache.egg-info/PKG-INFO +162 -0
- argus_cache-2.0.1/argus_cache.egg-info/SOURCES.txt +47 -0
- {argus_cache-0.8.0 → argus_cache-2.0.1}/argus_cache.egg-info/entry_points.txt +1 -1
- argus_cache-2.0.1/argus_cache.egg-info/requires.txt +23 -0
- argus_cache-2.0.1/argus_cache.egg-info/top_level.txt +1 -0
- argus_cache-2.0.1/integrations/llama.cpp/README.md +83 -0
- argus_cache-2.0.1/integrations/llama.cpp/argus.patch +2766 -0
- {argus_cache-0.8.0 → argus_cache-2.0.1}/pyproject.toml +19 -22
- argus_cache-2.0.1/tests/test_adapters.py +325 -0
- argus_cache-2.0.1/tests/test_argus_service.py +287 -0
- {argus_cache-0.8.0 → argus_cache-2.0.1}/tests/test_import_hygiene.py +15 -62
- argus_cache-2.0.1/tests/test_native_libargus.py +343 -0
- argus_cache-2.0.1/tests/test_voc_and_webui.py +533 -0
- argus_cache-0.8.0/CHANGELOG.md +0 -506
- argus_cache-0.8.0/PKG-INFO +0 -495
- argus_cache-0.8.0/README.md +0 -445
- argus_cache-0.8.0/README_TR.md +0 -477
- argus_cache-0.8.0/argus_cache/__init__.py +0 -214
- argus_cache-0.8.0/argus_cache/adapters/__init__.py +0 -87
- argus_cache-0.8.0/argus_cache/adapters/anthropic_translate.py +0 -404
- argus_cache-0.8.0/argus_cache/adapters/base.py +0 -218
- argus_cache-0.8.0/argus_cache/adapters/claude_gateway.py +0 -321
- argus_cache-0.8.0/argus_cache/adapters/claude_session.py +0 -282
- argus_cache-0.8.0/argus_cache/adapters/llama_server.py +0 -322
- argus_cache-0.8.0/argus_cache/adapters/ollama.py +0 -402
- argus_cache-0.8.0/argus_cache/adapters/vllm.py +0 -116
- argus_cache-0.8.0/argus_cache/backends/__init__.py +0 -9
- argus_cache-0.8.0/argus_cache/backends/eviction.py +0 -73
- argus_cache-0.8.0/argus_cache/backends/quantization.py +0 -234
- argus_cache-0.8.0/argus_cache/core/__init__.py +0 -1
- argus_cache-0.8.0/argus_cache/core/activation.py +0 -186
- argus_cache-0.8.0/argus_cache/core/backend_pool.py +0 -130
- argus_cache-0.8.0/argus_cache/core/balloon_driver.py +0 -160
- argus_cache-0.8.0/argus_cache/core/dashboard.py +0 -132
- argus_cache-0.8.0/argus_cache/core/direct_attention.py +0 -197
- argus_cache-0.8.0/argus_cache/core/disk_pool.py +0 -158
- argus_cache-0.8.0/argus_cache/core/granularity.py +0 -334
- argus_cache-0.8.0/argus_cache/core/host_spill.py +0 -185
- argus_cache-0.8.0/argus_cache/core/jl_operators.py +0 -128
- argus_cache-0.8.0/argus_cache/core/logger.py +0 -79
- argus_cache-0.8.0/argus_cache/core/memory_manager.py +0 -1961
- argus_cache-0.8.0/argus_cache/core/outliers.py +0 -85
- argus_cache-0.8.0/argus_cache/core/page_store.py +0 -146
- argus_cache-0.8.0/argus_cache/core/page_table.py +0 -220
- argus_cache-0.8.0/argus_cache/core/pool_allocator.py +0 -131
- argus_cache-0.8.0/argus_cache/core/quantization.py +0 -290
- argus_cache-0.8.0/argus_cache/core/telemetry.py +0 -397
- argus_cache-0.8.0/argus_cache/core/tier_registry.py +0 -115
- argus_cache-0.8.0/argus_cache/core/triton_kernels.py +0 -531
- argus_cache-0.8.0/argus_cache/core/zero_copy_pool.py +0 -192
- argus_cache-0.8.0/argus_cache/csrc/bindings.cpp +0 -296
- argus_cache-0.8.0/argus_cache/csrc/ggml_cuda_attention.cu +0 -979
- argus_cache-0.8.0/argus_cache/csrc/ggml_cuda_attention.h +0 -115
- argus_cache-0.8.0/argus_cache/csrc/ggml_cuda_external.cu +0 -88
- argus_cache-0.8.0/argus_cache/csrc/ggml_decode_e1.h +0 -251
- argus_cache-0.8.0/argus_cache/csrc/ggml_disk_buffer.cpp +0 -783
- argus_cache-0.8.0/argus_cache/csrc/ggml_disk_buffer.h +0 -103
- argus_cache-0.8.0/argus_cache/csrc/ggml_disk_gpu.cpp +0 -707
- argus_cache-0.8.0/argus_cache/csrc/ggml_disk_store.h +0 -107
- argus_cache-0.8.0/argus_cache/csrc/ggml_host_buffer.cpp +0 -297
- argus_cache-0.8.0/argus_cache/csrc/ggml_host_buffer.h +0 -26
- argus_cache-0.8.0/argus_cache/csrc/ggml_kv_policy.cpp +0 -131
- argus_cache-0.8.0/argus_cache/csrc/ggml_kv_policy.h +0 -14
- argus_cache-0.8.0/argus_cache/csrc/ggml_layer_prefill.cpp +0 -998
- argus_cache-0.8.0/argus_cache/csrc/ggml_paged_attention.cpp +0 -427
- argus_cache-0.8.0/argus_cache/csrc/ggml_profile.h +0 -152
- argus_cache-0.8.0/argus_cache/csrc/ggml_split_attention.cu +0 -919
- argus_cache-0.8.0/argus_cache/csrc/manager.cpp +0 -1055
- argus_cache-0.8.0/argus_cache/csrc/manager.h +0 -295
- argus_cache-0.8.0/argus_cache/csrc/quantization_kernels.cu +0 -194
- argus_cache-0.8.0/argus_cache/csrc/tier_codec.cpp +0 -112
- argus_cache-0.8.0/argus_cache/csrc/tier_codec.h +0 -143
- argus_cache-0.8.0/argus_cache/csrc/zero_copy_pool.cpp +0 -248
- argus_cache-0.8.0/argus_cache/csrc/zero_copy_pool.h +0 -53
- argus_cache-0.8.0/argus_cache/models/__init__.py +0 -1
- argus_cache-0.8.0/argus_cache/models/attention_wrapper.py +0 -405
- argus_cache-0.8.0/argus_cache/models/hf_attention.py +0 -182
- argus_cache-0.8.0/argus_cache/models/hybrid_cache.py +0 -253
- argus_cache-0.8.0/argus_cache/plugins/__init__.py +0 -169
- argus_cache-0.8.0/argus_cache/plugins/capabilities.py +0 -174
- argus_cache-0.8.0/argus_cache/plugins/registry.py +0 -247
- argus_cache-0.8.0/argus_cache/webui/__init__.py +0 -4
- argus_cache-0.8.0/argus_cache/webui/agent_loop.py +0 -604
- argus_cache-0.8.0/argus_cache/webui/anthropic_routes.py +0 -111
- argus_cache-0.8.0/argus_cache/webui/compaction.py +0 -213
- argus_cache-0.8.0/argus_cache/webui/doc_markdown.py +0 -622
- argus_cache-0.8.0/argus_cache/webui/hermes_pc.py +0 -568
- argus_cache-0.8.0/argus_cache/webui/hermes_vision.py +0 -558
- argus_cache-0.8.0/argus_cache/webui/permissions.py +0 -192
- argus_cache-0.8.0/argus_cache/webui/research_tools.py +0 -342
- argus_cache-0.8.0/argus_cache/webui/server.py +0 -594
- argus_cache-0.8.0/argus_cache/webui/static/app.js +0 -798
- argus_cache-0.8.0/argus_cache/webui/static/chat.css +0 -360
- argus_cache-0.8.0/argus_cache/webui/static/index.html +0 -208
- argus_cache-0.8.0/argus_cache/webui/static/markdown.js +0 -116
- argus_cache-0.8.0/argus_cache/webui/static/studio_panels.js +0 -565
- argus_cache-0.8.0/argus_cache/webui/static/study_deck.js +0 -571
- argus_cache-0.8.0/argus_cache/webui/static/study_research.css +0 -330
- argus_cache-0.8.0/argus_cache/webui/static/styles.css +0 -183
- argus_cache-0.8.0/argus_cache/webui/store.py +0 -406
- argus_cache-0.8.0/argus_cache/webui/study_tools.py +0 -132
- argus_cache-0.8.0/argus_cache/webui/tools.py +0 -561
- argus_cache-0.8.0/argus_cache/webui/web_search.py +0 -226
- argus_cache-0.8.0/argus_cache.egg-info/PKG-INFO +0 -495
- argus_cache-0.8.0/argus_cache.egg-info/SOURCES.txt +0 -152
- argus_cache-0.8.0/argus_cache.egg-info/requires.txt +0 -23
- argus_cache-0.8.0/argus_cache.egg-info/top_level.txt +0 -2
- argus_cache-0.8.0/integrations/llama.cpp/README.md +0 -477
- argus_cache-0.8.0/integrations/llama.cpp/argus.patch +0 -1694
- argus_cache-0.8.0/integrations/llama.cpp/cuda-kv.patch +0 -144
- argus_cache-0.8.0/integrations/llama.cpp/host-kv.patch +0 -259
- argus_cache-0.8.0/integrations/llama.cpp/v08-kv.patch +0 -1412
- argus_cache-0.8.0/setup.py +0 -46
- argus_cache-0.8.0/tests/test_adapters.py +0 -687
- argus_cache-0.8.0/tests/test_adaptive_activation.py +0 -423
- argus_cache-0.8.0/tests/test_argus_service.py +0 -670
- argus_cache-0.8.0/tests/test_attention_parity_matrix.py +0 -350
- argus_cache-0.8.0/tests/test_balloon_driver.py +0 -157
- argus_cache-0.8.0/tests/test_baseline_harness.py +0 -61
- argus_cache-0.8.0/tests/test_claude_gateway.py +0 -460
- argus_cache-0.8.0/tests/test_clock_sweep.py +0 -84
- argus_cache-0.8.0/tests/test_compression_loss.py +0 -129
- argus_cache-0.8.0/tests/test_context_ladder.py +0 -32
- argus_cache-0.8.0/tests/test_direct_paged_attention.py +0 -250
- argus_cache-0.8.0/tests/test_disk_pages.py +0 -213
- argus_cache-0.8.0/tests/test_flash_attention_sink_pinning.py +0 -134
- argus_cache-0.8.0/tests/test_granularity_invariants.py +0 -114
- argus_cache-0.8.0/tests/test_hf_attention_bridge.py +0 -264
- argus_cache-0.8.0/tests/test_host_spill.py +0 -90
- argus_cache-0.8.0/tests/test_hybrid_qwen_cache.py +0 -193
- argus_cache-0.8.0/tests/test_jl_operators.py +0 -138
- argus_cache-0.8.0/tests/test_kv_cache.py +0 -271
- argus_cache-0.8.0/tests/test_llama_integration.py +0 -101
- argus_cache-0.8.0/tests/test_logger.py +0 -70
- argus_cache-0.8.0/tests/test_memory_intelligence.py +0 -316
- argus_cache-0.8.0/tests/test_native_llama_paged.py +0 -312
- argus_cache-0.8.0/tests/test_paper_grade_benchmarks.py +0 -462
- argus_cache-0.8.0/tests/test_pluggable_backends.py +0 -74
- argus_cache-0.8.0/tests/test_plugin_system.py +0 -652
- argus_cache-0.8.0/tests/test_pool_allocator.py +0 -124
- argus_cache-0.8.0/tests/test_prefetch.py +0 -105
- argus_cache-0.8.0/tests/test_quantization.py +0 -59
- argus_cache-0.8.0/tests/test_stability.py +0 -176
- argus_cache-0.8.0/tests/test_streaming_attention.py +0 -84
- argus_cache-0.8.0/tests/test_telemetry_extraction.py +0 -120
- argus_cache-0.8.0/tests/test_ui_mate_workload.py +0 -50
- argus_cache-0.8.0/tests/test_variable_granularity.py +0 -158
- argus_cache-0.8.0/tests/test_webui.py +0 -753
- argus_cache-0.8.0/tests/test_webui_agent_and_hermes.py +0 -514
- argus_cache-0.8.0/tests/test_zero_copy_pcie.py +0 -471
- {argus_cache-0.8.0 → argus_cache-2.0.1}/LICENSE +0 -0
- {argus_cache-0.8.0 → argus_cache-2.0.1}/argus_cache/csrc/ggml_decode_simd.h +0 -0
- {argus_cache-0.8.0 → argus_cache-2.0.1}/argus_cache.egg-info/dependency_links.txt +0 -0
- {argus_cache-0.8.0 → argus_cache-2.0.1}/setup.cfg +0 -0
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## 2.0.1 — 2026-12-02
|
|
4
|
+
|
|
5
|
+
### Added
|
|
6
|
+
- **`P0` Zero-Perturbation Decode Roofline Profiler (`ARGUS_DECODE_PROFILE=1|2`):**
|
|
7
|
+
- Non-overlapping host wall-clock decomposition (`graph_build_ms`, `event_sync_ms`, `h2d_copy_ms`, `d2h_copy_ms`, `d2h_sync_ms`, `gpu_pre_submit_ms`, `cpu_split_ms`, `gpu_split_submit_ms`, `final_sync_ms`, `other_host_ms`) + H2D/D2H byte counters in `ggml-backend.cpp` and `llama-context.cpp`.
|
|
8
|
+
- Separate async CUDA hardware event ring (`256` timing-enabled event pairs in `ggml_cuda_external.cu`, resolved post-sync with zero mid-token stalls) reporting `gpu_pre_hw_ms`, `gpu_post_hw_ms`, theoretical **`overlap_upper_bound_ms`** (`min(cpu_split, gpu_pre_hw)`), and **`event_ring_overflows`**.
|
|
9
|
+
- Level-2 (`ARGUS_DECODE_PROFILE=2`) opt-in CPU inner breakdown (`cpu_mmid_prep_ms`, `cpu_mmid_compute_ms`, `cpu_barrier_ms`, `cpu_other_ops_ms`) in `ggml-cpu.c`.
|
|
10
|
+
- Exported under `GET /props["argus"]["profile"]` with `GET /props?reset_profile=1` reset hook and controlled VRAM-guarded benchmark harness (`benchmarks/profile_decode.py`).
|
|
11
|
+
- **`P3` Multi-LoRA Specialist Cassette Management (`argus_cache/adapters/lora.py`):**
|
|
12
|
+
- GGUF metadata + base-model tensor name & matrix dimension compatibility verification (`verify_lora_compatibility`), rejecting same-architecture dimension mismatches (e.g., E4B vs 26B).
|
|
13
|
+
- VRAM-gated multi-LoRA planner (`plan_multi_lora_scales`, max 4 adapters, KAT default active `1.0` and standby adapters `0.0` via `--lora-scaled`, config precedence over auto-discovery, zero hardcoded external repo paths — configure via `extra_dirs` / `ARGUS_LORA_DIRS`).
|
|
14
|
+
- Bare WebUI cassette selector (`Base` + loaded adapters), serialized slot lock (`slot_lock`) + per-request `lora_id` isolation, and active cassette provenance in SSE `meta`.
|
|
15
|
+
|
|
16
|
+
### Fixed
|
|
17
|
+
- `llama_kv_cache::state_read_data()` now calls `argus_kv_mirror_refresh()` on restored host KV layers so ARGUS GPU mirrors stay coherent across prompt-cache and checkpoint restores (`--no-kv-offload`).
|
|
18
|
+
- `server-context.cpp` now calls `slot.prompt_clear()` (instead of `slot.prompt.clear()`) on LoRA change so KV memory and `prompt_moe_top_k` state clear atomically.
|
|
19
|
+
- `voc.py` `/apply-template` now sends `chat_template_kwargs` instead of ignored `extra_context` (raising `preserve_kv` reuse to `664/666`, `99.7%`).
|
|
20
|
+
- `argus_service.py` now includes loaded LoRA VRAM footprint in `extra_vram` budget calculations.
|
|
21
|
+
- Removed unbacked external numeric claims from `README.md` / `README_TR.md` / `docs/architecture.md`; all reported numbers now trace directly to local `docs/measurements/` or `tests/`.
|
|
22
|
+
|
|
23
|
+
---
|
|
24
|
+
|
|
25
|
+
## 2.0.0 — 2026-12-02
|
|
26
|
+
|
|
27
|
+
### Added
|
|
28
|
+
- **Single-pass KV-preserving VoC (`preserve_kv`)** in `llama-server` (`/embeddings`): saves an `end-1` SWA-safe checkpoint and retains slot KV across matching `moe_top_k` requests, eliminating double prefill on easy/aleatoric turns while strictly invalidating cached KV on `K` escalation (zero `K=2 -> K=8` contamination).
|
|
29
|
+
- **Per-layer dynamic `moe_top_k_layers`** (`llama_set_argus_moe_top_k_layers`, up to 128 layers) in `llama-graph` and `llama-server` for per-layer active expert schedules (e.g. hourglass `[4, ..., 8, ..., 4]`).
|
|
30
|
+
- **Gemma 4 `ARGUS_HETERO_OVERLAP`** in `src/models/gemma4.cpp`: overlaps GPU dense shared MLP (`cur_mlp`) with CPU routed MoE experts (`cur_moe`).
|
|
31
|
+
- **Pure-NumPy VoC runtime (`argus_cache/voc.py`)** and **launcher support** (`--lora`, `--no-mmproj-offload` auto VRAM guard, `--embeddings --pooling last`, `--no-warmup`) built around `ZwannFrederick/Gemma-4-26B-A4B-QAT-KAT-v1`.
|
|
32
|
+
- **Bare Ollama-style chat WebUI (`argus_cache/webui/`)**: minimal local chat frontend (`index.html`, `app.js`, `styles.css`) with streaming, collapsible `<think>`, routing selector (`Auto VoC` / `K=2` / `K=4` / `K=8` / `Layer Profile`), LoRA toggle, and live VRAM/RAM/K telemetry.
|
|
33
|
+
- **Controlled hardware A/B benchmark (`benchmarks/bench_argus.py`)**.
|
|
34
|
+
|
|
35
|
+
### Fixed
|
|
36
|
+
- **P3 layer-major prefill under `--embeddings --pooling last`:** P3 is no longer silently disabled when `llama-server` runs with `--embeddings --pooling last`; `build_pooling` skips intermediate layer passes cleanly.
|
|
37
|
+
- **Dynamic RAM Watchdog under standalone `ARGUS_AUTO=1`:** `argus_moe_init_host_experts` now starts the 512 MiB hysteresis watchdog under both `MADV_RANDOM` and `MADV_NORMAL` (restoring `MADV_RANDOM` after warming active pages).
|
|
38
|
+
- **Minimal P3 KV mirror re-attach:** `argus_kv_mirrors_attach()` now tracks populated `active_cells` per KV tensor and syncs only `[0, active_cells)` instead of full mirror capacity; `llama_kv_cache::clear` resets the watermark via `argus_kv_mirror_clear()`.
|
|
39
|
+
|
|
40
|
+
### Removed
|
|
41
|
+
- Consolidated repository onto a single `main` branch (`v0.8-dev` merged fast-forward and removed).
|
|
42
|
+
- Purged legacy `experiments/` (30K LOC), old `plans/`, pre-v0.8 `benchmarks/` and measurement clutter, the bloated 12K-line Studio/Hermes/Study/OCR/Waybar stack, dead `llama.cpp-v050` split-binary paths, and unused hardcoded `argus_evaluate_moe_cost()` in `argus_hetero.h`.
|
|
43
|
+
|
|
44
|
+
---
|
|
45
|
+
|
|
46
|
+
## 1.0.1-moe-topk — 2026-12-02
|
|
47
|
+
- Synced `.github/workflows/packaging.yml` `LLAMA_CPP_REV` to `5bacb7c868a2bc98682de15f447fc1ce17c9c49c` and added CI revision drift test in `tests/test_import_hygiene.py`.
|
|
48
|
+
|
|
49
|
+
## 1.0.0-moe-topk — 2026-12-01
|
|
50
|
+
- Unified `llama.cpp-next` (`5bacb7c`) + `libargus` (`argus.patch`), per-request runtime dynamic `moe_top_k`, looped-MoE priority RAM pinning (`inkling2_loop`), `/props` `"argus"` telemetry, and dirty-mirror file-backed slot restore refresh.
|
|
@@ -1,8 +1,4 @@
|
|
|
1
|
-
#
|
|
2
|
-
# machine. setuptools infers the .cpp/.cu sources from ext_modules but not the
|
|
3
|
-
# headers they include, so without this an sdist install fails at
|
|
4
|
-
# "fatal error: manager.h: No such file or directory" -- sources present,
|
|
5
|
-
# headers missing.
|
|
1
|
+
# libargus sources ship with the package; the README's build steps compile them into llama.cpp.
|
|
6
2
|
include LICENSE
|
|
7
3
|
include README.md
|
|
8
4
|
include CHANGELOG.md
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: argus_cache
|
|
3
|
+
Version: 2.0.1
|
|
4
|
+
Summary: Hardware-aware adaptive compute and memory runtime for llama.cpp: P3 prefill, S1/K1 KV tiers, elastic RAM watchdog, single-pass VoC dynamic moe_top_k, and bare chat UI
|
|
5
|
+
Author: Muhammed Emin Çelik
|
|
6
|
+
License: Apache-2.0
|
|
7
|
+
Project-URL: Homepage, https://github.com/Zwannfrederick/argus
|
|
8
|
+
Project-URL: Repository, https://github.com/Zwannfrederick/argus
|
|
9
|
+
Project-URL: Changelog, https://github.com/Zwannfrederick/argus/blob/main/CHANGELOG.md
|
|
10
|
+
Project-URL: Issues, https://github.com/Zwannfrederick/argus/issues
|
|
11
|
+
Keywords: llm-inference,inference-optimization,llama-cpp,kv-cache,gpu-optimization,memory-management,cuda,local-llm
|
|
12
|
+
Classifier: Development Status :: 4 - Beta
|
|
13
|
+
Classifier: Intended Audience :: Science/Research
|
|
14
|
+
Classifier: License :: OSI Approved :: Apache Software License
|
|
15
|
+
Classifier: Programming Language :: Python :: 3
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
21
|
+
Classifier: Programming Language :: C++
|
|
22
|
+
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
23
|
+
Classifier: Topic :: System :: Hardware :: Symmetric Multi-processing
|
|
24
|
+
Classifier: Operating System :: POSIX :: Linux
|
|
25
|
+
Classifier: Environment :: GPU :: NVIDIA CUDA
|
|
26
|
+
Requires-Python: >=3.10
|
|
27
|
+
Description-Content-Type: text/markdown
|
|
28
|
+
License-File: LICENSE
|
|
29
|
+
Provides-Extra: webui
|
|
30
|
+
Requires-Dist: fastapi; extra == "webui"
|
|
31
|
+
Requires-Dist: uvicorn; extra == "webui"
|
|
32
|
+
Requires-Dist: httpx; extra == "webui"
|
|
33
|
+
Requires-Dist: pydantic; extra == "webui"
|
|
34
|
+
Requires-Dist: numpy; extra == "webui"
|
|
35
|
+
Provides-Extra: studio
|
|
36
|
+
Requires-Dist: fastapi; extra == "studio"
|
|
37
|
+
Requires-Dist: uvicorn; extra == "studio"
|
|
38
|
+
Requires-Dist: httpx; extra == "studio"
|
|
39
|
+
Requires-Dist: pydantic; extra == "studio"
|
|
40
|
+
Requires-Dist: numpy; extra == "studio"
|
|
41
|
+
Provides-Extra: dev
|
|
42
|
+
Requires-Dist: pytest; extra == "dev"
|
|
43
|
+
Requires-Dist: httpx; extra == "dev"
|
|
44
|
+
Requires-Dist: fastapi; extra == "dev"
|
|
45
|
+
Requires-Dist: uvicorn; extra == "dev"
|
|
46
|
+
Requires-Dist: pydantic; extra == "dev"
|
|
47
|
+
Requires-Dist: numpy; extra == "dev"
|
|
48
|
+
Requires-Dist: ruff; extra == "dev"
|
|
49
|
+
Dynamic: license-file
|
|
50
|
+
|
|
51
|
+
# ARGUS (`libargus` + Adaptive MoE Runtime)
|
|
52
|
+
|
|
53
|
+
**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.**
|
|
54
|
+
|
|
55
|
+
ARGUS focuses strictly on four optimization axes for local sparse MoE inference:
|
|
56
|
+
- **Compute:** per-request `moe_top_k`, per-layer `moe_top_k_layers`, and reasoning-budget routing.
|
|
57
|
+
- **Memory:** elastic host-RAM pinning (`Dynamic RAM Watchdog`), non-active GGUF page reclaim, and exact `K1`/`S1`/`C1` tiered quantized KV caches.
|
|
58
|
+
- **Bandwidth:** phase-shared `P3` layer-major MoE prefill, `ARGUS_HETERO_OVERLAP` async GPU shared-MLP ↔ CPU routed-MoE overlap (`qwen35moe`, `gemma4`), watermarked mirror re-attach, and `P0` decode roofline profiling (`ARGUS_DECODE_PROFILE=1|2`).
|
|
59
|
+
- **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`).
|
|
60
|
+
|
|
61
|
+
Compatible adaptive-compute adapter & VoC gate: **[ZwannFrederick/Gemma-4-26B-A4B-QAT-KAT-v1](https://huggingface.co/ZwannFrederick/Gemma-4-26B-A4B-QAT-KAT-v1)**.
|
|
62
|
+
|
|
63
|
+
[](https://github.com/Zwannfrederick/argus/actions/workflows/packaging.yml)
|
|
64
|
+
|
|
65
|
+
Türkçe belge: [README_TR.md](README_TR.md) · Mimari: [docs/architecture.md](docs/architecture.md)
|
|
66
|
+
|
|
67
|
+
---
|
|
68
|
+
|
|
69
|
+
## Verified Results (RTX 3050 Ti 4 GB + i5-11300H + 32 GiB DDR4)
|
|
70
|
+
|
|
71
|
+
Every figure below is backed directly by a recorded JSON/report inside [`docs/measurements/`](docs/measurements/README.md) or automated tests in [`tests/`](tests/) on the same consumer laptop ([bandwidth census](docs/measurements/v080-census-2026-09-26/README.md): `PCIe Gen3 x4 = 3.14 GB/s`, `DDR4 = 42.2 GB/s`).
|
|
72
|
+
|
|
73
|
+
| Capability | Verified Evidence | Reference |
|
|
74
|
+
|---|---|---|
|
|
75
|
+
| **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](docs/measurements/v201-2026-12-02/README.md) |
|
|
76
|
+
| **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](docs/measurements/v200-2026-12-02/README.md) |
|
|
77
|
+
| **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](docs/measurements/v100-2026-11-24/README.md) |
|
|
78
|
+
| **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](docs/measurements/v080-m1-2026-09-27/README.md), [P3](docs/measurements/v080-prefill-2026-09-28/README.md) |
|
|
79
|
+
| **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`](tests/test_native_libargus.py) |
|
|
80
|
+
| **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](docs/measurements/v100-2026-11-24/README.md), [speculative A/B](docs/measurements/speculative-ab-2026-11-09/mtp_ab_results.json) |
|
|
81
|
+
|
|
82
|
+
---
|
|
83
|
+
|
|
84
|
+
## Quick Start
|
|
85
|
+
|
|
86
|
+
### 1. Build `llama-server` with `libargus`
|
|
87
|
+
|
|
88
|
+
Apply [`integrations/llama.cpp/argus.patch`](integrations/llama.cpp/argus.patch) onto pinned `llama.cpp` commit `5bacb7c868a2bc98682de15f447fc1ce17c9c49c`:
|
|
89
|
+
|
|
90
|
+
```bash
|
|
91
|
+
git -C /path/to/llama.cpp apply /path/to/ARGUS/integrations/llama.cpp/argus.patch
|
|
92
|
+
cmake -S /path/to/llama.cpp -B /path/to/llama.cpp/build-cuda \
|
|
93
|
+
-DCMAKE_BUILD_TYPE=Release -DGGML_CUDA=ON -DCMAKE_CUDA_ARCHITECTURES=86 \
|
|
94
|
+
-DGGML_CUDA_FA=ON -DGGML_CUDA_FA_QUANTS="q4_0-q4_0;q8_0-q8_0;f16-f16;bf16-bf16" \
|
|
95
|
+
-DGGML_NATIVE=ON -DARGUS_CORE_DIR=/path/to/ARGUS/argus_cache/csrc
|
|
96
|
+
cmake --build /path/to/llama.cpp/build-cuda --target llama-server -j"$(nproc)"
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
### 2. Run Gemma 4 26B QAT + KAT-LoRA v1 + Single-Pass VoC (4 GB VRAM)
|
|
100
|
+
|
|
101
|
+
```bash
|
|
102
|
+
ARGUS_AUTO=1 ARGUS_P3_COALESCE=1 ./llama-server \
|
|
103
|
+
-m gemma-4-26B_q4_0-it.gguf \
|
|
104
|
+
--lora gemma4_kat_v1.gguf \
|
|
105
|
+
--mmproj mmproj-gemma-4-26B-BF16.gguf --no-mmproj-offload \
|
|
106
|
+
-c 32768 -ngl 99 -ncmoe 30 -fa on -nkvo -ctk q4_0 -ctv q4_0 \
|
|
107
|
+
-np 1 -t 4 -tb 6 -b 512 -ub 512 --load-mode mmap --no-warmup \
|
|
108
|
+
--embeddings --pooling last --port 8080
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
### 3. Bare Ollama-Style Chat UI & CLI
|
|
112
|
+
|
|
113
|
+
```bash
|
|
114
|
+
# Bare chat UI on http://127.0.0.1:8090 (Auto VoC / K=2 / K=4 / K=8 / Layer Profile + LoRA toggle)
|
|
115
|
+
python -m argus_cache.webui.server --upstream http://127.0.0.1:8080/v1 --port 8090
|
|
116
|
+
|
|
117
|
+
# Or via service controller & terminal chat
|
|
118
|
+
./scripts/argus_ctl.sh start
|
|
119
|
+
./scripts/argus_ctl.sh status
|
|
120
|
+
./scripts/argus_ctl.sh chat --voc
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
---
|
|
124
|
+
|
|
125
|
+
## Runtime Configuration
|
|
126
|
+
|
|
127
|
+
| Knob | Values | Effect |
|
|
128
|
+
|---|---|---|
|
|
129
|
+
| `ARGUS_AUTO` | `1` / `0` | Autonomous mode: enables `K1`, `S1` (`auto` VRAM mirror), `P2`, `P3`, `ARGUS_HETERO_SCHED`, `ARGUS_HETERO_OVERLAP`, and `Dynamic RAM Watchdog`. |
|
|
130
|
+
| `ARGUS_P3_COALESCE` | `1` / `0` | Keeps only the cheap `end-4` checkpoint split during prefill (1 P3 pass per request). |
|
|
131
|
+
| `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`). |
|
|
132
|
+
| `ARGUS_HETERO_OVERLAP` | `1` / `0` | Overlaps GPU shared MLP / shared expert with CPU routed MoE (`qwen35moe`, `gemma4`). |
|
|
133
|
+
| `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`. |
|
|
134
|
+
| `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. |
|
|
135
|
+
| Request `moe_top_k` | `0..64` | Runtime active MoE expert count per request (`0` = model default). |
|
|
136
|
+
| Request `moe_top_k_layers` | `[int, ...]` (≤128) | Per-layer active MoE expert schedule (e.g. hourglass `[4×8, 8×14, 4×8]`). |
|
|
137
|
+
| `/embeddings` `preserve_kv` | `true` / `false` | Keeps slot KV + `end-1` SWA checkpoint after embedding probe so matching `K` completions skip double prefill. |
|
|
138
|
+
|
|
139
|
+
---
|
|
140
|
+
|
|
141
|
+
## Verification
|
|
142
|
+
|
|
143
|
+
```bash
|
|
144
|
+
# Python runtime, Multi-LoRA compatibility, VoC router, bare WebUI & hygiene (40 tests)
|
|
145
|
+
.venv/bin/python -m pytest -q --ignore=tests/test_native_libargus.py
|
|
146
|
+
|
|
147
|
+
# Native C++/CUDA kernels, slot-restore, preserve_kv & decode profiler telemetry (16 tests)
|
|
148
|
+
ARGUS_TEST_CUDA=1 \
|
|
149
|
+
ARGUS_LLAMA_CPP_DIR="$PWD/scratch/llama.cpp-next" \
|
|
150
|
+
ARGUS_LLAMA_BUILD=build-cuda \
|
|
151
|
+
ARGUS_TEST_GGUF="$PWD/scratch/models/stories15M.gguf" \
|
|
152
|
+
ARGUS_TEST_QUANT_GGUF="$PWD/scratch/models/qwen2.5-0.5b-instruct-q4_k_m.gguf" \
|
|
153
|
+
.venv/bin/python -m pytest -v tests/test_native_libargus.py
|
|
154
|
+
|
|
155
|
+
# Controlled hardware A/B benchmark & decode roofline profiler (VRAM-guarded)
|
|
156
|
+
.venv/bin/python benchmarks/bench_argus.py --voc-dir /path/to/voc --lora-dir /path/to/loras
|
|
157
|
+
.venv/bin/python benchmarks/profile_decode.py --lora-dir /path/to/loras
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
## License
|
|
161
|
+
|
|
162
|
+
Apache 2.0 — see [LICENSE](LICENSE).
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
# ARGUS (`libargus` + Adaptive MoE Runtime)
|
|
2
|
+
|
|
3
|
+
**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.**
|
|
4
|
+
|
|
5
|
+
ARGUS focuses strictly on four optimization axes for local sparse MoE inference:
|
|
6
|
+
- **Compute:** per-request `moe_top_k`, per-layer `moe_top_k_layers`, and reasoning-budget routing.
|
|
7
|
+
- **Memory:** elastic host-RAM pinning (`Dynamic RAM Watchdog`), non-active GGUF page reclaim, and exact `K1`/`S1`/`C1` tiered quantized KV caches.
|
|
8
|
+
- **Bandwidth:** phase-shared `P3` layer-major MoE prefill, `ARGUS_HETERO_OVERLAP` async GPU shared-MLP ↔ CPU routed-MoE overlap (`qwen35moe`, `gemma4`), watermarked mirror re-attach, and `P0` decode roofline profiling (`ARGUS_DECODE_PROFILE=1|2`).
|
|
9
|
+
- **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`).
|
|
10
|
+
|
|
11
|
+
Compatible adaptive-compute adapter & VoC gate: **[ZwannFrederick/Gemma-4-26B-A4B-QAT-KAT-v1](https://huggingface.co/ZwannFrederick/Gemma-4-26B-A4B-QAT-KAT-v1)**.
|
|
12
|
+
|
|
13
|
+
[](https://github.com/Zwannfrederick/argus/actions/workflows/packaging.yml)
|
|
14
|
+
|
|
15
|
+
Türkçe belge: [README_TR.md](README_TR.md) · Mimari: [docs/architecture.md](docs/architecture.md)
|
|
16
|
+
|
|
17
|
+
---
|
|
18
|
+
|
|
19
|
+
## Verified Results (RTX 3050 Ti 4 GB + i5-11300H + 32 GiB DDR4)
|
|
20
|
+
|
|
21
|
+
Every figure below is backed directly by a recorded JSON/report inside [`docs/measurements/`](docs/measurements/README.md) or automated tests in [`tests/`](tests/) on the same consumer laptop ([bandwidth census](docs/measurements/v080-census-2026-09-26/README.md): `PCIe Gen3 x4 = 3.14 GB/s`, `DDR4 = 42.2 GB/s`).
|
|
22
|
+
|
|
23
|
+
| Capability | Verified Evidence | Reference |
|
|
24
|
+
|---|---|---|
|
|
25
|
+
| **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](docs/measurements/v201-2026-12-02/README.md) |
|
|
26
|
+
| **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](docs/measurements/v200-2026-12-02/README.md) |
|
|
27
|
+
| **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](docs/measurements/v100-2026-11-24/README.md) |
|
|
28
|
+
| **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](docs/measurements/v080-m1-2026-09-27/README.md), [P3](docs/measurements/v080-prefill-2026-09-28/README.md) |
|
|
29
|
+
| **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`](tests/test_native_libargus.py) |
|
|
30
|
+
| **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](docs/measurements/v100-2026-11-24/README.md), [speculative A/B](docs/measurements/speculative-ab-2026-11-09/mtp_ab_results.json) |
|
|
31
|
+
|
|
32
|
+
---
|
|
33
|
+
|
|
34
|
+
## Quick Start
|
|
35
|
+
|
|
36
|
+
### 1. Build `llama-server` with `libargus`
|
|
37
|
+
|
|
38
|
+
Apply [`integrations/llama.cpp/argus.patch`](integrations/llama.cpp/argus.patch) onto pinned `llama.cpp` commit `5bacb7c868a2bc98682de15f447fc1ce17c9c49c`:
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
git -C /path/to/llama.cpp apply /path/to/ARGUS/integrations/llama.cpp/argus.patch
|
|
42
|
+
cmake -S /path/to/llama.cpp -B /path/to/llama.cpp/build-cuda \
|
|
43
|
+
-DCMAKE_BUILD_TYPE=Release -DGGML_CUDA=ON -DCMAKE_CUDA_ARCHITECTURES=86 \
|
|
44
|
+
-DGGML_CUDA_FA=ON -DGGML_CUDA_FA_QUANTS="q4_0-q4_0;q8_0-q8_0;f16-f16;bf16-bf16" \
|
|
45
|
+
-DGGML_NATIVE=ON -DARGUS_CORE_DIR=/path/to/ARGUS/argus_cache/csrc
|
|
46
|
+
cmake --build /path/to/llama.cpp/build-cuda --target llama-server -j"$(nproc)"
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
### 2. Run Gemma 4 26B QAT + KAT-LoRA v1 + Single-Pass VoC (4 GB VRAM)
|
|
50
|
+
|
|
51
|
+
```bash
|
|
52
|
+
ARGUS_AUTO=1 ARGUS_P3_COALESCE=1 ./llama-server \
|
|
53
|
+
-m gemma-4-26B_q4_0-it.gguf \
|
|
54
|
+
--lora gemma4_kat_v1.gguf \
|
|
55
|
+
--mmproj mmproj-gemma-4-26B-BF16.gguf --no-mmproj-offload \
|
|
56
|
+
-c 32768 -ngl 99 -ncmoe 30 -fa on -nkvo -ctk q4_0 -ctv q4_0 \
|
|
57
|
+
-np 1 -t 4 -tb 6 -b 512 -ub 512 --load-mode mmap --no-warmup \
|
|
58
|
+
--embeddings --pooling last --port 8080
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
### 3. Bare Ollama-Style Chat UI & CLI
|
|
62
|
+
|
|
63
|
+
```bash
|
|
64
|
+
# Bare chat UI on http://127.0.0.1:8090 (Auto VoC / K=2 / K=4 / K=8 / Layer Profile + LoRA toggle)
|
|
65
|
+
python -m argus_cache.webui.server --upstream http://127.0.0.1:8080/v1 --port 8090
|
|
66
|
+
|
|
67
|
+
# Or via service controller & terminal chat
|
|
68
|
+
./scripts/argus_ctl.sh start
|
|
69
|
+
./scripts/argus_ctl.sh status
|
|
70
|
+
./scripts/argus_ctl.sh chat --voc
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
---
|
|
74
|
+
|
|
75
|
+
## Runtime Configuration
|
|
76
|
+
|
|
77
|
+
| Knob | Values | Effect |
|
|
78
|
+
|---|---|---|
|
|
79
|
+
| `ARGUS_AUTO` | `1` / `0` | Autonomous mode: enables `K1`, `S1` (`auto` VRAM mirror), `P2`, `P3`, `ARGUS_HETERO_SCHED`, `ARGUS_HETERO_OVERLAP`, and `Dynamic RAM Watchdog`. |
|
|
80
|
+
| `ARGUS_P3_COALESCE` | `1` / `0` | Keeps only the cheap `end-4` checkpoint split during prefill (1 P3 pass per request). |
|
|
81
|
+
| `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`). |
|
|
82
|
+
| `ARGUS_HETERO_OVERLAP` | `1` / `0` | Overlaps GPU shared MLP / shared expert with CPU routed MoE (`qwen35moe`, `gemma4`). |
|
|
83
|
+
| `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`. |
|
|
84
|
+
| `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. |
|
|
85
|
+
| Request `moe_top_k` | `0..64` | Runtime active MoE expert count per request (`0` = model default). |
|
|
86
|
+
| Request `moe_top_k_layers` | `[int, ...]` (≤128) | Per-layer active MoE expert schedule (e.g. hourglass `[4×8, 8×14, 4×8]`). |
|
|
87
|
+
| `/embeddings` `preserve_kv` | `true` / `false` | Keeps slot KV + `end-1` SWA checkpoint after embedding probe so matching `K` completions skip double prefill. |
|
|
88
|
+
|
|
89
|
+
---
|
|
90
|
+
|
|
91
|
+
## Verification
|
|
92
|
+
|
|
93
|
+
```bash
|
|
94
|
+
# Python runtime, Multi-LoRA compatibility, VoC router, bare WebUI & hygiene (40 tests)
|
|
95
|
+
.venv/bin/python -m pytest -q --ignore=tests/test_native_libargus.py
|
|
96
|
+
|
|
97
|
+
# Native C++/CUDA kernels, slot-restore, preserve_kv & decode profiler telemetry (16 tests)
|
|
98
|
+
ARGUS_TEST_CUDA=1 \
|
|
99
|
+
ARGUS_LLAMA_CPP_DIR="$PWD/scratch/llama.cpp-next" \
|
|
100
|
+
ARGUS_LLAMA_BUILD=build-cuda \
|
|
101
|
+
ARGUS_TEST_GGUF="$PWD/scratch/models/stories15M.gguf" \
|
|
102
|
+
ARGUS_TEST_QUANT_GGUF="$PWD/scratch/models/qwen2.5-0.5b-instruct-q4_k_m.gguf" \
|
|
103
|
+
.venv/bin/python -m pytest -v tests/test_native_libargus.py
|
|
104
|
+
|
|
105
|
+
# Controlled hardware A/B benchmark & decode roofline profiler (VRAM-guarded)
|
|
106
|
+
.venv/bin/python benchmarks/bench_argus.py --voc-dir /path/to/voc --lora-dir /path/to/loras
|
|
107
|
+
.venv/bin/python benchmarks/profile_decode.py --lora-dir /path/to/loras
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
## License
|
|
111
|
+
|
|
112
|
+
Apache 2.0 — see [LICENSE](LICENSE).
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
# ARGUS (`libargus` + Adaptif MoE Çalışma Zamanı)
|
|
2
|
+
|
|
3
|
+
**Tüketici donanımı (4 GB VRAM + 32 GB RAM) için `llama.cpp` tabanlı donanım-farkında adaptif hesaplama & bellek optimizasyon motoru ve sade Ollama tarzı yerel sohbet arayüzü.**
|
|
4
|
+
|
|
5
|
+
ARGUS, yerel seyrek MoE çıkarımını dört net optimizasyon ekseninde çözer:
|
|
6
|
+
- **Compute:** istek başına (`moe_top_k`) ve katman başına (`moe_top_k_layers`) aktif uzman seçimi, düşünme bütçesi yönlendirmesi.
|
|
7
|
+
- **Memory:** esnek RAM bekçisi (`Dynamic RAM Watchdog`), GPU'ya taşınan GGUF sayfalarının OS önbelleğinden geri kazanımı ve kayıpsız `K1`/`S1`/`C1` kademeli KV önbelleği.
|
|
8
|
+
- **Bandwidth:** faz-paylaşımlı `P3` katman-öncelikli MoE prefill, GPU paylaşımlı-MLP ↔ CPU yönlendirmeli-MoE paralelleştirmesi (`qwen35moe`, `gemma4`) ve sıfır-ek-yüklü decode roofline profilleyici (`ARGUS_DECODE_PROFILE=1|2`).
|
|
9
|
+
- **Capability:** `preserve_kv` ile tek-geçişli `11 KB` VoC yönlendirme (`argus_cache/voc.py`) ve GGUF tensör/boyut doğrulamalı çoklu LoRA kaset hot-swap (`argus_cache/adapters/lora.py`, harici dizinler `ARGUS_LORA_DIRS` / `extra_dirs` üzerinden).
|
|
10
|
+
|
|
11
|
+
Uyumlu adaptif-hesaplama adaptörü ve VoC kapısı: **[ZwannFrederick/Gemma-4-26B-A4B-QAT-KAT-v1](https://huggingface.co/ZwannFrederick/Gemma-4-26B-A4B-QAT-KAT-v1)**.
|
|
12
|
+
|
|
13
|
+
İngilizce belge: [README.md](README.md) · Mimari: [docs/architecture.md](docs/architecture.md) · v2.0.1 Ölçümleri: [docs/measurements/v201-2026-12-02/README.md](docs/measurements/v201-2026-12-02/README.md)
|
|
14
|
+
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
## Doğrulanmış v2.0.x Sonuçları (RTX 3050 Ti 4 GB + 32 GiB DDR4)
|
|
18
|
+
|
|
19
|
+
| Yetenek | Ölçülen Kanıt (`gemma-4-26B_q4_0-it` + `gemma4_kat_v1` / Multi-LoRA) | Referans |
|
|
20
|
+
|---|---|---|
|
|
21
|
+
| **v2.0.1 Decode Roofline Profilleyici & Çoklu LoRA (3 Kaset)** | `ARGUS_DECODE_PROFILE=1\|2` (`0` ring taşması, ortalama `+0.14%` ölçüm sapması): `K=8`'de CPU MoE `%72.6` (`41.08/56.60 ms`, `%92.4` `MUL_MAT_ID`, bariyer sadece `%2.1`); `K=2`'de GPU bekleyişi başa geçer (`11.33/24.45 ms`, `%46.4`); `overlap=1` teorik `3.63–3.65 ms` üst sınırın `%91–95`'ini gerçekleştirir; LoRA `+2.9 ms` GPU HW (`+1.65–1.81 ms` duvar saati, kalanı overlap'te gizli); 3 uyumluluk-doğrulanmış kaset **`2,525 MiB`** VRAM (`7.08 ms` hot-swap, çapraz LoRA `cache_n=0`, `A→B→A` ve eşzamanlı istek izolasyonu %100 birebir, 12 döngüde `+9.4 MiB` RSS / `+6 MiB` VRAM) | [v2.0.1 Ölçümleri](docs/measurements/v201-2026-12-02/README.md) |
|
|
22
|
+
| **Gemma 4 `ARGUS_HETERO_OVERLAP` (kayıpsız)** | **`K=8`: `16.95 → 19.43 tok/s` (`+14.6%`)**, **`K=4`: `26.23 → 29.05` (`+10.8%`)**, **`K=2`: `34.82 → 38.78` (`+11.4%`)** — tüm `K`'larda birebir greedy eşitliği (`true`) | [v2.0.0 Ölçümleri](docs/measurements/v200-2026-12-02/README.md) |
|
|
23
|
+
| **Tek-Geçişli `preserve_kv` VoC + `P3`** | 666 tokenlik istemde **`664/666` (`%99.7`) KV yeniden kullanımı**, toplam süre **`10.83s → 5.42s` (`2.00×`)**, `K` yükseltmede `cache_n=0` (sıfır KV sızıntısı); `P3` `--embeddings` altında birebir (`cos=1.000000`) | [v2.0.0 Ölçümleri](docs/measurements/v200-2026-12-02/README.md) |
|
|
24
|
+
| **Katman Profili (`4/8/4` Kum Saati) & Bellek** | **`23.20 tok/s` (`K=8`'e göre `+19.4%`)**, 4/4 matematik (`23.44 tok/s`); `ARGUS_AUTO=1` **`2,445 / 4,096 MiB` VRAM**, `30/30` katman RAM'de sabit + `923 MiB` geri kazanım | [v2.0.0 Ölçümleri](docs/measurements/v200-2026-12-02/README.md) |
|
|
25
|
+
|
|
26
|
+
---
|
|
27
|
+
|
|
28
|
+
## Hızlı Başlangıç
|
|
29
|
+
|
|
30
|
+
### 1. `libargus` ile `llama-server` Derleme
|
|
31
|
+
|
|
32
|
+
[`integrations/llama.cpp/argus.patch`](integrations/llama.cpp/argus.patch) yamasını sabitli `5bacb7c868a2bc98682de15f447fc1ce17c9c49c` revizyonuna uygulayın:
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
git -C /path/to/llama.cpp apply /path/to/ARGUS/integrations/llama.cpp/argus.patch
|
|
36
|
+
cmake -S /path/to/llama.cpp -B /path/to/llama.cpp/build-cuda \
|
|
37
|
+
-DCMAKE_BUILD_TYPE=Release -DGGML_CUDA=ON -DCMAKE_CUDA_ARCHITECTURES=86 \
|
|
38
|
+
-DGGML_CUDA_FA=ON -DGGML_CUDA_FA_QUANTS="q4_0-q4_0;q8_0-q8_0;f16-f16;bf16-bf16" \
|
|
39
|
+
-DGGML_NATIVE=ON -DARGUS_CORE_DIR=/path/to/ARGUS/argus_cache/csrc
|
|
40
|
+
cmake --build /path/to/llama.cpp/build-cuda --target llama-server -j"$(nproc)"
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
### 2. Gemma 4 26B QAT + KAT-LoRA v1 + Tek-Geçişli VoC (4 GB VRAM)
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
ARGUS_AUTO=1 ARGUS_P3_COALESCE=1 ./llama-server \
|
|
47
|
+
-m gemma-4-26B_q4_0-it.gguf \
|
|
48
|
+
--lora gemma4_kat_v1.gguf \
|
|
49
|
+
--mmproj mmproj-gemma-4-26B-BF16.gguf --no-mmproj-offload \
|
|
50
|
+
-c 32768 -ngl 99 -ncmoe 30 -fa on -nkvo -ctk q4_0 -ctv q4_0 \
|
|
51
|
+
-np 1 -t 4 -tb 6 -b 512 -ub 512 --load-mode mmap --no-warmup \
|
|
52
|
+
--embeddings --pooling last --port 8080
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
### 3. Sade Sohbet Arayüzü ve CLI
|
|
56
|
+
|
|
57
|
+
```bash
|
|
58
|
+
# Sade Ollama tarzı sohbet arayüzü (http://127.0.0.1:8090)
|
|
59
|
+
python -m argus_cache.webui.server --upstream http://127.0.0.1:8080/v1 --port 8090
|
|
60
|
+
|
|
61
|
+
# Servis yönetimi ve VoC destekli terminal sohbet
|
|
62
|
+
./scripts/argus_ctl.sh start
|
|
63
|
+
./scripts/argus_ctl.sh status
|
|
64
|
+
./scripts/argus_ctl.sh chat --voc
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
---
|
|
68
|
+
|
|
69
|
+
## Doğrulama
|
|
70
|
+
|
|
71
|
+
```bash
|
|
72
|
+
# Python runtime, VoC, sade WebUI & paketleme testleri
|
|
73
|
+
.venv/bin/python -m pytest -q --ignore=tests/test_native_libargus.py
|
|
74
|
+
|
|
75
|
+
# Yerel C++/CUDA çekirdek, slot-restore & /props telemetri testleri
|
|
76
|
+
ARGUS_TEST_CUDA=1 \
|
|
77
|
+
ARGUS_LLAMA_CPP_DIR="$PWD/scratch/llama.cpp-next" \
|
|
78
|
+
ARGUS_LLAMA_BUILD=build-cuda \
|
|
79
|
+
ARGUS_TEST_GGUF="$PWD/scratch/models/stories15M.gguf" \
|
|
80
|
+
ARGUS_TEST_QUANT_GGUF="$PWD/scratch/models/qwen2.5-0.5b-instruct-q4_k_m.gguf" \
|
|
81
|
+
.venv/bin/python -m pytest -v tests/test_native_libargus.py
|
|
82
|
+
|
|
83
|
+
# Gemma 4 26B QAT donanım A/B benchmark & decode roofline profilleyici (VRAM korumalı)
|
|
84
|
+
.venv/bin/python benchmarks/bench_argus.py --voc-dir /yol/voc --lora-dir /yol/loras
|
|
85
|
+
.venv/bin/python benchmarks/profile_decode.py --lora-dir /yol/loras
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
## Lisans
|
|
89
|
+
|
|
90
|
+
Apache 2.0 — [LICENSE](LICENSE).
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"""ARGUS: hardware-aware adaptive compute and memory runtime for llama.cpp.
|
|
2
|
+
|
|
3
|
+
Core components:
|
|
4
|
+
- ``argus_cache/csrc`` (``libargus``): C++/CUDA P3 layer-major prefill, S1/K1 tiered KV,
|
|
5
|
+
elastic host RAM watchdog, heterogeneous CPU/GPU overlap, and runtime dynamic ``moe_top_k``.
|
|
6
|
+
- :mod:`argus_cache.adapters.llama_server`: GGUF layout planner and ``llama-server`` launcher.
|
|
7
|
+
- :mod:`argus_cache.voc`: Pure-NumPy self-supervised VoC gate & single-pass KV-preserving router.
|
|
8
|
+
- :mod:`argus_cache.cli`: Service controller and terminal chat CLI.
|
|
9
|
+
- :mod:`argus_cache.webui`: Minimal Ollama-style bare chat WebUI.
|
|
10
|
+
"""
|
|
11
|
+
|
|
12
|
+
__version__ = "2.0.1"
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"""Launch planning for the ARGUS-built llama-server (:mod:`.llama_server`)."""
|