Optimizing LLM Inference: Fluid-Guided Online Scheduling with Memory Constraints

93 Pages Posted: 7 Apr 2025 Last revised: 13 Jun 2026

See all articles by Ruicheng Ao

Ruicheng Ao

Massachusetts Institute of Technology (MIT) - Institute for Data, Systems, and Society (IDSS)

Gan Luo

Peking University

David Simchi-Levi

Massachusetts Institute of Technology (MIT) - School of Engineering

Xinshang Wang

Alibaba Group

Date Written: March 27, 2025

Abstract

Large language models now serve millions of users daily, with providers incurring costs exceeding $700,000 per day. Each request requires token-by-token inference, making GPU scheduling central to latency, capac- ity, and cost. The difficulty is endogenous memory growth: generated tokens expand the Key-Value (KV) cache, and overflow can evict in-progress requests and waste prior computation. We formulate inference as a multi-stage online scheduling problem with endogenous memory growth, linear iteration times, and GPU- resident KV-cache constraints. We introduce a fluid model that characterizes equilibrium batch composition, memory requirement, and stability region. Guided by the fluid model, we design WAIT (Waiting for Ac- cumulated Inference Threshold), a threshold-based admission rule for known output lengths, and Nested WAIT, which extends the rule to unknown output lengths by regulating how requests advance across decode- stage segments. Both algorithms approximate the fluid benchmark asymptotically under the stated memory conditions. Nested WAIT uses an additional safety buffer of moderate scale to hedge against memory- overflow-induced evictions under unknown output lengths. In Vidur simulations configured for Llama-2-7B on an A100 GPU, with supplemental real-GPU validation reported in the appendix, the policies enlarge the empirically observed stable operating range relative to widely used baseline algorithms and reduce latency especially in near-overloaded and overloaded regimes. 

Keywords: Large Lanugage Model, Key-value cache, Memory Constraint, Online scheduling

Suggested Citation

Ao, Ruicheng and Luo, Gan and Simchi-Levi, David and Wang, Xinshang, Optimizing LLM Inference: Fluid-Guided Online Scheduling with Memory Constraints (March 27, 2025). Available at SSRN: https://ssrn.com/abstract=5195463 or http://dx.doi.org/10.2139/ssrn.5195463

Ruicheng Ao (Contact Author)

Massachusetts Institute of Technology (MIT) - Institute for Data, Systems, and Society (IDSS) ( email )

United States

HOME PAGE: http://www.mit.edu/~aorc/index.html

Gan Luo

Peking University ( email )

David Simchi-Levi

Massachusetts Institute of Technology (MIT) - School of Engineering ( email )

MA
United States

Xinshang Wang

Alibaba Group ( email )

Do you have a job opening that you would like to promote on SSRN?

Paper statistics

Downloads
420
Abstract Views
6,011
Rank
179,037
PlumX Metrics