Search, Reflection, and Test-Time Compute › Worked Example

Michael BrenndoerferNovember 29, 20263 min read
Language AI HandbookAll chapters
Part 40 of 67Reasoning Post-Training and Verifiable Rewards
Chapter 304Search, Reflection, and Test-Time Compute › Worked Example
Reading section 9 of 14 · Worked Example · 3 minSection 9 of 14 · 3 min

Section 9 of 14 · 3 min read

Reading settings

Definitions

Choose how many terms have tooltips.

Article links

Make inline references clickable

Notes & comments

Start with four problems to see how the coverage ceiling and the accuracy of two selection rules differ before we compare them on a larger simulated suite.

Take four problems with per-draw success probabilities p=0.9, 0.6, 0.3, 0.1p = 0.9,\, 0.6,\, 0.3,\, 0.1. For each problem, draw N=5N = 5 times independently from its fixed distribution.

The coverage ceiling, 1−(1−p)51 - (1-p)^5, is:

Coverage ceiling across four problems with five draws each.
Problempppass@5 =1−(1−p)5= 1-(1-p)^5
A0.90.99999
B0.60.98976
C0.30.83193
D0.10.40951
Mean0.4750.80780

A single sample averages 0.475, and an oracle selector over five samples averages 0.808. The number of generations goes up by a factor of five. The relative improvement in the coverage ceiling is

0.808−0.4750.475≈0.70,\frac{0.808 - 0.475}{0.475} \approx 0.70,

where:

  • 0.4750.475: the mean per-sample accuracy, the average of pp across the four problems
  • 0.8080.808: the mean coverage ceiling, the average of 1−(1−p)51-(1-p)^5 across the four problems
  • 0.700.70: the relative improvement of the ceiling over the single-sample baseline

Now apply two selection rules to the five-draw pools.

An uninformative verifier. A random ranking gives the same expected accuracy as one draw, which is pp on each problem and 0.475 averaged over the suite.

Plurality voting with ten choices and uniform distractors. Exhaustively weighting the five-draw sequences with uniform tie-breaking gives accuracies of about 0.998, 0.883, 0.455, and 0.100 on A through D. The mean is 0.609, between the single-draw baseline and the oracle ceiling. On D all ten labels are equally likely, so the vote still has 0.100 expected accuracy.

The worked example assigns an equal chance to every tied leader. Label zero represents the truth only for enumeration. When zero ties with other leaders, the contribution is one divided by the number of leaders. The simulation later uses a lowest-label tie rule with randomly assigned true labels.

PythonIn [7]
CollapseExpand
from itertools import product
from math import fsum

example_choices = 10
example_draws = 5
vote_weight_by_correct_count = [0.0] * (example_draws + 1)
for draw in product(range(example_choices), repeat=example_draws):
    counts = [draw.count(label) for label in range(example_choices)]
    correct_count = counts[0]
    maximum = max(counts)
    if correct_count == maximum:
        vote_weight_by_correct_count[correct_count] += 1 / counts.count(maximum)


def exact_example_vote_accuracy(p):
    wrong_label_p = (1 - p) / (example_choices - 1)
    return fsum(
        weight * p**count * wrong_label_p ** (example_draws - count)
        for count, weight in enumerate(vote_weight_by_correct_count)
    )


example_accuracy = [
    exact_example_vote_accuracy(p) for p in (0.9, 0.6, 0.3, 0.1)
]
print(
    "Five-draw plurality accuracy (A to D):",
    ", ".join(f"{a:.3f}" for a in example_accuracy),
)
print(f"Mean: {fsum(example_accuracy) / len(example_accuracy):.3f}")
ConsoleOut [7]
CollapseExpand
Five-draw plurality accuracy (A to D): 0.998, 0.883, 0.455, 0.100
Mean: 0.609

Allocation. Uniform N=5N=5 costs 20 samples. The next-draw coverage gains p(1−p)5p(1-p)^5 are about 0.0000090.000009, 0.0061440.006144, 0.0504210.050421, and 0.0590490.059049 on A through D. If the per-task success probabilities were known and the objective were oracle coverage, a sixth draw would buy the most on D.

Comments

Add to the conversation

A question, a correction, or an example from your own work.

No comments yet. Be the first to share your thoughts!

Newsletter

Stay up to date

Get new articles, book updates, and notes on AI and technology.

Unsubscribe at any time. Privacy policy