By Sagar Shankaran, Founder of CallSphere
A technical guide to modern LLM inference optimization techniques — quantization, speculative decoding, KV-cache optimization, continuous batching, and PagedAttention. Make models faster and cheaper.
Key takeaways
Training a large language model is a one-time cost. Inference — serving predictions to users — is the ongoing expense that determines whether a model is economically viable in production. A model that costs $10 million to train but $0.001 per query can generate billions of responses profitably. The same model at $0.10 per query may be commercially unviable.
Inference optimization is the discipline of making models faster, cheaper, and more memory-efficient without sacrificing output quality. Here are the techniques that matter most in 2026.
Quantization reduces the numerical precision of model weights from 16-bit or 32-bit floating point to lower bit widths (8-bit, 4-bit, or even 2-bit integers).
Why it works: Most model weights cluster around small values. The difference between representing a weight as 0.0234375 (FP16) versus 0.023 (INT8) is negligible for output quality but halves memory usage.
Common quantization methods:
Hear it before you finish reading
Talk to a live CallSphere AI voice agent in your browser — 60 seconds, no signup.
| Method | Bits | Quality Loss | Speed Gain | Memory Reduction |
|---|---|---|---|---|
| FP16 (baseline) | 16 | None | 1x | 1x |
| INT8 (W8A8) | 8 | Minimal | 1.5-2x | 2x |
| GPTQ (W4A16) | 4 | Small | 2-3x | 4x |
| AWQ | 4 | Small | 2-3x | 4x |
| GGUF Q4_K_M | 4 | Small | 2-3x | 4x |
| QuIP# | 2 | Moderate | 4-5x | 8x |
Practical example: A 70B parameter model requires ~140GB in FP16, needing 2x A100 80GB GPUs. With 4-bit quantization, it fits on a single A100 or even a consumer RTX 4090 (24GB).
# Quantizing with llama.cpp
./quantize model-f16.gguf model-q4_k_m.gguf Q4_K_M
# Serving with vLLM and AWQ quantization
python -m vllm.entrypoints.openai.api_server \
--model TheBloke/Llama-3.3-70B-AWQ \
--quantization awq \
--tensor-parallel-size 1
LLM inference is bottlenecked by sequential token generation — each token requires a full forward pass. Speculative decoding breaks this bottleneck by using a small, fast "draft" model to generate candidate tokens, then verifying them in parallel with the large model.
flowchart TD
HUB(("Why Inference<br/>Optimization Matters"))
HUB --> L0["Quantization: Trading<br/>Precision for Speed"]
style L0 fill:#e0e7ff,stroke:#6366f1,color:#1e293b
HUB --> L1["Speculative Decoding: Draft<br/>and Verify"]
style L1 fill:#e0e7ff,stroke:#6366f1,color:#1e293b
HUB --> L2["KV-Cache Optimization"]
style L2 fill:#e0e7ff,stroke:#6366f1,color:#1e293b
HUB --> L3["PagedAttention and vLLM"]
style L3 fill:#e0e7ff,stroke:#6366f1,color:#1e293b
HUB --> L4["Continuous Batching"]
style L4 fill:#e0e7ff,stroke:#6366f1,color:#1e293b
HUB --> L5["Putting It All Together"]
style L5 fill:#e0e7ff,stroke:#6366f1,color:#1e293b
style HUB fill:#4f46e5,stroke:#4338ca,color:#fff
How it works:
Speedup: When the draft model's predictions match the target model (which happens 70-90% of the time for well-chosen pairs), you get K tokens for the cost of ~1 forward pass of the large model. Typical speedups: 2-3x for well-matched model pairs.
During autoregressive generation, the Key-Value cache stores computed attention states for all previous tokens. This cache grows linearly with sequence length and can consume more memory than the model weights for long contexts.
Techniques:
PagedAttention, the innovation behind vLLM, manages KV-cache memory the way operating systems manage virtual memory — in non-contiguous pages.
Still reading? Stop comparing — try CallSphere live.
CallSphere ships complete AI voice agents per industry — 14 tools for healthcare, 10 agents for real estate, 4 specialists for salons. See how it actually handles a call before you book a demo.
Problem solved: Traditional KV-cache allocation pre-allocates memory based on maximum sequence length, wasting memory for shorter sequences. With batch sizes of 100+ concurrent requests, this waste becomes the primary bottleneck.
How PagedAttention helps:
# vLLM automatically uses PagedAttention
from vllm import LLM, SamplingParams
llm = LLM(
model="meta-llama/Llama-3.3-70B-Instruct",
tensor_parallel_size=2,
max_model_len=32768,
gpu_memory_utilization=0.90
)
outputs = llm.generate(
prompts=["Explain quantum computing" for _ in range(100)],
sampling_params=SamplingParams(temperature=0.7, max_tokens=512)
)
Traditional static batching waits for a full batch before processing and waits for the longest sequence to finish before returning any results. Continuous batching (also called iteration-level batching) inserts new requests and returns completed requests at every generation step.
Impact: Reduces average latency by 50-80% under load and increases throughput by 2-3x compared to static batching. All modern serving frameworks (vLLM, TGI, TensorRT-LLM) implement continuous batching by default.
A production-optimized inference stack combines multiple techniques:
Request → Continuous Batching Engine
├── PagedAttention (memory efficiency)
├── Quantized Model (INT8/INT4)
├── GQA/MQA (reduced KV-cache)
├── Speculative Decoding (speed)
└── Prefix Caching (shared prompts)
The compound effect of these optimizations is dramatic: a well-optimized serving stack can serve 10-50x more requests per GPU compared to a naive implementation, reducing per-query costs proportionally.
Sources: vLLM — PagedAttention Paper, Hugging Face — Quantization Guide, DeepSpeed — Inference Optimization
flowchart LR
IN(["Input prompt"])
subgraph PRE["Pre processing"]
TOK["Tokenize"]
EMB["Embed"]
end
subgraph CORE["Model Core"]
ATTN["Self attention layers"]
MLP["Feed forward layers"]
end
subgraph POST["Post processing"]
SAMP["Sampling"]
DETOK["Detokenize"]
end
OUT(["Generated text"])
IN --> TOK --> EMB --> ATTN --> MLP --> SAMP --> DETOK --> OUT
style IN fill:#f1f5f9,stroke:#64748b,color:#0f172a
style CORE fill:#ede9fe,stroke:#7c3aed,color:#1e1b4b
style OUT fill:#059669,stroke:#047857,color:#fff
flowchart TD
HUB(("Why Inference<br/>Optimization Matters"))
HUB --> L0["Quantization: Trading<br/>Precision for Speed"]
style L0 fill:#e0e7ff,stroke:#6366f1,color:#1e293b
HUB --> L1["Speculative Decoding: Draft<br/>and Verify"]
style L1 fill:#e0e7ff,stroke:#6366f1,color:#1e293b
HUB --> L2["KV-Cache Optimization"]
style L2 fill:#e0e7ff,stroke:#6366f1,color:#1e293b
HUB --> L3["PagedAttention and vLLM"]
style L3 fill:#e0e7ff,stroke:#6366f1,color:#1e293b
HUB --> L4["Continuous Batching"]
style L4 fill:#e0e7ff,stroke:#6366f1,color:#1e293b
HUB --> L5["Putting It All Together"]
style L5 fill:#e0e7ff,stroke:#6366f1,color:#1e293b
style HUB fill:#4f46e5,stroke:#4338ca,color:#fff
Written by
Sagar Shankaran· Founder, CallSphere
Sagar Shankaran is the founder of CallSphere, where he builds production AI voice and chat agents deployed across healthcare, hospitality, real estate, and home services. He writes about agentic AI, LLM engineering, and shipping voice agents that handle real calls in production.
See how AI voice agents work for your industry. Live demo available -- no signup required.
Hotel voice conversations break at 2+ second latency. CallSphere's <1 second response time comes from OpenAI Realtime API and tightly engineered tool calls.
Architecture patterns for scaling AI voice agents to 1000+ concurrent calls — horizontal scaling, connection pooling, and queue management.
Hotel asset managers need clear performance metrics to justify technology investments. Here are the 12 KPIs every asset manager should track on AI voice agent deployments.
A technical breakdown of voice AI latency budgets — STT, LLM, TTS, network — and how to hit sub-second end-to-end response times.
Real MLOps and AI deployment interview questions from Google, Amazon, Meta, and Microsoft in 2026. Covers CI/CD for ML, model monitoring, quantization, continuous batching, serving infrastructure, and evaluation frameworks.
The key metrics for tracking AI voice agent success. FCR, AHT, CSAT, containment rate, and ROI measurement frameworks.
© 2026 CallSphere LLC. All rights reserved.
Made within New York