Serverless Model Serving for Data Science

Yuncheng Wu, Tien Tuan Anh Dinh, Guoyu Hu, Meihui Zhang, Yeow Meng Chee, Beng Chin Ooi · DOI

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.

Evolution of the Data Science Pipeline

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.

Serverless Model Serving Architecture

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

Abstract

Machine learning (ML) is an important part of modern data science applications. Data scientists today have to manage the end-to-end ML life cycle that includes both model training and model serving, the latter of which is essential, as it makes their works available to end-users. Systems of model serving require high performance, low cost, and ease of management. Cloud providers are already offering model serving choices, including managed services and self-rented servers. Recently, serverless computing, whose advantages include high elasticity and a fine-grained cost model, brings another option for model serving. Our goal in this paper is to examine the viability of serverless as a mainstream model serving platform. To this end, we first conduct a comprehensive evaluation of the performance and cost of serverless against other model serving systems on Amazon Web Service and Google Cloud Platform. We find that serverless outperforms many cloud-based alternatives. Further, there are settings under which it even achieves better performance than GPU-based systems. Next, we present the design space of serverless model serving, which comprises multiple dimensions, including cloud platforms, serving runtimes, and other function-specific parameters. For each dimension, we analyze the impact of different choices and provide suggestions for data scientists to better utilize serverless model serving. Finally, we discuss challenges and opportunities in building a more practical serverless model serving system.
BibTeX
@inproceedings{wu2022serverless,
  author = {Yuncheng Wu and Tien Tuan Anh Dinh and Guoyu Hu and Meihui Zhang and Yeow Meng Chee and Beng Chin Ooi},
  title = {{Serverless Model Serving for Data Science}},
  booktitle = {SIGMOD},
  year = {2022},
  doi = {10.1145/3514221.3517905},
}
Figure