All problems
Acceptance Rate Estimate
Problem
Compute the aggregate speculative-decoding acceptance rate from per-round counts: sum(accepted_counts) / sum(proposed_counts).
The signature is acceptance_rate(accepted_counts, proposed_counts). Return a float between 0 and 1.
Hint
Pool all rounds by summing accepted and proposed tokens separately.
Test cases
case 1
in: [[8,6],[10,10]]
expected: 0.7
case 2
in: [[0],[5]]
expected: 0
case 3
in: [[5],[5]]
expected: 1
case 4
in: [[3,3,3],[4,4,4]]
expected: 0.75
Starter codePython
def acceptance_rate(accepted_counts, proposed_counts):
# Your code here
pass4 test cases · run your code against them in the editor