ARGUS: Anchored Random Geometric Unbiased Storage - Advanced Dynamic Quantized KV Cache
Project description
โก ARGUS: Virtual Memory for Transformers
Run long-context LLM inference on GPUs that normally run out of VRAM.
โก The One-Minute Explanation
ARGUS transforms the Key-Value (KV) cache into an OS-like hierarchical virtual memory system:
- Hot Memory stays in high-fidelity FP16 for critical, recent, and highly-attended tokens.
- Cold Memory is progressively compressed from FP8 down to 1-Bit.
- Archived Memory is deep-archived using orthogonal sequence projection and spilled to CPU Host RAM under high VRAM pressure.
- Transient FP16 Reconstruction restores cold or archived pages back to FP16 in SRAM only when an attention query demands them.
๐งฌ Visual Architecture
FP16 Active Pool (Hot)
โ
โผ (Compression Cascade)
FP8
โ
โผ
INT8
โ
โผ
INT4 (2-way Bit-Packed)
โ
โผ
INT2 (4-way Bit-Packed)
โ
โผ
1-Bit (8-way Sign-Packed)
โ
โผ
JL Archive (Deep Orthogonal Projection)
โ
โผ (VRAM Limit Crossed)
CPU Spill (Host DRAM Swapping)
โ
โโโโโโโโผโโโโโโโ (Attention Locality Spike / Query)
โผ
Transient FP16 Reconstruction (in GPU SRAM)
๐ง Why It Works: Storage vs. Computation
[!IMPORTANT]
ARGUS compresses storage, not computation.We do not run 1-bit or low-bit matrix multiplication during attention. Low-bit attention calculations degrade model cognition. Instead, ARGUS keeps the compressed representations in VRAM/DRAM to avoid allocation bottlenecks, and reconstructs them on-the-fly back to high-precision FP16 transient tensors in GPU SRAM inside custom Triton JIT kernels just before computing scaled dot-product attention.
This guarantees maximum semantic fidelity and preserves the model's original attention map distribution.
๐ Real Benchmarks
We believe in reproducible, honest benchmarks. ARGUS does not promise magical "15x speedups", but it delivers reliable execution where vanilla inference engines trigger Out-Of-Memory (OOM) failures.
KV Cache Memory Avoided
(TinyLlama-1.1B on RTX 3050 Ti Laptop, 4GB VRAM)
| Context Length | Vanilla vLLM VRAM | ARGUS-vLLM VRAM | Net KV Memory Avoided |
|---|---|---|---|
| 8K | 3.2 GB | 1.1 GB | 65.6% |
| 16K | 6.8 GB (OOM โ) | 1.6 GB | 76.4% (Passed โ ) |
| 32K | 13.6 GB (OOM โ) | 2.5 GB | 81.6% (Passed โ ) |
Latency & Throughput Impact
- Vectorized Attention (A100/H100): Async prefetching streams keep average dequantization overhead under 2.4% decode throughput impact.
- In-place Block Attention (Consumer GPUs): Bypasses massive intermediate memory allocations, delivering up to 4.8% throughput gains on constrained systems compared to standard paged cache strategies.
๐ก Real-World Case Study: Qwen2.5-1.5B-Instruct on a Laptop GPU (RTX 3050 Ti, 4GB VRAM)
Many developers try to run Qwen2.5-1.5B-Instruct on budget laptop cards (like an RTX 3050 Ti with 4GB VRAM).
- Vanilla vLLM / HuggingFace: The model weights themselves consume 3.0 GB, leaving a tiny 1.0 GB window for KV Cache and active activations. Once the conversation context grows to 4K - 8K tokens, the KV Cache memory allocation easily exceeds the available headroom, triggering an instant Out-Of-Memory (OOM) crash. This makes extended chatting nearly impossible.
- ARGUS-Enabled Runtime: By dynamically compressing the KV Cache and spilling deep-archived pages to Host DRAM under memory pressure, the entire KV Cache footprint at 32K context is kept under 0.8 GB!
- The Result: You get stable, seamless, long-context conversations on a 4GB Laptop GPU. ARGUS delivers 98.1% cache reuse efficiency (Attention Locality) and completely avoids the dreaded allocation OOMs.
๐บ Telemetry Showcase (Research Mode)
ARGUS acts like an Operating System for Transformers. When running in research mode, generation yields a real-time Virtual Memory Heatmap of VRAM resident (โ) and CPU swapped (โ) pages:
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ ARGUS TELEMETRY SUMMARY โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ KV Compression Ratio: 3.9x (Maximum Cold-Storage) โ
โ KV Memory Avoided: 74.4% โ
โ DRAM Bandwidth Saved: 74.4% โ
โ Pages Resurrected: 413 โ
โ CPU Spill Events: 0 โ
โ Transient Reconstructions: 413 โ
โ Average Dequant Latency: 0.189ms โ
โ Dequant Latency P50: 0.180ms | P95: 0.293ms | P99: 0.582ms โ
โ Decode Throughput Impact: -4.80% โ
โ Attention Locality Hit Rate: 78.2% โ
โ Average Page Lifetime: 18.2 steps โ
โ Average Resurrection Depth: 5.6 tiers โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ COMPRESSION CASCADE COUNTS โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ FP16โFP8: 652 | FP8โINT8: 650 | INT8โINT4: 649 โ
โ INT4โINT2: 648 | INT2โ1BIT: 646 | 1BITโJL: 643 โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ PAGE TIER DISTRIBUTION โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ FP16 (Active) [โ ] 1 pages โ
โ FP8 [โ ] 1 pages โ
โ INT8 [โ ] 1 pages โ
โ INT4 [โ ] 1 pages โ
โ INT2 [โ ] 1 pages โ
โ 1-Bit [โ ] 1 pages โ
โ JL (Archive) [โโโโโโโโโโโโโโโโโโโโ] 287 pages โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ VIRTUAL MEMORY HEATMAP โ
โ (โ = VRAM Resident, โ = CPU Swapped Out) โ
โ โ
โ Hot Pages (FP16/FP8): 2 pages โ
โ Warm Pages (INT8/INT4): 2 pages โ
โ Cold Pages (INT2+): 289 pages โ
โ CPU Spilled (Host RAM): 0 pages โ
โ โ
โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ
โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ
โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
๐จ Heatmap & Telemetry Legend
Attention Locality Hit Rate: Fraction of resurrected pages reused by subsequent attention windows (distinguishes temporal access locality from standard static cache hit rates).Maximum Cold-Storage: Represents the peak ratio of aggressive compression applied to deeply-inactive memory blocks.- Virtual Memory Tiers (VRAM / CPU DRAM):
โ FP16 (Active): Cyan (Highly active, recent attention anchors)โ FP8 (Warm): Light Green (Gentle precision quantization)โ INT8 (Compressed): Dark Green (Medium fidelity)โ INT4 (Compressed): Yellow (Heavy 2-way bit-packed compression)โ INT2 (Compressed): Magenta (Super heavy 4-way bit-packed compression)โ 1-Bit (Compressed): Red (8-way sign-packed with FP16 outlier preservation)โ JL (Archive): Blue (Johnson-Lindenstrauss deep orthogonal sequence projection)โ CPU Spill: Shaded blocks (Swapped out to Host RAM under VRAM pressure)
โก Quickstart
Get up and running in under 30 seconds.
1. Install via PyPI
pip install argus-cache
2. Plug-and-Play HuggingFace Patching
Patch any HuggingFace Causal LM (e.g. LLaMA-3, Mistral, Qwen) in a single line of code:
import torch
from transformers import AutoModelForCausalLM, AutoTokenizer
from argus_cache import patch_model_with_argus
model_id = "meta-llama/Meta-Llama-3-8B-Instruct"
tokenizer = AutoTokenizer.from_pretrained(model_id)
model = AutoModelForCausalLM.from_pretrained(model_id, torch_dtype=torch.float16, device_map="auto")
# Patch the model with ARGUS KV Memory Manager
model = patch_model_with_argus(
model,
page_size=2048, # Page block length
max_active_pages=2, # Active FP16 pages in transient pool
max_fp8_pages=2, # Warm FP8 pages
sink_tokens=4 # Keep initial attention sinks permanently in FP16
)
# Start generating with massive VRAM avoidance!
inputs = tokenizer("ARGUS is a hierarchical", return_tensors="pt").to("cuda")
outputs = model.generate(**inputs, max_new_tokens=128, use_cache=True)
print(tokenizer.decode(outputs[0], skip_special_tokens=True))
๐บ๏ธ Supported Features
| Feature | Status |
|---|---|
| vLLM | โ |
| HuggingFace | โ |
| llama.cpp | ๐ง |
| Predictive Paging | ๐งช Experimental |
| CPU Spill | โ |
โ ๏ธ Limitations & Realities
ARGUS is an active research project. Please note the following constraints:
- Experimental Status: ARGUS is in an active research and experimental phase. The codebase is under rapid development.
- Lossy Archival Tiers: Aggressive cold-storage tiers (such as 1-Bit quantization and Johnson-Lindenstrauss orthogonal sequence projection) are lossy and may reduce tensor fidelity, although designed to minimize semantic impact.
- Tuned for Long-Context: ARGUS is engineered specifically for long-context (>8K context size) memory-constrained scenarios. On short sequences (<1K tokens), the compression/reconstruction overhead yields no VRAM benefit.
- Predictor Not Production-Ready: The predictive attention paging module is currently highly experimental and not ready for stable deployment.
๐ฌ Research & Vision
ARGUS aims to pave the way toward Memory-Intelligent Transformer Runtimes. Our ongoing core research directions include:
- Transformer Virtual Memory Space: Decoupling the absolute physical VRAM limitation from LLM context capacity.
- Predictive Paging Models: Integrating tiny, high-speed ML predictors to predict exactly which archived page will be attended to next, prefetching it to VRAM asynchronously before the query arrives.
- Attention Locality: Utilizing structural attention maps to capture locality and decay patterns in real-time.
- Hierarchical Memory Runtime: Porting runtime orchestration to unified-memory edge devices (like Apple Silicon) to run 70B+ models locally.
๐ License
ARGUS is licensed under the Apache 2.0 License.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file argus_cache-0.1.6.tar.gz.
File metadata
- Download URL: argus_cache-0.1.6.tar.gz
- Upload date:
- Size: 48.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9c435292719e5125d5587fb9a026b296b310ae7374cdd87e8e146f80f40b966d
|
|
| MD5 |
db4d76c408014ce80937d183150192e9
|
|
| BLAKE2b-256 |
717bb78b40a0fbe41c62502db381b1d675889d98ba8dcf1b21aafb9e813db31e
|
File details
Details for the file argus_cache-0.1.6-py3-none-any.whl.
File metadata
- Download URL: argus_cache-0.1.6-py3-none-any.whl
- Upload date:
- Size: 35.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
60181d55a2c8530efb1eed61ca012baf637b88b6872dd0012e7b555f895f8b80
|
|
| MD5 |
2da34b9ac7c7bef61f0fe3b20e17f98e
|
|
| BLAKE2b-256 |
6230cc7a07f13e801ba861386ce3ac96897be4b2c7c8ae96d745de8626719653
|