Abstract
Model serving has become a critical bottleneck in modern data science pipelines, requiring a delicate balance between performance, cost, and management overhead. This paper evaluates the readiness of serverless computing as a primary platform for machine learning inference. Through a comprehensive benchmarking study across AWS and GCP, we compare serverless functions against managed ML services and dedicated GPU instances. Our results demonstrate that serverless platforms offer superior elasticity, outperforming traditional infrastructure in bursty, high-traffic scenarios while significantly reducing costs. We conclude that for many mainstream ML workloads, serverless computing is a high-performance and cost-effective solution for production model serving.
Introduction: The Model Serving Trilemma
In the contemporary data science lifecycle, the focus has expanded beyond data collection and cleaning to include the complex requirements of production-grade machine learning. The integration of ML introduces new stages such as feature engineering and model training, culminating in the critical phase of model serving.
Model serving—the process of hosting trained models to handle real-time user requests—presents a "trilemma" of requirements: high performance (low latency), low operational cost, and ease of management. Traditional solutions typically force a trade-off. Managed ML services like AWS SageMaker simplify management but are often expensive and slow to scale. Conversely, self-rented GPU or CPU instances offer high performance but require significant manual oversight and incur costs even when idle.
Benchmarking Methodology
The authors developed a comprehensive benchmarking framework to evaluate the "serverless question." The study compared eight systems across Amazon Web Services (AWS) and Google Cloud Platform (GCP), including AWS Lambda, GCP Cloud Functions, AWS SageMaker, and various EC2/GCE instances.
To simulate realistic, unpredictable traffic, the framework utilized a Markov-Modulated Poisson Process (MMPP) to generate bursty workloads. The evaluation focused on three deep learning models with varying resource footprints: MobileNet (16MB), VGG (51.5MB), and ALBERT (548MB). Furthermore, the impact of software optimization was assessed by comparing the standard TensorFlow (TF) runtime with the more efficient OnnxRuntime (ORT).
Key Insights and Results
Elasticity and Performance
The most significant finding is that under high, bursty workloads, serverless platforms can outperform dedicated GPU servers. While a GPU processes individual requests faster, it has a fixed capacity. During traffic spikes, requests queue up, causing latency to skyrocket. Serverless platforms mitigate this by rapidly spinning up hundreds of parallel instances to handle the surge. In a high-workload scenario, AWS Lambda achieved an average latency of 0.097s, whereas a GPU server for the same cost resulted in 7.52s latency—a 77.5× performance advantage.
Managed Services vs. Serverless
Managed ML services were found to struggle with rapid scaling. Platforms like SageMaker often take minutes to provision new instances, leading to high failure rates during sudden traffic spikes. In contrast, for a MobileNet model under low load, AWS Lambda was 71.6× faster and 8.56× cheaper than SageMaker.
Runtime and Memory Optimization
Switching from TensorFlow to OnnxRuntime (ORT) provided a "free lunch" in terms of efficiency, yielding up to a 3.61× latency speedup and a 4.55× cost reduction. Additionally, the study identified a "Memory Paradox": increasing memory allocation (e.g., from 2GB to 4GB for VGG) can actually reduce total costs by accelerating execution and reducing the frequency of cold starts.
Limitations and Future Directions
While serverless is a strong contender, several hurdles remain. Current platforms often over-provision instances during bursts, leading to some resource waste. Furthermore, the lack of support for Trusted Execution Environments (TEEs) on most serverless platforms complicates the serving of models that handle sensitive data. Finally, the complexity of configuring optimal memory and batch sizes suggests a need for automated navigation tools to assist data scientists.
Conclusion
Serverless computing is no longer a niche option for machine learning. For many mainstream applications, it provides a high-performance, cost-effective, and scalable alternative to traditional model serving infrastructure. As cloud providers continue to optimize cold start times and resource limits, serverless is poised to become the go-to platform for production-grade data science.
Summary updated