# Testing Processor Contracts in Speculative Decoding Engines

DevFeed: [Testing Processor Contracts in Speculative Decoding Engines](<https://devfeed.tech/articles/testing-processor-contracts-in-speculative-decoding-engines-116183.md>)

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

Author: Tianyu Ding, Yaocheng Tong, Muzhi Yang, Lei Yang, Fei Jiang

Published: 2026-11-04T05:00:00Z

Content type: article

Language: en

Sources: [arXiv: Machine Learning](<https://devfeed.tech/sources/arxiv-machine-learning.md>), [arXiv: Software Engineering](<https://devfeed.tech/sources/arxiv-software-engineering.md>)

Topics: [Integration testing](<https://devfeed.tech/topics/integration-testing.md>), [Model Optimizer](<https://devfeed.tech/topics/model-optimizer.md>), [llama.cpp](<https://devfeed.tech/topics/llama-cpp.md>)

Tags: [conformance-testing](<https://devfeed.tech/tags/conformance-testing.md>), [contracts](<https://devfeed.tech/tags/contracts.md>), [cs-lg](<https://devfeed.tech/tags/cs-lg.md>), [cs-se](<https://devfeed.tech/tags/cs-se.md>), [processors](<https://devfeed.tech/tags/processors.md>), [speculative-decoding](<https://devfeed.tech/tags/speculative-decoding.md>), [testing](<https://devfeed.tech/tags/testing.md>)

## AI overview

Speculative decoding's distribution guarantee depends on logits processors receiving the correct token prefix and state at each verification position. The paper formalizes this processor-prefix contract and proposes BADC, which combines tiny-model reference checks, processor input and state checks, and simultaneous confidence bounds on output events. Tests on selected Transformers and llama-cpp-python releases identified processors reading unverified drafts and advancing state without rollback. For one pilot-selected prompt and trained checkpoint, fresh samples yielded a 60.26 percentage-point lower bound on the difference in a predefined first-token event probability between ordinary and prompt-lookup decoding, under nominal simultaneous 95% coverage assuming within-arm i.i.d. sampling. Controlled comparisons found no cause-recovery advantage for directed over random selection; permutation testing detected each tested family at least as often as BADC. The results do not establish diagnostic superiority or how prevalent these failures are in real workloads.

## Source excerpt

arXiv:2611.04042v1 Announce Type: new Abstract: Speculative sampling can accelerate decoding without changing the target distribution. Its standard guarantee assumes that logits processors, which enforce constraints or modify token scores, receive the appropriate token prefix and state at each verification position. We formalize this processor-prefix contract and present BADC (branch-aware differential conformance testing). BADC combines enumerated references on tiny random models, checks of processor inputs and state, and simultaneous confidence bounds on output-event probabilities. Preregistered, source-informed experiments on selected Transformers and llama-cpp-python releases confirm two causes: processors read unverified drafts or advance state without rollback. For one pilot-selected prompt on a trained checkpoint, fresh samples give a 60.26-percentage-point lower bound on the difference in the probability of a predefined first-token event between ordinary and prompt-lookup decoding, with nominal simultaneous 95% coverage under within-arm i.i.d. sampling. Controlled comparisons establish no cause-recovery advantage of directed selection over random selection, while permutation testing detects each tested family at least as often as BADC. These findings connect processor-interface failures to observable decoding differences without establishing diagnostic superiority or workload prevalence.