Implement Speculative Decoding in PyTorch
Hardllm-inferenceauto-graded
Draft tokens with a fast model, verify in parallel with the target model, and accept/reject to guarantee identical output distribution.
Solve it
Check your answer
The grader verifies properties of your implementation, so a correct solution written differently from ours still passes.
pip install torchleet
from torchleet import check
check("speculative-decoding", DraftModel, TargetModel, standard_decode, speculative_decode)