DSpark: Confidence and Prefix Survival
Easy · Solved in PyTorch · Machine learning coding practice
Problem
DSpark drafts several tokens per round, but only a prefix of them survives the target model's check. A confidence head scores every draft position, and those scores are chained into a prefix survival estimate that the scheduler later uses to decide how much of the draft is worth verifying. The mechanism comes from DSpark (DeepSeek-AI, 2026).
For each draft position j = 1, \dots, K the head reads the backbone hidden state h_j together with the embedding e_j of the token immediately preceding that position, and produces a conditional acceptance probability
Topics: inference, speculative-decoding, autoregressive
The full statement, worked examples, hints and the test suite are available once you sign in. You can then solve DSpark: Confidence and Prefix Survival in the browser and run it against the tests.