Get Started
Topic · 168 recaps

Inference Optimization

Techniques that make trained models faster and cheaper to serve: quantization, speculative decoding, KV-cache tricks, kernel fusion, batching, and architectural choices for low-latency generation.
OverviewPostsQuestions
Home
Topics
Search
Library
Inference optimization: spend memory, bandwidth, and compute where generation needs themInference cost is not one bottleneck. Prefilling a long prompt can make attention computation quadratic in context length; during generation, stored attention keys and values—the KV cache—consume memory and increase traffic per token. Hybrid attention–recurrent models add persistent state, while quantized execution can change speed, capacity, accuracy, and reproducibility in different ways.The readings organize choices by mechanism: retain the right history, avoid reading or re-encoding unnecessary context, and assign numerical precision to the phase and state that need it. Measure time to first token, decode latency, concurrency, memory, quality, and output stability separately. Results from different models, serving stacks, phases, and workloads do not form a single ranking.Begin with CONF-KV for a mechanism-first account of adaptive cache budgets. It explains how next-token confidence can control capacity, separates budget scheduling from victim selection, and shows why a compact policy can still be difficult to integrate with paged production serving.
CONF-KV: Confidence-Aware KV Cache Eviction with Mixed-Precision Storage for Long-Horizon LLMStart here for a mechanism-first explanation of confidence-gated KV budgets, attention-and-recency ranking, protected recent tokens, and mixed-precision storage. Its matched-rate ablation separates adaptive scheduling from token selection.Results cover four model families, generation to 4K tokens, retrieval to 32K, and 75 VisualWebArena tasks; paged-serving integration remains non-trivial.Read or listen · 6 min audio
What are you trying to solve?
Choose what the KV cache keepsAutoregressive attention stores keys and values for prior tokens, so long outputs can exhaust memory. Retention policies make different bets about future utility: confidence can expand capacity at difficult steps, threshold-free allocation can adapt across mixed requests, beacon queries can represent distant plans likely to be revisited, and prompt-protected random eviction can exploit redundancy in reasoning traces.
CONF-KV: Confidence-Aware KV Cache Eviction with Mixed-Precision Storage for Long-Horizon LLMStart here for a mechanism-first explanation of confidence-gated KV budgets, attention-and-recency ranking, protected recent tokens, and mixed-precision storage. Its matched-rate ablation separates adaptive scheduling from token selection.Results cover four model families, generation to 4K tokens, retrieval to 32K, and 75 VisualWebArena tasks; paged-serving integration remains non-trivial.Read or listen · 6 min audio
ReFreeKV: Towards Threshold-Free KV Cache CompressionUseful when cache policies must handle open-domain variation without a separately selected budget threshold for each input class. It introduces the threshold-free objective and reports evaluation across 13 datasets.The abstract does not expose the allocation algorithm or operational tuning details.
BeaconKV: Key-Value Cache Compression Guided by Beacon Queries for Efficient Large Reasoning Model InferenceExplains why recent queries can miss distant information revisited during long reasoning, then proposes beacon queries as compact representatives of recurring query clusters.Evaluated on four open-source large reasoning models and reasoning benchmarks.
Random Attention: Rethinking KV Cache Eviction for Efficient ReasoningProvides a low-overhead baseline that protects the prompt but randomly evicts reasoning tokens per head, testing whether a learned or computed importance score is necessary.Evidence covers four models, six reasoning tasks, and vLLM comparisons; prompt fragility and trace redundancy may differ elsewhere.
When should an adaptive cache retain more history?CONF-KV expands its budget when the next-token distribution signals uncertainty, then ranks retained tokens using attention history and recency while protecting a recent window. BeaconKV addresses a different failure mode in long reasoning: queries may revisit distant plans, so representatives of recurring query clusters guide retention.CONF-KV: Confidence-Aware KV Cache Eviction with Mixed-Precision Storage for Long-Horizon LLMBeaconKV: Key-Value Cache Compression Guided by Beacon Queries for Efficient Large Reasoning Model Inference
What if one cache threshold fails across domains, lengths, and difficulty levels?ReFreeKV frames input-specific threshold selection as the problem and proposes adaptive, threshold-free budget allocation. Read it when request classes are hard to separate in advance. Its abstract reports evaluation across 13 datasets but does not expose the allocation algorithm or operational tuning details.ReFreeKV: Towards Threshold-Free KV Cache Compression
Is sophisticated token scoring always worth its serving overhead?Random Attention protects the prompt and randomly evicts generated reasoning tokens independently per head. Across four models and six reasoning tasks, it matched the strongest compared evictor while improving vLLM throughput. Use it as a baseline where reasoning traces and attention heads may contain enough redundancy to survive score-free selection.Random Attention: Rethinking KV Cache Eviction for Efficient Reasoning
Reduce context reads—or change the representationEviction reduces decode-time cache capacity, but other costs remain. CRISP sparsifies prompt prefilling by routing attention patterns while avoiding background-noise accumulation. Declarative Attention lets a model name the context region needed during generation so the engine can skip other cache entries. LatentPress learns compact continuous tokens for repeated machine consumption of documents or conversations.
CRISP: Cliff-awaRe Input-adaptive Sparse Prefilling with Structural-Mass-Motivated RoutingSeparates prompt-prefill optimization from decode-time cache pruning. Its structural routing proxy and sink-aware threshold target adaptive sparse attention without accumulating long-context background noise.Evaluated on InfiniteBench, RULER, and LongBench across two model families, with attention speed measured at contexts up to 512K.
Language Models Can Control Their Own AttentionShows an alternative to scoring every cached token: have the model declare global, focused, or local attention regions so the serving engine can avoid reading irrelevant KV entries.Zero-shot tests used Gemma-4-31B and Qwen-3.6-27B on 15 long-context tasks.
LatentPress: Context Compression Beyond Text and VisionUseful for repeated document or conversation consumption: it replaces readable summaries with compact continuous memory tokens consumed directly by a frozen decoder.Tested on LongMemEval and LongBench-QA; the writer is reader-matched, and 16× compression reduced LongBench-QA quality.
How can sparse attention adapt to each long prompt without costly routing?CRISP reads routing decisions from the structure of a proxy attention map, then uses a sink-aware threshold rather than a cumulative mass target that can collect background noise as context grows. Read it when prompt prefilling, rather than autoregressive cache traffic, dominates long-context latency.CRISP: Cliff-awaRe Input-adaptive Sparse Prefilling with Structural-Mass-Motivated Routing
How can a model avoid scanning the entire cache for every generated token?Declarative Attention has the model declare global, focused, or local attention modes in its reasoning trace. The engine parses those declarations and skips irrelevant KV reads. It is relevant when repeated full-context reads dominate decoding and a measured accuracy tradeoff is acceptable.Language Models Can Control Their Own Attention
When is latent context compression preferable to text summarization?LatentPress trains a small, reader-matched writer to encode histories or documents into continuous tokens consumed through a frozen decoder’s embedding interface. It targets repeated machine consumption rather than human-readable reconstruction; in its tests, 4–8× compression was stronger than 16× on LongBench-QA.LatentPress: Context Compression Beyond Text and Vision
Quantize by phase and by serving statePrecision requirements differ across prompt processing, token generation, weights, KV entries, and persistent recurrent state. A format that accelerates compute-bound prefill may not suit bandwidth-bound decode. Hybrid models add recurrent state whose errors persist across updates, while prefix caches preserve hidden server state that can alter repeated trajectories.
Disaggregated Quantization: Specializing LLM Prefill and DecodeRead when prefill and decode have different bottlenecks. It specializes formats, weights, and placement by phase, including a separate prefiller that can be streamed from SSD for long prompts.Results span Qwen 3 and Gemma 3; the reported 1.78× time-to-first-token result used a 27B model, an 8K prompt, and llama.cpp.
Why Gated DeltaNet Survives 4-Bit Quantization: NVFP4 W4A4 for the Recurrent Half of a Hybrid 27B LLMConnects all-layer NVFP4 W4A4 quantization to Gated DeltaNet recurrence, calibrated KV scales, and compatibility between per-module calibration and fused serving kernels.Specific to a 27B Qwen3.8 hybrid, its calibration, NVFP4 kernels, and retrieval contexts tested to 64K.
STEPQuant: When and Where Errors Matter in Delta-Rule Recurrent State QuantizationRead when fixed-size recurrent state, rather than a growing KV cache, limits concurrent serving. It allocates precision using state-error magnitude and lifetime, with row- and column-aware scaling.Tested on Qwen3.8-27B and Kimi-Linear-48B-A3B-Instruct, with optimized SGLang kernels.
Same Request, Different Answer: Quantization Amplifies Cache-Induced Divergence in LLM ServingAdds a correctness dimension to optimization: controlled experiments show prefix-cache state changing agent trajectories, with greater divergence under four-bit weights in the tested workload.Measured on 80 serial, batch-one tool-use episodes across two engines and four weight formats.
Why use different quantization paths for prefill and decode?Disaggregated Quantization treats prefill as a low-precision arithmetic problem and decode as a weight-traffic problem. It reports that removing activation quantization only during decode improves decode-heavy accuracy without added inference cost, while separate compute-native prefill weights improve prompt processing. Offloaded prefill trades extra checkpoint storage and SSD streaming for faster time to first token on long prompts.Disaggregated Quantization: Specializing LLM Prefill and Decode
What exactly is being quantized in a hybrid attention–recurrent model?Minima quantizes every linear layer of a 27B Qwen3.8 hybrid to NVFP4 W4A4 and analyzes gate nonlinearities, recurrence noise, KV scales, and fused-kernel scale compatibility. STEPQuant addresses a different object: persistent Delta-rule state, allocating precision by error magnitude and memory lifetime with row- and column-aware scaling.Why Gated DeltaNet Survives 4-Bit Quantization: NVFP4 W4A4 for the Recurrent Half of a Hybrid 27B LLMSTEPQuant: When and Where Errors Matter in Delta-Rule Recurrent State Quantization
Why can the same cached request follow a different agent trajectory?Prefix-cache state is normally absent from the request. In an 80-episode serial tool-use workload, cache-enabled trajectories diverged more often at four-bit than at 16-bit, while recomputation was bit-identical in the tested configurations. Include cache state, cache-hit path, and reset policy in reproducibility controls for quantized agent serving.Same Request, Different Answer: Quantization Amplifies Cache-Induced Divergence in LLM Serving
Related topics
AI Agents
Small / On-device Models
Latest posts
Kronecker Delta Rule for Long Context Linear Attention
Inference Optimization · Added Oct 21
SpecMRL: Redesign Matryoshka Representation Learning within Parametric Spectrum
Inference Optimization · Added Oct 21
Pack Light, CarryOn: Building Object-Oriented Context for Long-Horizon Agents
Agents · Added Oct 20
Browse all posts