cs.CLOct 26, 2025

Correctness Forensics for Batch Speculative Decoding: Diagnosing the Ragged Tensor Problem

Authors: Ranran Haoran ZhangSoumik DeyAshirbad MishraHansi WuBinbin LiRui Zhang

Organizations: The Pennsylvania State University, University Park, PA, USA · eBay Inc, San Jose, CA, USA.

Abstract

Inference optimizations are routinely evaluated by throughput alone, without verifying output correctness. We conduct a forensic analysis of batch speculative decoding and find that several widely-used implementations silently produce corrupted outputs (repetitive tokens, <unk> symbols) while reporting competitive speed; failures invisible to metrics like ROUGE. We trace the root cause to the ragged tensor problem: variable token acceptance desynchronizes position IDs, attention masks, and KV-cache across a batch. We formalize the synchronization invariants (rectangular alignment and position-ID contiguity) that valid batched inference must preserve and show that maintaining them incurs superlinear alignment overhead under contiguous layouts. EQSPEC enforces the invariants without custom kernels; EXSPEC schedules same-length sequences to bypass realignment. On SpecBench across three model families, EXSPEC reaches 3 x throughput at batch size 8 with 95% exact match to standard decoding; residual divergence traces to floating-point non-determinism, not synchronization error. Code:https://github.com/eBay/spec_dec

Explore similar work

CardsList