Lune

ICML2025Top-tier venue

Auto-reconfiguration for Latency Minimization in CPU-based DNN Serving

Ankit Bhardwaj, Amar Phanishayee, Deepak Narayanan, Ryan Stutsman

Abstract

In this paper, we investigate how to push the performance limits of serving Deep Neural Network (DNN) models on CPU-based servers. Specifically, we observe that while intra-operator parallelism across multiple threads effectively reduces inference latency, it provides diminishing returns. Our primary insight is that instead of running a single instance of a model with all available threads on a server, running multiple instances, each with smaller batch sizes and fewer threads for intra-op parallelism, can provide lower inference latency. However, the right configuration is difficult to determine manually since it is workload-dependent (DNN model and batch size used by the serving system) and deploymentdependent (number of CPU cores on a server). We present Packrat, a new serving system for online inference that given a model and batch size (B) algorithmically picks the optimal number of instances (i), the number of threads each should be allocated (t), and the batch sizes each should operate on (b) that minimizes latency. Packrat is built as an extension to TorchServe and supports online reconfigurations to avoid serving downtime. Averaged across a range of batch sizes, Packrat improves inference latency by 1.43× to 1.83× on a range of commonly used DNNs. Auto-reconfiguration for Latency Minimization in CPU-based DNN Serving stances each with smaller batch sizes and fewer threads for intra-op parallelism can provide lower inference latency. In the general case, determining the optimal configuration of ⟨instances, threads, batch⟩ (or ⟨i, t, b⟩ for short) is challenging because it is workload-and deployment-specific. The optimal configuration depends on the specific model being served, input dimensions like the batch size (which is itself dependent on the request arrival rate), and the hardware (e.g., number of cores, memory bandwidth, etc.). Furthermore, even if there were a hypothetical oracle that could provide the optimal ⟨i, t, b⟩ configuration, a user would still have to manually recognize when to change configurations and then reconfigure existing serving systems while specifying thread-core affinities appropriately. Packrat uses a novel algorithm to dynamically determine the optimal ⟨i, t, b⟩ configuration for models on individual servers given a batch of inputs for the model. It does this automatically using a small amount of targeted profiling; from this limited profiling information, it formulates ⟨i, t, b⟩ configurations that are expected to optimize average batch latency for different batch sizes by solving a 2-dimensional knapsack problem using dynamic programming. This lets Packrat quickly find configurations that balance intra-op latency with multi-instance execution without the need for user input and without impractically profiling all possible configuration combinations. Combined with its mechanism of transitioning between configurations, this lets Packrat dynamically reconfigure model instances and threads used for inference, entirely online, so as to optimize inference latency as workloads change. We evaluate Packrat on a single server running TorchServe. Over several models, we show that Packrat improves inference latency and throughput over the baseline approach that maximizes intra-op parallelism by 1.43× to 1.83× averaged over a range of batch sizes. Packrat code is open-source and can be accessed at https://github.com/msr-fiddle/packrat .

Ask Lune

Ask anything. The answer quotes the paper.

Lune reads all of it and the papers around it, then shows you the passages behind every answer.

Questions to start from

Lune answers from

the full paper · related work

Get the answer

Free to start. No credit card required.

Builds on2

  1. Batch: machine learning inference serving on serverless platforms with adaptive batchingAhsan Ali, Riccardo Pinciroli, Feng Yan, Evgenia SmirniSC 2020 · 184 citations
  2. Boosting the Throughput and Accelerator Utilization of Specialized CNN Inference Beyond Increasing Batch SizeJack Kosaian, Amar Phanishayee, Matthai Philipose, Debadeepta Dey et al.ICML 2021 · 20 citations

Related papers

  1. Harpagon: Minimizing DNN Serving Cost via Efficient Dispatching, Scheduling and SplittingZhixin Zhao, Yitao Hu, Ziqi Gong, Guotao Yang et al.INFOCOM 2025 · 2 citations
  2. DVABatch: Diversity-aware Multi-Entry Multi-Exit Batching for Efficient Processing of DNN Services on GPUsWeihao Cui, Han Zhao, Quan Chen, Hao Wei et al.USENIX ATC 2022 · 4 citations
  3. AlpaServe: Statistical Multiplexing with Model Parallelism for Deep Learning ServingZhuohan Li, Lianmin Zheng, Yinmin Zhong, Vincent Liu et al.OSDI 2023 · 211 citations
  4. SHEPHERD: Serving DNNs in the WildHong Zhang, Yupeng Tang, Anurag Khandelwal, Ion StoicaNSDI 2023 · 161 citations
  5. TurboTransformers: an efficient GPU serving system for transformer modelsJiarui Fang, Yang Yu, Chengduo Zhao, Jie ZhouPPoPP 2021 · 117 citations
Dusk over the sea between two cliffs drawn in fine vertical lines