﻿# ONNX CUDA GatedDeltaNet speculative state: capture candidates before choosing a committed prefix

Compact state capture in v0.4.0 separates speculative candidates from committed progress; test rejected suffixes and capture-capacity boundaries.

Author: Retrivium team
Updated: 2026-11-15
Canonical URL: https://retrivium.ai/journal/week46-engine-ort-gated-delta-speculative-state-capture/
Language: en

CUDA Plugin EP v0.4.0 extends GatedDeltaNet and CausalConvWithState to short multi-token speculative execution and compact state-update capture. The linked PR bounds capture capacity separately from sequence length. Producing candidate states is therefore not the same operation as committing all of them to the conversation’s accepted state.

## Verification computes work that may be discarded

Several candidate tokens can generate several intermediate recurrent states. Only the accepted prefix should determine subsequent exact continuation. A proposed test deliberately accepts different prefix lengths, including an early rejection, and compares the next state with sequential reference execution of accepted tokens only. A run that accepts every candidate is incomplete coverage because it never tests whether rejected suffix state remains isolated.

## Capacity is an explicit output contract

The PR provides a bounded state-update capacity for compact capture. An application should preserve that setting with its maximum verification shape. A proposed boundary test varies actual sequence length independently from capture capacity, checking defined output rows and state semantics. Treating a buffer’s allocated rows as proof that every candidate state was captured can read inactive data or commit the wrong snapshot.

## Packed projections do not erase logical ownership

The release also supports packed projection paths. Their storage efficiency does not change which state belongs to which request and candidate position. Include a multi-request batch with distinguishable initial states and inputs, then compare each committed continuation separately. This can reveal an offset mix-up that a single request hides. Keep projection-layout checks distinct from acceptance logic so a mismatch has a clear diagnostic target.

## Measure accepted progress after correctness

A faster multi-token kernel does not by itself establish speculative throughput, because draft cost and acceptance remain outside that operator. This article reports the state-capture capability and proposed prefix tests without a new performance claim. A useful benchmark records accepted tokens, verification shape and state-capture configuration, preserving the distinction between work executed and conversation progress actually committed. After a rejected suffix, run at least one further accepted token and compare its result. This continuation check can expose an incorrect committed recurrent state even when the immediate verification outputs and reported prefix length both appear correct.

## Sources

- [ONNX Runtime plugin-ep-cuda/v0.4.0 release](https://github.com/microsoft/onnxruntime/releases/tag/plugin-ep-cuda/v0.4.0)
- [ONNX Runtime pull request #33471](https://github.com/microsoft/onnxruntime/pull/33471)

## Related reading

- [GatedDeltaNet in Vulkan: CPU fallback and a different HIP bottleneck](/journal/gated-delta-net-vulkan-fallback-hip-kernel-historical-case/)
- [CUDA Graph capture: why some operations cannot join the capture](/journal/learn-graph-capture-forbidden-operations/)
