# Behavioral Consistency in Machine Learning

DevFeed: [Behavioral Consistency in Machine Learning](<https://devfeed.tech/articles/behavioral-consistency-in-machine-learning-96851.md>)

Original publisher: [Read original article](<https://arxiv.org/abs/2606.07581>)

Author: Lan Wu, Bruce Changlong Xu

Published: 2026-10-23T04:00:00Z

Content type: article

Language: en

Sources: [arXiv: Artificial Intelligence](<https://devfeed.tech/sources/arxiv-artificial-intelligence.md>), [arXiv: Machine Learning](<https://devfeed.tech/sources/arxiv-machine-learning.md>)

Topics: [Machine learning](<https://devfeed.tech/topics/machine-learning.md>), [Inference](<https://devfeed.tech/topics/inference.md>), [Language models](<https://devfeed.tech/topics/language-models.md>), [model-deployment](<https://devfeed.tech/topics/model-deployment.md>), [Large Language Model](<https://devfeed.tech/topics/llm.md>), [vllm](<https://devfeed.tech/topics/vllm.md>), [quantization](<https://devfeed.tech/topics/quantization.md>), [hugging face](<https://devfeed.tech/topics/hugging-face.md>), [Reinforcement learning](<https://devfeed.tech/topics/reinforcement-learning.md>)

Tags: [attention](<https://devfeed.tech/tags/attention.md>), [batching](<https://devfeed.tech/tags/batching.md>), [consistency](<https://devfeed.tech/tags/consistency.md>), [contracts](<https://devfeed.tech/tags/contracts.md>), [cs-ai](<https://devfeed.tech/tags/cs-ai.md>), [cs-et](<https://devfeed.tech/tags/cs-et.md>), [cs-lg](<https://devfeed.tech/tags/cs-lg.md>), [gpu](<https://devfeed.tech/tags/gpu.md>), [hugging-face](<https://devfeed.tech/tags/hugging-face.md>), [kernel](<https://devfeed.tech/tags/kernel.md>), [key-value-cache](<https://devfeed.tech/tags/key-value-cache.md>), [machine-learning](<https://devfeed.tech/tags/machine-learning.md>), [precision](<https://devfeed.tech/tags/precision.md>), [vllm](<https://devfeed.tech/tags/vllm.md>)

## AI overview

Identical model weights can produce different outputs when run by different kernels or serving setups. The paper proposes kernel contracts that bound a serving kernel's drift from a reference on each traffic slice and specify a response when limits are exceeded. It proves non-asymptotic links between logit differences and distribution divergence, expected reward changes, policy-gradient bias, and greedy-token changes. GPU experiments with Qwen2.5-7B-Instruct using Hugging Face and vLLM found that lower precision, serving engine, and batch size each changed tokens on some prompts; changes clustered where the model was nearly split between two tokens. The reported bounds held on every measured prompt, and per-slice contract checks caught differences that aggregate metrics could miss.

## Source excerpt

arXiv:2606.07581v2 Announce Type: replace Abstract: A trained model is usually described by its weights, as if the weights fixed its behavior. In practice the same weights are run by different programs. Training uses high-precision accumulation and fixed tensor shapes, while serving uses low-precision arithmetic, fused attention kernels, a paged key-value cache, and dynamic batching. These programs produce different next-token distributions from identical weights. We make this dependence explicit by indexing a policy by the kernel that executes it, and we propose kernel contracts, which state how far a serving kernel may drift from a reference kernel on each slice of traffic and what the serving system should do when a limit is exceeded. We prove non-asymptotic bounds that link the logit difference between two kernels to total-variation and KL divergence, to the change in expected reward, to the bias of policy gradients computed from rollouts generated by another kernel, and to whether the greedy token can change. We test the bounds and the contracts in GPU experiments on Qwen2.5-7B-Instruct with Hugging Face and vLLM. The bounds hold on every prompt we measured. Lower precision, a different serving engine, and a different batch size each change the generated token on some prompts, and these changes concentrate on prompts where the model is nearly undecided between two tokens. A kernel can therefore look fine on aggregate metrics while behaving differently on exactly these prompts. Checking a contract separately on each slice of traffic catches these cases.