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

✍️ OpenClawRadar📅 게시일: April 13, 2026🔗 Source
Monarch v3: NES-Inspired KV Paging for 78% Faster LLM Inference
Ad

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
Ad

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 \
    --json

Limitations

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

Ad

👀 See Also

Superglue CLI: 사전 구축된 도구 없이 AI 에이전트가 API 호출을 실행할 수 있게 합니다
Tools

Superglue CLI: 사전 구축된 도구 없이 AI 에이전트가 API 호출을 실행할 수 있게 합니다

Superglue CLI는 AI 코딩 에이전트에게 명령어 사용법, 인증 처리, 도구 구축, 실패 디버깅 방법을 가르치는 스킬을 제공합니다. 모든 API 통합을 위한 사전 제작된 도구를 만드는 대신, 에이전트는 런타임에 API 사양을 읽고 다단계 호출을 계획할 수 있습니다.

OpenClawRadar
Atelier v0.3는 Claude Code를 통한 타겟팅된 마크다운 수정 기능을 추가합니다.
Tools

Atelier v0.3는 Claude Code를 통한 타겟팅된 마크다운 수정 기능을 추가합니다.

Atelier v0.3은 VS Code의 무료 확장 프로그램으로, 마크다운 문서의 일부를 강조 표시하여 Claude Code에 수정을 요청할 수 있습니다. 에이전트는 에디터 내에서 타겟팅된 수정 사항을 응답하며, 각 수정이 어떤 피드백을 해결했는지 추적할 수 있습니다.

OpenClawRadar
Zap Code: 실제 HTML/CSS/JS를 아이들에게 가르치는 AI 코드 생성기
Tools

Zap Code: 실제 HTML/CSS/JS를 아이들에게 가르치는 AI 코드 생성기

Zap Code는 8-16세 어린이를 위해 일반 영어 설명으로 작동하는 HTML, CSS, JavaScript를 생성합니다. 세 가지 상호작용 모드를 제공하며 점진적 복잡성 엔진이 포함된 샌드박스 iframe에서 실행됩니다.

OpenClawRadar
OpenClaw와 Claude Cowork 비교: 로컬 자동화 대 샌드박스 워크플로우
Tools

OpenClaw와 Claude Cowork 비교: 로컬 자동화 대 샌드박스 워크플로우

OpenClaw는 셸 명령 실행과 브라우저 자동화 기능을 갖춘, 사용자의 기기에서 항상 실행되는 로컬 에이전트입니다. 반면 Claude Cowork는 Claude Desktop 내에서 문서 및 브라우저 작업에 중점을 둔 샌드박스 환경에서 작동합니다.

OpenClawRadar