TL;DR
Loki is the first model-serving system that treats ML inference pipelines as a first-class citizen by combining hardware scaling (adjusting server counts) with accuracy scaling (using faster, less precise model variants). By accounting for the complex inter-dependencies between models in a pipeline, Loki increases effective cluster capacity by over 2.7× and reduces latency violations by up to 10× compared to existing state-of-the-art systems.
What Problem Does This Paper Address?
Modern AI applications rarely rely on a single model; instead, they use inference pipelines—sequences of models working together (e.g., an object detector finding a car, followed by a classifier identifying its make).
When user demand spikes, traditional systems usually try hardware scaling: adding more servers. However, hardware is expensive and often limited in edge or private cloud environments. An alternative is accuracy scaling, which swaps high-fidelity models for "variants" that are faster but less accurate to keep up with traffic.
The challenge is that existing accuracy scaling methods are "pipeline-agnostic." They treat every model in a chain as an independent unit, ignoring how a change in one stage affects the throughput, accuracy, and workload of the next. This leads to "bottleneck" stages and frequent Service Level Objective (SLO) violations where queries miss their deadlines.
Methods
Loki introduces a two-pronged approach to manage resources and query traffic:
- MILP-based Resource Allocation: Loki uses a Mixed-Integer Linear Programming (MILP) framework to periodically decide which model variants to host, how many replicas to create, and what the maximum batch sizes should be. It operates in two phases:
- Hardware Scaling Phase: When demand is low, it minimizes the number of active servers while maintaining maximum accuracy.
- Accuracy Scaling Phase: When demand exceeds the cluster's physical capacity, it strategically lowers the accuracy of specific pipeline stages to maximize the overall system accuracy while meeting latency deadlines.
- MostAccurateFirst Routing: A greedy real-time algorithm that routes incoming queries through the highest-accuracy model variants available that still have capacity.
- Opportunistic Rerouting: This is Loki's "secret sauce" for handling unexpected delays. If a query falls behind its latency budget at an early stage of the pipeline, Loki doesn't just drop it. Instead, it tries to find a "faster" (lower accuracy) path for the remaining stages to help the query "catch up" and meet its end-to-end deadline.
Datasets
The authors evaluated Loki using two representative pipeline scenarios:
- Traffic Analysis: Uses a Microsoft Azure functions trace for query arrival patterns and the Bellevue traffic dataset for image content. The pipeline includes YOLOv5 (detection), EfficientNet (car classification), and VGG (facial recognition).
- Social Media: Uses a Twitter trace for arrivals and the MS-COCO captions dataset for content. The pipeline uses ResNet (classification) and CLIP-ViT (image captioning).
- Hardware: Evaluation was performed on a cluster of 20 NVIDIA GTX 1080 Ti GPUs.
Key Insights and Ideas
- Pipeline Awareness Matters: Loki recognizes that decreasing accuracy in the second task of a pipeline often causes a smaller end-to-end accuracy drop than decreasing it in the first task. By being "pipeline-aware," Loki makes smarter trade-offs.
- Workload Multiplication: Loki accounts for the fact that a more accurate detector might find 10 objects instead of 5, effectively decupling the workload for the subsequent classification stage.
- Integrated Scaling: By unifying hardware and accuracy scaling into one framework, Loki can save power/money during quiet hours (by shutting down servers) and survive massive traffic surges that would crash traditional systems.
- The "Catch-Up" Strategy: The concept of Opportunistic Rerouting acknowledges that latency is dynamic. Trading a bit of accuracy mid-stream to save a query from being dropped entirely is a significant win for user experience.
Key Results
- Throughput Boost: Loki supports up to 2.7× more throughput than hardware scaling alone before accuracy begins to drop significantly.
- SLO Reliability: Compared to Proteus (a pipeline-agnostic system), Loki achieved a 10× reduction in SLO violations.
- Resource Efficiency: During off-peak periods, Loki used 2.7× fewer servers than systems that do not perform hardware scaling, significantly reducing operational costs.
- Minimal Accuracy Loss: Loki can handle massive demand spikes by sacrificing only ~10-13% accuracy, whereas other systems would simply fail to return any result for a large portion of queries.
Limitations and Future Work
- Topology Constraints: Loki currently supports pipelines structured as "directed rooted trees." It does not yet support general Directed Acyclic Graphs (DAGs) where a single model might require inputs from multiple preceding models simultaneously.
- Network Assumptions: The system assumes homogeneous communication latency between servers in the cluster. In highly geo-distributed or heterogeneous environments, this assumption might need to be relaxed.
- LLM Specifics: While applicable to general ML, the paper notes that Large Language Models (LLMs) often require specific partitioning and serving optimizations that Loki does not currently focus on.
Summary updated