Monarch v3: NES-Inspired KV Paging for 78% Faster LLM Inference

What Monarch v3 Does
Monarch v3 is an open-source implementation of NES-inspired memory paging for transformer inference that addresses the linear growth of KV cache with sequence length. By 4K tokens, most KV cache sits unused while consuming VRAM at full precision.
How It Works
The system splits KV cache into two regions:
- Hot region: Recent tokens kept at full precision
- Cold region: Older tokens compressed to ~20 bytes each (vs 64-128 bytes hot)
Four components work together:
- TurboQuant Compression: Quantizes KV to 4-bit integers with polar encoding and residual correction, achieving ~97% size reduction with ~0.3% perplexity loss
- Sliding Window Eviction: Recent N tokens stay hot by default, old tokens compress to cold storage
- Attention-Weighted Promotion: High-attention tokens move back to hot with sticky mechanism to prevent thrashing
- Page Swaps: Small batches of cold tokens materialize on access with local decode loop replacing batch matmul
Benchmark Results
Setup: TinyLlama-1.1B fp16, 50 generated tokens
- Standard: 17.01 tok/s, 2112 MB VRAM
- Monarch-v3: 30.42 tok/s, 2131 MB VRAM, 512 hot tokens, 1024 cold tokens
- Gain: +78.7% throughput, +0.9% VRAM
Simplified Decode Loop
for step in 1..100:
q = project_query(next_token)
# Compute attention: hot only (fast)
scores_hot = q @ kv_hot.T
# Access cold if high attention (rare)
if max(scores_hot) < threshold:
kv_cold_promoted = decompress(cold_pages)
scores_cold = q @ kv_cold_promoted.T
# Move to hot for next step
# Aggregate, softmax, apply attn ...
# Evict old tokens from hot → cold
if len(kv_hot) > window_size:
evict_oldest_to_cold()Current Status
- Implementation: Working on Hugging Face Transformers with custom cache backend
- License: Apache 2.0
- Paper: Full technical spec available
- Next: CUDA kernel fusion for cold decompression planned
How to Try It
git clone https://github.com/JohannaWeb/Monarch.git
cd Monarch
pip install -r requirements.txt
python train_tinyllama_fp16.py
python src/benchmark_monarch.py \
--model models/tinyllama_fp16 \
--mode both \
--max-new-tokens 100 \
--promotion-threshold 0.15 \
--sticky-threshold 3 \
--jsonLimitations
The approach relies on recency (recent tokens = high attention), which works for most tasks but may not for retrieval-heavy workloads. Attention extraction is available in base models but not chat variants; fallback uses window-only paging.
📖 Read the full source: r/LocalLLaMA
👀 See Also

울프람 테크, 이제 LLM 시스템의 기반 도구로 이용 가능
스티븐 울프램은 울프램 언어가 이제 LLM 시스템을 위한 기반 도구로 이용 가능하다고 발표하며, LLM 능력을 보완할 심층적인 계산과 정확한 지식을 제공한다고 밝혔습니다. 이 발표는 2023년 3월 최초의 ChatGPT용 울프램 플러그인이 출시된 이후 3년간의 개발을 거친 것입니다.

OpenClaw 공유 메모리 플러그인: SQLite 기반 다중 에이전트 조정
한 개발자가 OpenClaw 다중 에이전트 설정을 위한 플러그인을 개발하여, 에이전트들이 SQLite를 사용해 메모리를 공유할 수 있도록 하여 외부 서비스 필요성을 제거했습니다. 이 플러그인은 도구를 통한 명시적 메모리 공유, 자동 컨텍스트 추출, 접근 제어, 엔티티 추적, 모순 감지 기능을 제공합니다.

슬레이트: 내장 브라우저가 탑재된 오픈소스 macOS AI 채팅 앱
Slate는 단일 창에서 AI 채팅과 웹 브라우징을 결합한 네이티브 macOS 앱으로, Anthropic, OpenAI, Gemini 및 Ollama 모델을 지원합니다. SwiftUI와 WebKit으로 구축되어 리소스 사용량이 적으며 MIT 라이선스로 제공됩니다.

넷플릭스, 허깅 페이스에 비디오 객체 및 상호작용 삭제 모델 'VOID' 공개
Netflix는 VOID를 공개했는데, 이는 비디오에서 객체와 함께 떨어지는 물체나 이동된 아이템을 포함한 모든 물리적 상호작용을 제거하는 비디오 인페인팅 모델입니다. 이 모델은 40GB 이상의 VRAM이 탑재된 GPU가 필요하며, 서로 다른 정제 수준을 위한 두 개의 체크포인트 파일과 함께 쿼드마스크 조건화를 사용합니다.