Skip to main content

04. Inference Optimization

KV cache, speculative decoding, batching, paged attention, serving infrastructure, and cost optimization.

📄️On-Device and Edge Deployment

Not every model has to run in someone else's cloud. Running LLMs locally, on a laptop, a workstation GPU, a phone, or an edge box, is a real deployment target in 2026, driven by privacy, offline operation, latency, and cost at steady volume. The catch is that the tool that makes local models easy to try (Ollama) is not the tool that serves them in production (vLLM), and the two get conflated constantly. This chapter sorts out the runtime stack, the prototype-to-production path, the hardware limits, and when local actually beats an API.