Skip to content

feat: add standalone KVCache model ranking page#18

Open
stmatengss wants to merge 8 commits into
mainfrom
feat/standalone-ranking
Open

feat: add standalone KVCache model ranking page#18
stmatengss wants to merge 8 commits into
mainfrom
feat/standalone-ranking

Conversation

@stmatengss

Copy link
Copy Markdown
Collaborator

Summary

  • Adds a new standalone website/ranking.html page focused solely on comparing model KV cache requirements
  • Independent implementation (no shared code with calculator.html)
  • Dark theme matching existing dashboard design

Features

Sequence Length Presets:

  • Quick-select buttons: 1K, 4K, 8K, 16K, 32K, 128K tokens

Sortable Table Columns:

  • Model name and family
  • Architecture: KV layers, KV heads, head dimension
  • Deployment: tensor parallel (TP) and pipeline parallel (PP) sizes
  • Weight memory: parameter count and weight memory in GB
  • KV cache metrics: per-token, per-token/rank, total, total/rank

Models Included:

  • Qwen3-27B (hybrid attention)
  • Llama 3.1 70B and 8B
  • Qwen2.5-72B
  • Mistral 7B
  • DeepSeek-V3-671B (MoE)

Use Case

Quick reference/lookup tool for comparing KV cache size requirements across popular LLM models at different sequence lengths.

Test Plan

  • Open website/ranking.html directly in browser
  • Click preset buttons to change sequence length (1K, 4K, 8K, 16K, 32K, 128K)
  • Verify table updates with correct KV cache calculations
  • Click column headers to sort (verify ascending/descending toggle)
  • Check all 6 models display with correct architecture and deployment info
  • Verify per-rank calculations respect TP/PP configuration

Implementation Notes

  • Self-contained HTML file with inline CSS and JavaScript
  • No external dependencies or build step required
  • Matches existing dark theme from index.html and calculator.html
  • Mobile-responsive layout

🤖 Generated with Claude Code

stmatengss and others added 8 commits June 9, 2026 22:34
Add per-turn analysis methods to Python MultiAgentHeuristicConfig class
(per_turn_reusable_private_tokens, per_turn_content_hit_rates,
per_turn_working_set_tokens) and equivalent JS methods on the web
calculator's MultiAgentHeuristic class.

Include a new "Per-Turn Analysis" Chart.js bar+line chart showing how
cache hit rate and reusable private tokens evolve across conversation
turns. Add test vectors and parity checks (232 total, up from 178).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Adds an interactive model ranking table that compares all preset models
by their KV cache size requirements for a configurable sequence length.

Features:
- Extracted model registry (MODELS) as single source of truth
- Ranking table with sortable columns (KV/Token, KV/Token/Rank, Total KV)
- Configurable sequence length input (default: 8192 tokens)
- Highlights currently selected model in the ranking table
- Auto-updates when preset or sequence length changes

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Implements the rank-models subcommand for comparing models by KV cache
size requirements. Supports multiple sequence lengths and outputs in
markdown or CSV format.

Usage:
  kvcache-upper-bound rank-models --sequence-length 8192
  kvcache-upper-bound rank-models --sequence-length 4096 --sequence-length 32768 --format csv
  kvcache-upper-bound rank-models --sequence-length 8192 --output ranking.md

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Independent HTML page focused solely on model ranking
- Dark theme matching existing dashboard
- Preset buttons for sequence lengths (1K-128K tokens)
- Sortable table with architecture, deployment, and memory metrics
- Shows per-token and total KV cache sizes with per-rank breakdown
- Includes 6 preset models (Qwen3-27B, Llama3.1-70B/8B, Qwen2.5-72B, Mistral-7B, DeepSeek-V3-671B)
- Remove hardcoded tp_size/pp_size from model definitions
- Add input fields for TP and PP parallelism settings (default: 1)
- Table updates automatically when TP/PP values change
- All models now share the same parallelism configuration
- Added all models from kvcache.ai/tools/kv-cache-size-calculator/
- New families: DeepSeek V4, GLM-5, Kimi K2.5/2.6, Qwen3.5/3.6, Gemma 4, Cohere, MiMo, MiniMax
- Added family filter dropdown for easier navigation
- Models with unknown parameter count show "N/A" for weight columns
- MLA models use kv_lora_rank as effective head_dim with n_kv_heads=1

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Replaced all 41 parameter_count: null values with concrete numbers from
model names and HuggingFace configs:
- DeepSeek V4 Pro/Flash: 671B, V3.2: 685B
- GLM-5/5.1/5.2: ~756B (estimated)
- Kimi K2.5/K2.6: ~1T (estimated)
- Qwen3.6: 27B, 35B-A3B
- Qwen3.5: 397B, 122B, 35B, 27B, 9B, 4B, 2B, 0.8B
- Qwen3: 32B, 14B, 8B, 4B, 1.7B, 0.6B
- Qwen2.5: 32B, 14B, Coder-32B
- Gemma 4: E2B(2B), E4B(4B), 26B-A4B, 31B
- Cohere: Command R(35B), R+(104B), R7B(7B), A(111B), A+(111B)
- MiMo: V2.5(7B), V2.5-Pro(14B) (estimated)
- MiniMax: M2/M2.1/M2.5/M2.7 (~230B MoE each)
Critical fixes from code review:

1. MLA n_kv_heads consistency (16x KV overestimate):
   - Fixed calculator.html: DeepSeek V2/V3/V3.1, Kimi K2 from 16 → 1
   - Fixed CLI main.py: DeepSeek V3 from 16 → 1
   - Fixed ranking.html: DeepSeek V2/V3.1, Kimi K2 from 16 → 1
   - MLA stores compressed latent (kv_lora_rank=512), not decompressed
     heads. n_kv_heads=1, head_dim=512 correctly models the KV size.

2. Hybrid model kv_cache_layer_count (up to 12x overestimate):
   - Set kv_cache_layer_count for 10 Qwen3.5/3.6 hybrid-linear models
   - Linear attention layers use recurrent state, NOT KV cache
   - Only full-attention layers count toward KV cache size
   - Sliding-window layers (Gemma 4, Cohere, MiMo) DO store KV cache,
     so those correctly remain kv_cache_layer_count=null (all layers)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant