Add challenge 87: Speculative Decoding Verification (Medium)#226
Open
claude[bot] wants to merge 2 commits intomainfrom
Open
Add challenge 87: Speculative Decoding Verification (Medium)#226claude[bot] wants to merge 2 commits intomainfrom
claude[bot] wants to merge 2 commits intomainfrom
Conversation
Implements the token acceptance/rejection step from speculative decoding: given B draft sequences with T candidate tokens each, determine which tokens to accept (based on min(1, q/p) acceptance probability), resample a replacement from the adjusted distribution clamp(q-p, 0) on the first rejection, or sample a bonus token if all T draft tokens are accepted. Key GPU learning moments: - Sequential acceptance chain with inherent data dependency across positions - Parallel reduction to find first rejection across the batch dimension - O(V) inverse-CDF sampling via prefix sum over vocabulary Performance test: B=64, T=8, V=32,768 (Mistral/LLaMA-2 vocab size) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Redesign SVG with wider boxes to prevent text overflow, add probs row
showing p(t) and q(t) values per position. Convert description to
notation list + numbered algorithm steps with equations. Convert example
from <pre> to LaTeX. Fix \texttt{uniform\_samples} → plain underscore.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Contributor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Summary
clamp(q−p, 0)on the first rejection, or sample a bonus token if all T tokens are acceptedGPU learning moments:
Test cases: 10 functional tests covering single-token edge cases, all-accept (bonus token), forced first-rejection, mixed acceptance, varying V (4–1,000), and a realistic batch. Performance test: B=64, T=8, V=32,768.
Test plan
.cu,.pytorch.py,.triton.py,.jax.py,.cute.py,.mojo)pre-commit run --all-filespasses (Black, isort, flake8, clang-format)run_challenge.py --action submit— all functional + performance tests pass on NVIDIA Tesla T4<p>,<h2>sections, example matchesgenerate_example_test(), SVG visualization included, performance bullet matchesgenerate_performance_test()🤖 Generated with Claude Code