Skip to content

About

Testing whether language-model serving software reports the probability of the token it actually sampled

Resources

Stars

1 star

Watchers

0 watching

Forks

Latest commit

 

History

5 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 

Repository files navigation

TokenReceipt

When a Language Model Server Reports a Different Token · Yufeiyang Chen

A language model samples one token, but the inference server can attach a different token and probability to it in the API response. TokenReceipt tests sampled-token attribution on the same sampling event, formalizes five serving-boundary contract invariants (I1–I5), traces downstream failures into multi-scale confidence routing, LLM-as-a-Judge scoring, answer selection, and clipped policy-gradient / GRPO updates, and provides a full-transport patch alongside cross-engine auditing tools.

On 64 IFEval prompts, MLX-LM 0.32.2 reported a different token at 528 of 1,488 positions and a different score at 521 (I1/I2 failures). In live audits on SmolLM2-135M, Qwen2.5-3B, and Qwen2.5-7B-Instruct-4bit, the 15-check full-transport patch reduced stock attribution and streaming errors (I1 fails up to 20/64 and I5 streaming omission 64/64 per model and width) to 0/384, passing I1, I2, I3, and I5 at all 384 patched positions with unchanged generated text (while reproducibility/patch/preprint-11-check/ archives the earlier non-streaming 11-check revision). Unified I1–I5 contract checks across seven serving architectures further isolate empty-delta SSE logprob drops in SGLang v0.5.23 (78/246 missing rows, with I3 and I5 failures on 33/36 requests, repaired to 246/246 passing positions), deferred UTF-8 fragment representations in vLLM v0.34.0 (0/246 drops; 102/246 strict I4 fragment defers), EOS/UTF-8 coalescing row shortfalls (21/424 at T=0.8, 39/388 at T=0.0, plus prompt-13 coalesced I2 cutoff failure) and top_logprobs=5 stochastic drift (216/360 > 1e-4 nats, max 0.006403 vs 0.000000 for k=1 on 403/403) in live Ollama v0.40.17, row omissions in llama.cpp (3/280), non-streaming U+FFFD UTF-8 damage in mistral.rs (708 FLORES-200 positions across 72/72 non-English pairs), and equal/unequal-length cross-row batch callback leakage in CTranslate2 4.9.0 (24/24 equal-length item-0 2V leaks and item-1 NULL errors, repaired 48/48 by batch splitting).

Downstream across both Qwen2.5-3B-Instruct-4bit and Qwen2.5-7B-Instruct-4bit on ARC-Challenge (250 confirmation questions per model, held out from the pilots), reported-score inflation (+0.1943 and +0.1181 nats mean bias, propagated identically through Inspect AI 0.3.277) induces a calibration paradox: lowering aggregate 10-bin ECE (0.1250 -> 0.0318 at 3B; 0.0995 -> 0.0348 at 7B) while raising wrong-answer false acceptances by +49.2 pp at 3B ($\tau_{85}=0.666$, 16/59 -> 45/59, $p<10^{-6}$) and +33.3 pp to +35.7 pp at 7B ($\tau_{90}=\tau_J=0.682$: 27/42 -> 41/42, $p=1.2\times 10^{-4}$; Fixed 0.80: 14/42 -> 29/42, $p=6.1\times 10^{-5}$). In DeepEval 4.3.4 (GEval.measure), missing score tokens flipped 6/94 (6.4%) binary pass verdicts at 3B and attenuated to 2/95 continuous shifts (0/95 flips) at 7B. Across 50 x 4 = 200 multi-token Qwen2.5-7B GRPO rollouts (8,328 positions), strictly over-reported wire scores ($\hat{s}_t > s_t$, 844/844) zeroed clipped-PPO surrogate gradients on 86.36% (95/110) of corrupted negative-advantage tokens ($\epsilon=0.2$), attenuated the surrogate gradient on 100% (92/92) of corrupted positive-advantage tokens, and injected nonzero spurious Step-0 $k_3$ KL divergence in 181/200 rollouts; alongside 846/2,108 (ARC-Easy) best-of-4 winner changes and a -1.90 pp ([-2.66, -1.16]) held-out accuracy drop across 128 online SST-2 training seeds.

The public data contain numerical observations and within-position equality classes. Source text for restricted or unclear-license datasets can be reconstructed from the upstream sources using the documented selection rules. See the licenses and source notices.

About

Testing whether language-model serving software reports the probability of the token it actually sampled

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages