KV Cache Math for Million Token Agent Runs
KV cache math explains why every decoded token reads the whole context, and what eviction and quantization can cut from million-token agent bills today.
Category
Technical deep dives into how AI systems are built and run: models, retrieval, agents, evaluation, fine-tuning, and infrastructure.
17 posts
KV cache math explains why every decoded token reads the whole context, and what eviction and quantization can cut from million-token agent bills today.
Public benchmarks say 89%, your warehouse says otherwise. Build a text-to-SQL evaluation with schema-specific oracles that catches silent wrong answers.
MoE serving cost for a 6-of-125B model is not 6B per token. All 125B stay in VRAM, so run the builder math on residency, routing, and break-even.
Speculative decoding turns idle CPU cores into 4x faster LLM generation. Learn why it works, when gains collapse, and when CPU beats GPU or API.
Gradient accumulation can make identical batches train at different speeds. Learn why micro-batch shape drives T4 vs L4 wall-clock time and throughput.
Agentic loop token costs come from context accumulation, tool bloat, and retries. Learn to map hidden API waste before downgrading your model.
Megakernels in LLM inference trade off launch overhead against SM occupancy. Learn when fused kernels beat CUDA graphs for low-latency agentic workloads.
Disaggregated GPU inference splits prefill and decode for higher throughput, but each request moves 2.6 GB of KV cache across the datacenter.
BM25 vs dense retrieval on a consumer GPU. Each baseline wins one RAG scenario and breaks another. Match your index to memory, latency, and failure mode.
AI agent cost per resolution, not eval accuracy, decides if your agent ships or dies. Token pricing hides the unit economics of retries and failures.
Learn when to self-host LLM inference instead of paying per token. Netflix's production stack reveals the real cost, latency, and control tradeoffs.
Should you orchestrate open source LLMs or call a single frontier model? We break down Sakana Fugu's claims and the real cost and latency tradeoffs.