Manuscript Offprint

arXiv:2611.02082

Fairway: Load-Aware KV Cache Reuse for LLM Prefill Scheduling

Hamidreza Alikhani, Nazmul Takbir, Matin Khajavi, Rajat Bhattacharjya, Sangeetha Abdu Jyothi, Nikil Dutt

ABSTRACT

LLM-based applications often employ agentic workflows and retrieval-augmented generation (RAG), which build long prompts from shared context. When prefixes are shared across requests, serving engines reuse the key-value (KV) cache to skip parts of the prefill computation. Reuse is typically graded: the uncached work of requests in a queue can differ by up to 100×100\times. In this setting, the order of scheduling determines the time-to-first-token (TTFT) for the queued requests. KV reuse-first scheduling, which prioritizes the requests with the longest KV cache hit, gives the lowest median TTFT but starves expensive requests under load spikes; first-come-first-served (FCFS) scheduling bounds the tail but raises the median TTFT. We present FAIRWAY, a prefill scheduler built on adaptive reuse prioritization: it favors KV cache reuse while queues are short, and shifts toward fair allocation as requests wait longer relative to their own prefill time. FAIRWAY employs a virtual dual lane model: a KV reuse-first Fast lane and a Fair lane atop the serving engine's waiting queue that enables speeding up of cheap reuse requests without starving expensive ones. This model automatically adapts to the workload without any per-workload tuning. FAIRWAY lowers the tail TTFT at no cost to the median in transient overload. Across workloads and load levels, FAIRWAY matches or beats the best baseline, with a p99 TTFT up to 8.6×8.6\times lower than prior prefix-aware schedulers. During load spikes, it keeps the tail of FCFS at a 6×6\times lower median TTFT.

1 INTRODUCTION

Retrieval-augmented generation (RAG) and agentic workflows assemble long prompts from context shared across requests. RAG adds retrieved documents to each prompt, as in enterprise search and document question answering (Lewis et al., 2020; Gao, 2023), and an agent resends its history and tool outputs on every call (Qin et al., 2025). LLM inference runs in two phases: prefill processes the whole prompt in one compute-bound pass, building its key-value (KV) state and emitting the first token, and decode then generates the remaining tokens one at a time. These prompts are long, so the time to first token (TTFT) is dominated by prefill. State-of-the-art serving engines therefore cache the KV state of prompt prefixes and skip recomputing it (Kwon et al., 2023; Zheng et al., 2024). The KV cache is finite, so the order in which waiting requests are served sets both how long each request waits and whether its prefix is still cached when it runs: a request held back in the queue may lose its hit when the requests admitted before it evict its KV blocks. In prefill-decode disaggregated serving (Zhong et al., 2024; Patel et al., 2024; Qin et al., 2025), this order is

set on each prefill node, where a request spends most of its TTFT queueing and in prefill.

Reuse is graded: a request may find all, some or none of its prefix cached, so its prefill work depends on its uncached tokens rather than its prompt length. In Mooncake's production agentic traces (Qin et al., 2025), most requests are partly cached, and this work differs by ≈100×\approx 100\times within a queue ( §3.1\S3.1). RAG behaves the same way: requests share some retrieved documents but not others, so full hits that compute the prefill only for their question wait in the same queue as partial hits that carry nearly all the prefill work. Prompt lengths vary as well, and the mix of hits and lengths shifts as the popularity of documents and the load change over time.

Existing schedulers handle this variation only partially. KV reuse-first schedulers, which first serve the request with the longest cached prefix (Zheng et al., 2024) or the highest ratio of cached to uncached tokens (Jin et al., 2025), give the best median TTFT but can starve expensive requests when load rises. First-come-first-served (FCFS) bounds the tail but ignores reuse, so cheap hits wait behind long misses. Schedulers that add fairness to a KV reuse-first order measure it in units that ignore request size: some count turns, giving the oldest request one turn in every few (Dexter et al., 2025) or sharing turns among groups

1^{1}University of California, Irvine, CA, USA 2^{2}Apiphany. Correspondence to: Hamidreza Alikhani hamidra@uci.edu.

Preprint. Copyright 2026 by the author(s).

Figure

Figure 1. Median vs. p99 TTFT during a 60s load spike on a finance RAG trace (SEC QA; log-log). Shaded: within 10% of LPM's median and of FCFS's p99.

of requests with similar cache ratios (Srivatsa et al., 2025), though one turn may cost tens of tokens or thousands; other works count seconds, raising a request's priority with its absolute wait (Du et al., 2025), though the same wait time weighs differently on requests of different lengths. Figure 1 shows the result in a short load spike: KV reuse-first orders keep a median of 0.8 s, but their p99 reaches 15–42 s; FCFS keeps the p99 at 7.8 s, but its median rises to 5.9 s. Each fixed rule suits some mix of hits, lengths and load, and fails on another (§2.3, §3).

We present FAIRWAY, a prefill scheduler built on adaptive reuse prioritization: it favors KV cache reuse while queues are short and shifts toward fairness as queues grow and requests wait longer relative to their own prefill time. FAIRWAY rests on two choices: it measures fairness in work characterized by a request's uncached tokens, and it measures each request's wait relative to its own expected prefill time. Two virtual lanes, which order the same requests in two ways, form the backbone of FAIRWAY. The Fast lane ranks requests by the compute their cached prefix saves and promotes them as their relative wait grows, and the Fair lane ranks them by arrival time. FAIRWAY adaptively prioritizes between the lanes, balancing KV cache reuse and fairness with a bound on the work placed ahead of the oldest requests. This balance adapts automatically with different workloads, without requiring any mode switch or per-workload tuning.

We implement FAIRWAY as a drop-in hook in vLLM's scheduler (Kwon et al., 2023): FAIRWAY changes how waiting requests are selected for admission in each scheduling step. It operates orthogonally to other engine policies, such as eviction and step-size selection, and leaves those and other engine configuration unchanged. We evaluate it on a production agentic trace (Qin et al., 2025) and on RAG workloads for financial and general multi-hop QA (Qin et al., 2025; Docugami, 2023; Trivedi et al., 2022; Bai et al., 2024; Li et al., 2024; Dexter et al., 2025; Srivatsa et al., 2025; Xie et al., 2026) across a wide range of loads and prompt lengths. We compare it with seven baselines, from FCFS and KV reuse-first policies to schedulers that consider fairness in their admission policy (Dexter et al., 2025; Srivatsa et al., 2025; Xie et al., 2026).

Across workloads and load levels, FAIRWAY matches or beats the best baseline in every scenario. Its p99 TTFT is up to 8.6× lower than that of prior prefix-aware schedulers, and it starves no request. In load spikes, FAIRWAY keeps the tail of FCFS while achieving a 6× lower median TTFT, by letting cheap cache hits go first while bounding how far they can push expensive misses back. On mixed-length workloads, it cuts the p99 TTFT of short requests by about a third relative to every baseline that does not starve requests.

In summary, we make the following contributions:

  • A characterization of graded prefix reuse: We show that in agentic traces and RAG workloads, prefill work within a queue differs by ≈ 100×, depending on both the cache state and the prompt length (§3.1).

  • An analysis of why existing schedulers fall short: KV reuse-first orders starve expensive requests under load spikes, FCFS raises the median, and fairness counted in turns or in absolute wait time ignores how much work each request carries (§3.1–§3.4).

  • FAIRWAY, a prefill scheduler built on adaptive reuse prioritization, which measures fairness in work and each request's wait relative to its own prefill time. Two virtual lanes, merged by the work each has scheduled, favor KV cache reuse while queues are short and bound the work served ahead of the oldest request as queues grow, without per-workload tuning. (§4).

  • Evaluations against seven baselines on a production agentic trace and three RAG benchmarks under a wide range of workload characteristics showing that FAIRWAY stays robust where the best baseline changes, with one setting throughout (§5).

References (44)