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

Prefill, Decode, and KV Cache Memory4 / 5

Chapter 024 / 5

Prefill, Decode, and KV Cache Memory

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)

Complete the starter code in the editor. Any correct approach is accepted.

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