Machine Learning Model Serving
Machine learning model serving is the infrastructure and practice of deploying trained models so they can receive input data and return predictions in real time or in batch. It bridges the gap between a model that works in a notebook and one that runs reliably in production at scale.
itArtificial intelligence and machine learning | OpenSkills.info
Course pathWalk it in order
Look it upDip in anytime
Go furtherLeaves this page
Don't Panic
Don't Panic — Machine Learning Model Serving
Model serving is the machinery that lets an application ask a trained model for a prediction without wheeling a notebook into production and hoping nobody notices. The model artifact is loaded, an endpoint accepts input, inference runs, and a response returns. That is the corridor version. The longer version involves queues, versioning, and hardware that has opinions about being kept busy.
The useful picture is a request moving through a small obstacle course: parsing and preprocessing, model inference, then postprocessing and a response. Somewhere around it sit health checks, logs, metrics, replicas, and a load balancer. None are decorative. A prediction that arrives after its latency budget, or vanishes when one machine does, has achieved a kind of interpretive freedom that applications rarely appreciate.
The central bargain is batching. A GPU prefers several inputs in one forward pass, so a serving runtime may collect requests for a short time and process them together. This improves throughput, but every request spends some time waiting. Set a maximum batch size and a maximum wait time; otherwise the system can be wonderfully efficient at making a lonely request wait for company.
A model artifact is also not the whole deployment. The input format, preprocessing, output format, and model version all shape what clients receive. That is why a safe rollout keeps versions identifiable and sends only a small traffic slice to a candidate first. Canary, blue-green, and shadow deployments differ in routing, but they share the same modest ambition: discover a bad change before it owns all the traffic.
Large language models add a special nuisance. They generate tokens one at a time and retain a key-value cache, which is memory used to continue the sequence. The cache grows with the conversation, so LLM runtimes such as vLLM treat memory management and continuous batching as part of serving, not as an afterthought with a nicer logo.
Read the Intro for the full architecture and the four inference patterns. Use Slides when the latency, throughput, rollout, and scaling choices need a compact map. Keep the Cheatsheet nearby when comparing formats, runtimes, and metrics. Then try the Practice Reference and exercise: a tiny versioned endpoint makes the difference between a callable function and a service pleasantly, and usefully, difficult to ignore.
Where this skill leads
Relevant careers
See how this topic contributes to broader role-level skill maps.
Sources
- https://www.tensorflow.org/tfx/serving/architecture
Supports
- TensorFlow Serving is a flexible, high-performance serving system for machine learning models designed for production environments
- https://github.com/tensorflow/serving
Supports
- TensorFlow Serving provides versioned access to models via a high-performance, reference-counted lookup table
- https://docs.nvidia.com/deeplearning/triton-inference-server/user-guide/docs/
Supports
- NVIDIA Triton Inference Server supports TensorFlow, PyTorch, ONNX, TensorRT, and custom backends with dynamic batching
- https://docs.aws.amazon.com/sagemaker/latest/dg/deploy-model.html
Supports
- Amazon SageMaker provides a broad selection of ML infrastructure and model deployment options for real-time and batch inference
- https://cloud.google.com/vertex-ai/docs/general/deployment
Supports
- Vertex AI requires deploying a model to an endpoint before getting online predictions
- https://www.tensorflow.org/tfx/serving/serving_basic
Supports
- SavedModel format saves a snapshot of the trained model to reliable storage for later inference loading
- https://www.tensorflow.org/tfx/serving/architecture
Supports
- Dynamic batching groups multiple incoming requests into a single forward pass to maximize GPU utilization
- https://docs.vllm.ai/en/latest/
Supports
- vLLM uses PagedAttention for efficient KV cache memory management in LLM serving
- https://onnxruntime.ai/docs/
Supports
- ONNX Runtime is a cross-platform inference engine optimized for models exported to the ONNX format
- https://docs.nvidia.com/deeplearning/triton-inference-server/user-guide/docs/
Supports
- Quantization reduces numerical precision (e.g., FP32 to INT8) to decrease memory footprint and accelerate inference
- https://docs.aws.amazon.com/sagemaker/latest/dg/deploy-model.html
Supports
- Canary deployment routes a small fraction of traffic to a new model version while the old version handles the rest
- https://kserve.github.io/website/
Supports
- KServe provides Kubernetes-based serverless inference with autoscaling including scale-to-zero
- https://www.tensorflow.org/tfx/serving/architecture
Supports
- Model serving requires handling concurrent requests, meeting latency SLAs, managing versions, and integrating with software architecture
- https://opensource.googleblog.com/2015/11/tensorflow-googles-latest-machine.html
Supports
- TensorFlow was released as open source in November 2015
- https://developers.googleblog.com/tensorflow-serving-10/
Supports
- TensorFlow Serving was initially released as open source in February 2016
- https://azure.microsoft.com/en-us/blog/microsoft-and-facebook-create-open-ecosystem-for-ai-model-interoperability/
Supports
- Microsoft and Facebook announced ONNX in September 2017 for model interoperability
- https://engineering.fb.com/2017/12/08/ml-applications/onnx-v1-released/
Supports
- ONNX version 1 was declared production-ready in December 2017
- https://developer.nvidia.com/blog/?p=11803
Supports
- NVIDIA announced its open-source TensorRT Inference Server beta in September 2018
- https://aws.amazon.com/blogs/aws/announcing-torchserve-an-open-source-model-server-for-pytorch/
Supports
- AWS and PyTorch announced TorchServe in April 2020
- https://arxiv.org/abs/2309.06180
Supports
- The vLLM paper introduced PagedAttention for LLM serving in September 2023
- https://research.google/pubs/hidden-technical-debt-in-machine-learning-systems/
Supports
- Hidden technical debt in ML systems includes serving-system and data-dependency concerns
