The purpose of inference engineering is to make generative AI models faster, less expensive, and more reliable to operate, which in turn lets you build better products.
This promise is only fulfilled if your inference engineering work makes it to production and scales alongside the hypergrowth and viral spikes that successful AI products generate.
When you scale production traffic, your assumptions are rigorously tested. Everything from sequence shapes to traffic patterns to what topic a user decides to chat about impacts your observed performance in production. And maintaining secure, robust infrastructure is an entirely different skillset from optimizing model inference on the GPU.
No matter how fast and efficiently a single instance can serve a model, with enough traffic, the service will be overwhelmed. That is not a PyTorch problem or a CUDA problem, it’s an infrastructure problem, and requires a different mindset and different technologies.
Scaling in production introduces new complexities about where and how to get GPUs, balance traffic across them, and prevent downtime. Plus, cost accounting gets messy in the transition from paying per million tokens to paying directly for infrastructure.
Latency in production comes from more than just prefill and decode. You need to evaluate your system end-to-end and eliminate inefficiencies in the server, the network, and even the client in situations where you can own or influence client code.
This chapter introduces the essential considerations for scaling low-latency, high-throughput inference in production. And at the end, I’ll invite you to try Baseten for deploying mission-critical inference workloads.
- 7.1 Containerization: Packaging model servers so deployments are reproducible and start quickly.
- 7.2 Autoscaling: Scaling replicas to meet traffic and latency SLAs without paying for idle GPUs, including cold start mitigation.
- 7.3 Multi-Cloud Capacity Management: Treating capacity across regions and cloud providers as one elastic pool instead of isolated silos.
- 7.4 Testing and Deployment: End-to-end testing, canary and blue-green rollouts, and safe deploys for model servers.
- 7.5 Client Code: The application-side patterns for calling inference endpoints reliably.
- 7.6 Production Inference with Baseten: How the concepts in this book map onto Baseten's inference platform.
