Efficiency is paramount in the rapidly expanding landscape of Model-as-a-Service (MaaS). However, current serving strategies for Large Language Models (LLMs) often leave significant hardware resources untapped. Researchers from Shanghai Jiao Tong University have introduced Harli, a system designed to "double-book" GPU resources by co-locating LLM inference with parameter-efficient finetuning (PEFT) tasks. By leveraging a unified memory allocator and a two-stage latency predictor, Harli increases finetuning throughput by an average of 46.2% while strictly adhering to inference Service Level Objectives (SLOs).
The Efficiency Gap in LLM Serving
LLM interaction typically involves two distinct phases: prefill (processing the input prompt) and decode (generating the response token-by-token). To optimize performance, providers often disaggregate these phases across different GPU instances. While prefill is compute-intensive, the decode phase is notoriously "memory-bound." During decoding, the GPU spends a disproportionate amount of time moving data from memory to processors, leaving the actual compute units—Streaming Multiprocessors (SMs)—largely idle.
As shown in Figure 6, SM utilization frequently dips below 40% during decoding, especially at smaller batch sizes. Simultaneously, there is a surging demand for PEFT (such as LoRA), which allows for model customization. Unlike decoding, PEFT is "compute-bound" but "memory-efficient," as it only updates a small fraction of the model's weights. Harli identifies these two workloads as "perfect roommates," pairing them to saturate the GPU's capabilities.
Harli: System Architecture and Methodology
Harli safely co-locates these complementary workloads through three primary components: a unified memory allocator, a latency predictor, and a QoS-guaranteed scheduler.
1. Unified Memory Allocator
Inference systems typically pre-allocate a large "KV cache." Harli repurposes unused slots within this cache for finetuning tasks using virtual memory mapping. This allows finetuning tensors to reside in physical memory originally reserved for inference. A window-based swapping mechanism manages the movement of weights between GPU and CPU host memory as needed.
2. Two-Stage Latency Predictor
To prevent inference degradation, Harli must accurately predict interference. It first models "solo-run" decode latency based on batch size and sequence length. A linear regression model then predicts how the finetuning task's compute usage will impact that latency. Because PEFT tasks typically run with fixed batch sizes, their impact is remarkably predictable.
3. QoS-Guaranteed Scheduler
The scheduler evaluates the current load at the start of every decode step. If a Quality of Service (QoS) violation is predicted, it can pause the finetuning task or adjust SM partitioning (using tools like NVIDIA’s GreenContext) to prioritize inference requests.
Key Results and Insights
The researchers evaluated Harli using LLaMA3-8B and Qwen2.5-7B models on NVIDIA Ada6000 and A100 GPUs, utilizing real-world request traces from Microsoft.
- Throughput Gains: Harli improved finetuning throughput by an average of 46.2%, with peaks reaching 92.0% compared to baseline separate execution.
- Strict QoS Adherence: Harli consistently met the 40ms Time-Per-Output-Token (TPOT) target. By "harvesting" the slack in the decode phase, it maintained latency close to the threshold without exceeding it.
- Memory Efficiency: The unified allocator effectively managed memory even on the A100 (40GB), which has less capacity than the Ada6000 (48GB), by dynamically adjusting the finetuning "window" size.
Conclusion and Future Directions
Harli demonstrates that treating the KV cache as a dynamic, shared pool rather than a static block can unlock significant performance gains in MaaS environments. While the current implementation focuses on single-GPU co-location and PEFT workloads, future work may extend these principles to full-parameter finetuning and multi-GPU distributed training scenarios. By intelligently pairing memory-bound and compute-bound tasks, Harli provides a blueprint for more efficient and cost-effective LLM infrastructure.
Summary updated