Online Scheduling for LLM Inference with KV Cache Constraints

Fuente: arXiv
Gespeichert in:
Bibliographische Detailangaben
Hauptverfasser: Jaillet, Patrick, Jiang, Jiashuo, Mellou, Konstantina, Molinaro, Marco, Podimata, Chara, Zhou, Zijie
Format: Preprint
Veröffentlicht: 2025
Schlagworte:
Online-Zugang:
Tags: Tag hinzufügen
Keine Tags, Fügen Sie den ersten Tag hinzu!
_version_ 1866914255780970496
author Jaillet, Patrick
Jiang, Jiashuo
Mellou, Konstantina
Molinaro, Marco
Podimata, Chara
Zhou, Zijie
author_facet Jaillet, Patrick
Jiang, Jiashuo
Mellou, Konstantina
Molinaro, Marco
Podimata, Chara
Zhou, Zijie
contents Large Language Model (LLM) inference, where a trained model generates text one word at a time in response to user prompts, is a computationally intensive process requiring efficient scheduling to optimize latency and resource utilization. A key challenge in LLM inference is the management of the Key-Value (KV) cache, which reduces redundant computations but introduces memory constraints. In this work, we model LLM inference with KV cache constraints theoretically and propose a novel batching and scheduling algorithm that minimizes inference latency while effectively managing the KV cache's memory. More specifically, we make the following contributions. First, to evaluate the performance of online algorithms for scheduling in LLM inference, we introduce a hindsight optimal benchmark, formulated as an integer program that computes the minimum total inference latency under full future information. Second, we prove that no deterministic online algorithm can achieve a constant competitive ratio when the arrival process is arbitrary. Third, motivated by the computational intractability of solving the integer program at scale, we propose a polynomial-time online scheduling algorithm and show that under certain conditions it can achieve a constant competitive ratio. We also demonstrate our algorithm's strong empirical performance by comparing it to the hindsight optimal in a synthetic dataset. Finally, we conduct empirical evaluations on a real-world public LLM inference dataset, simulating the Llama2-70B model on A100 GPUs, and show that our algorithm significantly outperforms the benchmark algorithms. Overall, our results offer a path toward more sustainable and cost-effective LLM deployment.
format Preprint
id arxiv_https___arxiv_org_abs_2502_07115
institution arXiv
publishDate 2025
record_format arxiv
spellingShingle Online Scheduling for LLM Inference with KV Cache Constraints
Jaillet, Patrick
Jiang, Jiashuo
Mellou, Konstantina
Molinaro, Marco
Podimata, Chara
Zhou, Zijie
Machine Learning
Artificial Intelligence
Optimization and Control
Large Language Model (LLM) inference, where a trained model generates text one word at a time in response to user prompts, is a computationally intensive process requiring efficient scheduling to optimize latency and resource utilization. A key challenge in LLM inference is the management of the Key-Value (KV) cache, which reduces redundant computations but introduces memory constraints. In this work, we model LLM inference with KV cache constraints theoretically and propose a novel batching and scheduling algorithm that minimizes inference latency while effectively managing the KV cache's memory. More specifically, we make the following contributions. First, to evaluate the performance of online algorithms for scheduling in LLM inference, we introduce a hindsight optimal benchmark, formulated as an integer program that computes the minimum total inference latency under full future information. Second, we prove that no deterministic online algorithm can achieve a constant competitive ratio when the arrival process is arbitrary. Third, motivated by the computational intractability of solving the integer program at scale, we propose a polynomial-time online scheduling algorithm and show that under certain conditions it can achieve a constant competitive ratio. We also demonstrate our algorithm's strong empirical performance by comparing it to the hindsight optimal in a synthetic dataset. Finally, we conduct empirical evaluations on a real-world public LLM inference dataset, simulating the Llama2-70B model on A100 GPUs, and show that our algorithm significantly outperforms the benchmark algorithms. Overall, our results offer a path toward more sustainable and cost-effective LLM deployment.
title Online Scheduling for LLM Inference with KV Cache Constraints
topic Machine Learning
Artificial Intelligence
Optimization and Control
url https://arxiv.org/abs/2502.07115