Implement speculative decoding: draft proposes kk tokens, target verifies in one pass, ac

Inference & Serving4 / 5

Chapter 244 / 5

Inference & Serving

Implement speculative decoding: draft proposes kk tokens, target verifies in one pass, ac

Hard

Implement speculative decoding: draft proposes kk tokens, target verifies in one pass, accept/reject with the correct probabilistic rule.

Target interface
residual_sample(p, q, rng)

Implement the function/class skeleton in the editor. Any correct approach is accepted.

Hints0 / 2
Reference solution
Your own code stays in the editor.