arXiv(opens in a new tab)cs.SESep 2026Cited by 2 papers on PaperVantage

Manuscript Offprint

arXiv:2609.04748

Same Request, Different Answer: Quantization Amplifies Cache-Induced Divergence in LLM Serving

Aditi Patodiya

ADITI PATODIYA

Independent Researcher, Milpitas, CA 95035 USA

Corresponding author: Aditi Patodiya (e-mail: aditi.patodia31@gmail.com). This work has been submitted to the IEEE for possible publication. Copyright may be transferred without notice, after which this version may no longer be accessible.

ABSTRACT Prefix caching, in which a serving engine reuses the key and value tensors of a shared prompt prefix across requests, is enabled by default in the major open-source stacks and treated as a transparent optimization. We measure what it costs in reproducibility, and find that the cost rises sharply with weight quantization. Holding the model, decoding parameters, seed, and request order fixed, and issuing every request serially at batch size one, we ran an eighty-episode multi-turn agentic tool-use workload with caching enabled and disabled across two engines and four weight formats. Enabling the cache changed the agent's trajectory on 36.2 percent of episodes at 16-bit precision and on 75.0 percent at four-bit, a gradient that survives re-measurement under a controlled cache configuration. With caching disabled, repeated execution was bit-identical in every configuration, 0 of 800 episodes, which bounds other sources of nondeterminism at 0.5 percent. Repeated cache-enabled runs did diverge, and three experiments locate the cause: a single server-level prompt-cache setting moves run-to-run divergence by 37.5 percentage points, execution order acts only while that setting is active, and restoring cache state makes the cached and recompute paths each reproduce on 40 of 40 items while still differing from each other on 14. Cached serving is deterministic given cache state, and irreproducible in practice because that state is absent from the request and never reset by default. A single-turn bridge shows the divergence reaching task outcomes without shifting aggregate accuracy. We release the harness, logs, and analysis pipeline.

INDEX TERMS Large language models, inference serving, reproducibility, prompt caching, key-value cache, quantization, software testing, empirical software engineering

1. INTRODUCTION

Prefix caching is one of the least controversial optimizations in modern language model serving. When consecutive requests share a leading span of tokens, the server reuses the key and value tensors it already computed for that span instead of recomputing them. Every major serving stack ships the feature and most enable it by default [1]–[3]. The savings are large and well documented: a recent evaluation of long-horizon agent pipelines reports 41 to 80 percent lower cost and 13 to 31 percent faster time to first token when caching is on [4]. For agentic workloads the appeal is even stronger than for chat, because an agent re-sends its entire growing transcript on every step, so almost the whole prompt is

a cache hit after the first turn.

The optimization carries an implicit promise. Reusing arithmetic that was already performed is supposed to be an implementation detail, invisible above the serving layer. A user who sends the same request with the same sampling parameters expects the same answer whether or not the server happened to have a warm cache.

That promise does not hold, and the failure is not subtle. Reusing cached keys and values changes the order in which floating point accumulations are performed, and floating point addition is not associative, so the reused path and the recomputed path produce slightly different numbers. Most of the time the difference is invisible. Occasionally it moves a token probability across a decision boundary, and the sampled token changes. In a single-turn setting that is a curiosity. In an agent loop it is not, because the changed token may be part of a tool call, and the tool call determines the next observation, which determines the rest of the episode.

Practitioners have noticed. Two issues in the vLLM tracker report behavior of this kind. One describes an accuracy drop from roughly 78 percent to 60 percent when the prefix cache interacts with the recomputation path [5]. The other, filed against ROCm hardware and not reproducing on CUDA, shows an identical request returning different text depending on whether it hit the cache [6]. Both were closed without a systematic characterization. In the literature, one recent study established that cached and recomputed decoding are not numerically equivalent under FP16 on single-turn arithmetic [7], and a study of inference backends found that backend choice alone can shift benchmark scores by as much as 16.6 points, naming prefix caching among the causes without isolating it [8]. What has been missing is a controlled measurement of how often this matters for the workload the feature was designed to accelerate, and of what the effect does when the weights are quantized, which is how most locally served models run.

This paper provides that measurement. We run a paired design in which the only variable is the cache setting, with greedy decoding, a fixed seed, a batch size of one, and serial requests, so the usual sources of serving nondeterminism are held out. The workload is multi-turn agentic tool use from the Berkeley Function Calling Leaderboard [9], with single-turn grade school mathematics [10] as a bridge to the prior single-turn result. We run every configuration twice, which turns the design into something stronger than a comparison between arms: it lets each arm be compared against itself.

That within-arm comparison produces the paper's central result. With caching disabled, repeated execution of the identical workload is bit identical, in every configuration we tested, without exception. With caching enabled, the same repetition changes the outcome of a large fraction of episodes. The system is not noisy in general. It becomes noisy exactly when the cache is turned on. The correct description of the effect is therefore not that cached and uncached execution differ, but that caching makes the server's output a function of its own recent history rather than of the request alone.

The mechanism is not news, and we do not present it as such. Work on deterministic inference already identifies reduction-order variation between prefilled and cached execution as a source of nondeterminism, and prescribes batch-invariant kernels to remove it [11]. SGLang now ships a deterministic mode that reports consistent output across cached and uncached prefill on two of its three attention backends [12]. What has not been established is the magnitude in the configuration

people actually deploy. Those fixes are opt-in, they carry a throughput cost, they are unavailable on some backends and absent entirely from llama.cpp, and they are off by default in every stack we tested. Our contribution is to measure what the default configuration does to the workload the cache was built for.

The contributions are as follows.

  • A controlled measurement across model families, quantization formats, and two serving implementations, showing that cache-disabled serving is bit-identical across repeated runs while cache-enabled serving is not.
  • An isolation of the cause. Execution order is ruled out, a single server-level prompt-cache setting is shown to move run-to-run divergence by 37.5 percentage points, and a reset control demonstrates that the cached path is reproducible once cache state is restored. The resulting claim is that cached serving is deterministic given cache state, which deployments neither report nor control.
  • The first characterization of how weight quantization interacts with cache-induced divergence, showing that coarser quantization amplifies it substantially.
  • An outcome-level analysis separating instability from degradation, independently replicating a concurrent single-turn result in a serving-engine setting: individual items change correctness in both directions while aggregate accuracy does not move.
  • A released harness, raw per-request logs including server-reported cache exposure, and an analysis pipeline that regenerates every number in this paper from those logs.

References (36)