Module contents
Lesson 8 of 31Advanced 100 min

Inference scaling laws and compute-optimal test-time allocation

Fit empirical inference-time scaling laws, account for training and inference FLOPs together, optimize compute allocation across task difficulty, and experiment with explicit reasoning-length control through budget forcing in a small reasoning model.

After this lesson you can

  • Fit power laws to coverage and accuracy versus inference compute.
  • Compare a larger model with few samples to a smaller model with many at equal FLOPs.
  • Derive optimal sample allocation across problem difficulty by equalizing marginal gains.
  • Distinguish parallel from sequential scaling and measure when each is preferable.
  • Apply budget forcing to a local reasoning model and measure accuracy against thinking tokens.

Before you start

The budget has two dimensions

A small model can attempt a problem many times while a large one can answer only a few. Which combination produces more correct answers per unit of compute? The answer changes with difficulty, selection method, output length, and number of future queries. An inference scaling law summarizes an empirical cost–performance relationship over a measured range; it does not guarantee that a formula holds outside that range.

Coverage asks whether any sample is correct and can increase without the system knowing how to identify it. Brown and colleagues observed coverage scaling from repeated samples across tasks and models, while selection may plateau. Wu and colleagues compare strategies and sizes. A law fitted to oracle coverage is not automatically a law of deployable accuracy.

Snell and colleagues studied search guided by a process evaluator and adaptive changes to the answer distribution. They found strategies’ relative usefulness varied with question difficulty; in their conditions allocating compute by difficulty improved efficiency over a best-of-N baseline. That comparison depends on model, evaluator, and tasks, and does not guarantee adaptive allocation wins in every deployment.

A common unit and its limits

As a first-order approximation for a dense transformer, a forward pass costs around 2N2N FLOPs per token with NN active parameters, plus attention and other terms. For kk samples of LL output tokens, this gives 2NkL2NkL. It is an estimate, not a direct measurement: prefill processes the prompt, attention depends on context length, the evaluator consumes resources too, and KV cache can share prefixes. With quantization, logical FLOPs alone do not describe integer operations, bandwidth, or wall time.

For example, 16 samples of 500 tokens with 1.5 billion parameters give approximately 24×101224\times10^{12} decoding FLOPs; two 500-token samples with 7 billion give 14×101214\times10^{12}. The first configuration uses more compute under this model despite having fewer parameters. We do not know which is more accurate without measuring. Batching and GPU occupancy may reverse the latency comparison.

A complete comparison adds each prompt’s prefill and selection work. If 16 answers share a cached prefix, counting prefill 16 times overestimates that work; if generated in separate calls without cache, omitting it underestimates it. With four-bit weight quantization, 2N2N remains an approximation of logical computation, not a direct hardware-instruction measurement. Present estimated FLOPs and wall seconds as distinct axes along with backend, quantization, batching, cache, and concurrency. Wall time under shared load is not exclusive GPU time.

Even with the same number of attempts, two questions differ: whether any answer is correct and whether the procedure can choose it. The first is coverage with an oracle that knows the reference; the second requires voting, a learned evaluator, or an executable verifier available at use time. If the task permits an exact verifier, include and charge its cost. For free text or poorly extracted answers, coverage on the measured set may be optimistic relative to the deployed system.

When plotting a cost–quality frontier, a configuration is dominated in the observed set if another costs no more and reaches at least the same quality, with one strict inequality. Nondominated configurations form the observed frontier; an untested configuration might improve it. Uncertainty matters too: two points with small differences and shared samples may change order across resamples. Do not claim statistical dominance merely because one mean is slightly higher.

InteractiveModel and sample count under budget

There are no points for this group.

14.00
Problems
Selector
Best point within budgetnone
Accuracyno data
Estimated FLOPs / problemno data
Compare voting and oracle coverage on the same problems. Circles are measured configurations and color interpolates a descriptive fit within the observed range.

In this figure’s subgroups, a problem is labeled easy if at least two of the 0.5B model’s first four answers match the reference; 52 satisfy this and 148 do not. The four probing answers are not reused to evaluate 0.5B and their estimated cost is added to all three alternatives. Classification depends on the model and requires knowing the correct answer: it is an exploratory split, not a difficulty detector automatically available in production.

Fixed cost changes the decision when a system is used repeatedly. Suppose system B requires TT additional training units relative to A, but saves cA−cB>0c_A-c_B>0 units per query. Ignoring other costs, B pays back that expenditure after T/(cA−cB)T/(c_A-c_B) queries. If B costs more per query, no such break-even point exists under these assumptions. The formula accepts only quantities in the same unit and omits storage, latency, and quality changes; present those factors alongside the threshold, not mixed into the division.

Fit without extrapolating

A useful family for coverage is

c(k)=1−exp⁡(−akb),a,b>0.c(k)=1-\exp(-a k^b),\qquad a,b>0.

This is a power law for −log⁡(1−c(k))-\log(1-c(k)), not coverage directly. Its limit is one, so it does not represent a population with a permanently unsolvable fraction under the policy. It can also fit a finite range poorly: inspect residuals and bands, and do not extrapolate without validation. If the verifier has false positives or a ceiling, selected accuracy may saturate before this coverage curve.

The cell uses seven pass points from lesson 3 curves: 200 GSM8K problems and 64 samples per problem. Original extraction failed on many outputs, so the curve measures extracted-answer coverage, not every mathematically correct answer. Even when it returns a value, truncated output may contain only a fragment rather than a complete final answer. The fit is not uncertainty-weighted, and observations at different kk share problems and samples, so they are not seven independent points.

[ ]Fit a law to observed coverageBrowser
import numpy as np
from scipy.optimize import curve_fit

k=np.array([1,2,4,8,16,32,64],dtype=float)
coverage=np.array([.228515625,.3694345238095238,.526905257674196,
                   .6623699552429375,.7618494166382258,.8293748202971725,.87])
def family(x,a,b): return 1-np.exp(-a*x**b)
params,_=curve_fit(family,k,coverage,p0=[.3,.5],bounds=(0,np.inf))
residual=coverage-family(k,*params)
print('a, b:',params.round(6))
print('residuos:',residual.round(4))
print('RMSE:',round(float(np.sqrt(np.mean(residual**2))),4))

The fit leaves systematic residuals, not just small noise: the chosen curve does not perfectly capture observed heterogeneity. A practical answer should compare models and strategies on held-out problems, not choose the exponent that looks best on the same set.

For the accuracy map, the descriptive fit uses another parameterization: logit⁡(p)=β0+β1log⁡(N/109)+β2log⁡k+β3log⁡(N/109)log⁡k\operatorname{logit}(p)=\beta_0+\beta_1\log(N/10^9)+\beta_2\log k+\beta_3\log(N/10^9)\log k. At fixed size, odds p/(1−p)p/(1-p) are proportional to a power of kk whose exponent depends on NN. If sample length were also constant, kk would be proportional to that model’s generation compute; in the data lengths vary and the FLOPs axis uses actually recorded tokens. The fit does not guarantee a power describes points outside its range, and values for different kk share problems and sample prefixes.

Heterogeneous difficulty can itself produce curvature without policy changes. With two problems having success probabilities 0.9 and 0.1, two independent attempts give coverages 0.99 and 0.19: the mean is 0.59. Replacing each probability first by their mean 0.5 gives 0.75. The second figure describes another population with two problems of probability 0.5. In general, averaging probabilities and then applying the coverage formula is not equivalent to averaging per-problem coverages.

Allocate attempts by problem

Compute-optimal inference allocation chooses nin_i to maximize ∑ifi(ni)\sum_i f_i(n_i) subject to ∑ini≤B\sum_i n_i\le B. If attempts for problem ii have fixed probability pip_i and are independent, coverage is fi(n)=1−(1−pi)nf_i(n)=1-(1-p_i)^n and its marginal gain from one more sample is

Δi(n)=fi(n+1)−fi(n)=pi(1−pi)n.\Delta_i(n)=f_i(n+1)-f_i(n)=p_i(1-p_i)^n.

Each gain sequence decreases. The greedy rule takes the largest available gain at each step: spend the next sample where it contributes most expected coverage. An easy problem may receive the first sample then lose priority; one with very small probability may receive few or none because cost is high relative to expected gain. Results depend on knowing or estimating pip_i.

Proof

Write each value as fi(ni)=fi(0)+∑j=0ni−1Δi(j)f_i(n_i)=f_i(0)+\sum_{j=0}^{n_i-1}\Delta_i(j). An allocation selects a prefix of each problem’s gain list. The greedy rule repeatedly chooses the largest still-available gain. By monotonicity no later unavailable gain can exceed its available predecessor. Thus at each step the chosen gain is among the largest remaining across all lists; ties are ordered to preserve prefixes. The sum of the BB largest gains bounds any allocation and the rule attains that bound. With different sample costs or increasing gains this argument no longer holds.

∎
InteractiveThe next sample goes where it helps most
  • Manual
  • Greedy
  • Uniform

Hypothetical model with known independent probabilities; real use requires estimating them and paying the pilot cost. Uniform allocation assigns the remainder in problem order.

12
1
2
3
4
2
Manual samples / budget12 / 12
Mean manual coverage56.6 %
Mean greedy coverage59.8 %
Mean uniform coverage53.5 %
Probabilities are hypothetical and known. Compare the five allocations with greedy and uniform allocation when they total the same budget.

In the continuous relaxation with differentiable concave functions, Karush–Kuhn–Tucker conditions equate marginal derivatives to a common multiplier λ\lambda for interior allocations. At zero, a derivative less than or equal to λ\lambda does not justify investment. The discrete case compares finite increments, not derivatives; the price of probing difficulty comes from the same budget.

With known probabilities, the first sample for a problem with p=0.9p=0.9 contributes 0.9, but the second contributes 0.9(1−0.9)=0.090.9(1-0.9)=0.09. A problem with p=0.3p=0.3 offers 0.3 on its first sample and may be preferable after trying the easy one once. If p=0.01p=0.01, its first gain is only 0.01, although it may receive attempts under a very large budget. This comparison maximizes expected solved problems; if a particular problem has special value or different cost, change the objective or algorithm.

In practice pip_i is unknown. Under a Beta–Bernoulli model with prior pi∼Beta(a,b)p_i\sim\mathrm{Beta}(a,b), observing ss successes and ff independent failures gives posterior Beta(a+s,b+f)\mathrm{Beta}(a+s,b+f). The posterior mean smooths extreme rates: with a uniform prior and one failure, the estimate is 1/31/3, not zero. The next decision must include uncertainty and the cost of obtaining that failure. This model is a useful assumption, not a guarantee: correlated answers, prompt changes, and extraction errors invalidate its simple binomial interpretation.

Probing has value when it changes a later decision enough to offset its cost. For example, with eight total attempts per problem, using four to estimate difficulty leaves four for evaluation or exploitation. Comparing that strategy with another that has eight additional attempts would artificially favor the probing method. If the same successes estimate difficulty and declare final performance, selection can also overfit sample noise. A fixed probe/evaluation split makes this issue visible, although splitting reduces information available in each phase.

Coverage and selection can differ greatly. If each candidate independently succeeds with probability 0.2, eight candidates offer oracle coverage 1−0.88≈0.83221-0.8^8\approx0.8322. Randomly choosing one keeps accuracy at 0.2; the difference is potential headroom for a perfect selector, not achieved performance. Conversely, a verifier mistakenly accepting each incorrect candidate with probability 0.01 has probability 1−0.9964≈0.47441-0.99^{64}\approx0.4744 of accepting at least one among 64 independent incorrect candidates. More attempts can increase opportunities both for success and mistaken selection.

These calculations use independence to illustrate the mechanism. In a real run candidates share model and question, and their errors may correlate; a verifier may systematically fail on the same answer type. The experiment should therefore record candidates and scores as well as the final decision. Examining first success, chosen selection, and abstentions shows whether coverage gains reached the output a person would receive.

Lab: pay for probing

We compare two allocations using the same 12,800 samples from lesson 3. To keep the cell offline, it includes a compressed representation of binary labels ordered by problem and sample number: one means the extracted answer matches the reference; zero includes errors and abstentions. The SHA256 of 1600 packed bytes is c8868329c34833aa679c432542eacff89734daced928f32de7f46c0c467c1939. These bits can be reconstructed from the original file; they are not human reasoning labels.

[ ]Recover labels from the previous runBrowser
import base64, zlib, hashlib
packed=base64.b64decode('eNplVHtQVFUY/87ZA1x3t+nsQrI6QGdxwauYLQ/fmgdccWVIAUmwdFopsNFIE0HRCS+7ayJaLURE6sjqYDGpiGT5SJ1F0Zbs6ayjOaSYhto4DtP0R2Njdu7i4qNv5p75zjn3e/1+5/vAAWGK28Qr4+bJumlZJQDAxAedTkiHDOoVKjZJ+cDSgKvnif7Vi1ehPPX8MclldblMSyNshKaP9hVwkAhQxuB/whAAYtbBvYIBgQIeCNfr7JvbX1Ou2zc5o5ueNFPAAkAANpePfrclRR9VGH8yclzLOKBcZ2j0xOm8SAJpE7LYEQMtJqZ7ZtBwUt2vmIVrYzsvj3g78H3jJBJ0ZhdFAdJxwO7UsIhdjp5FSyBOLa8RX72UdK39o8h3lsxbZmgaUj/eiKPh7+FrbeLSLQEFJ1kK0hynJ5TXrTppOW7OXwFaAEl4HbpvwqExJd15oG6FUFAIJArFKcq2AlIGzDTCXVDJ3LH0zP5da9ZUJ79oPKaZLbdZ4ydDTTILJkpUeLgAXrXCTApgsBoFprhe0/rDsFUV6EBpkXfC9KSUhDBOGFZ/silEmqTRsqffMqzyHEpyqhmojFbGnv3qvX9v3A/l/QiBVF1GxBDYQwpivIBrCRaRwwRPFuDe/N6a+Q0pbdP7/in+PZB2F4x1Ervuq5YpS5U4t5zfmFQ1quzqqzdjCnU3bVPy/UoU/lIvilMe5w8zJDuxMgALRuxW2RXfxchv77dMlOxbtnbl9dxZ4b+7beFzZaWRr7RYmvRplzou36VXesJM1MsvgnR7Mn5jw6eooaTqaK+U/YI+5HfRyECf73Qno8A5xYA9mIsAPrl73awA+mxfbjjNFyF3ZQVzEJqkAMpgSEk4+OuplNSOIl9T4h/DDiY6BEYM8M7BfDvl1onzZClHqDKHGjajIlke0dLNgiirgmgQuHOGmQ0jWxccw0famuv6b50QgIOViyctYikiIlmoLyJLf9OM2Lk7GtIic17PadCYs86YQnFm20nmGoJ8ZaPKoWNbyUyQXEAljJ94/uTUnxXHK/cf2ZuOJUrIM4Whi2K09iRxnS7FrfBSd5NvsK/CmRb0wg0mggkGVAnP8PA6vLP087+ujZ3SfNvd0TXn+diNRUT0DTgfkuVIze7q/OLjp+79eGH9hcD6e1Bi4t70eMMwcPu3gbVySG85HG0sbqEaGxIFmt1zV9saW4fXsFS3AcAIMAQUTgl6v3PaebrPfrPDi5FvKFdxpOI58/qx2W0/VVXEheLpHKI4vUqNOm/UmeHl4AKOHrR9W35uSkF9TUrzybXb0+ZrzOohDxmL1Jf3V53YcW358cECLKE5A+LhqIoWTGigF1X55PiMBSvHOmLivVICNSySAWN7uD2d7XXBJC1Ez30Ec586dQBxMJoJ44zXF2n1/m8M35UdnpDboxG4KtTBn9XGFjSvGJ+9MpYXx7t2b88wGqKUXiPTWLpsBRFmQ8jZYk872Uo0U9VMLI+wG008LkxZZmifk1xtWGiTUd8Hnb2mDxdcRgeGW6NIdaGSJQMcltMHBphYSRAhFLK7Xxe57NzZX+48hKZXEUPG5qSAcMAENQoLzoGD63e/mXfj67OpkifBFOXfgokkuZyt7gdNCmM0Tdh5tMvct//l/hOzft4z8kZerX/dyqkJejAKNLJ5rR1QpjkqNDv+A3wRaM0=')
raw=zlib.decompress(packed)
assert len(raw)==1600 and hashlib.sha256(raw).hexdigest()=='c8868329c34833aa679c432542eacff89734daced928f32de7f46c0c467c1939'
bits=[(byte>>j)&1 for byte in raw for j in range(8)]
truth=[bits[i:i+64] for i in range(0,len(bits),64)]
print('problemas:',len(truth),'aciertos extraídos:',sum(bits))

Allocate four probe samples per problem and pay for their 800 samples. With those indicators, use the posterior mean of a Beta(1,1), (s+1)/6(s+1)/6, as an estimate of pip_i. Total budget is 1600 samples, leaving 800 for the result. Both strategies pay for probing and evaluate only later samples, not those used to estimate difficulty. Uniform allocation uses four evaluation samples per problem; greedy allocation uses the estimated Bernoulli model and cannot allocate more than 60 evaluation samples to one problem.

[ ]Allocation and held-out evaluationBrowser
from random import Random
pilot=[sum(row[:4]) for row in truth]
p=[(s+1)/6 for s in pilot]
def greedy_probabilities(probs,budget,cap=60):
    n=[0]*len(probs)
    for _ in range(budget):
        i=max(range(len(probs)),key=lambda j:probs[j]*(1-probs[j])**n[j] if n[j]<cap else -1)
        n[i]+=1
    return n
greedy=greedy_probabilities(p,800)
uniform=[4]*200
def observed(allocation):
    return [int(any(row[4:4+n])) for row,n in zip(truth,allocation)]
g,u=observed(greedy),observed(uniform)
print('sondeo:',4*len(truth),'evaluación voraz y uniforme:',sum(greedy),sum(uniform))
print('cobertura observada voraz y uniforme:',sum(g),sum(u),'de',len(truth))
r=Random(25)
diff=sorted(sum(g[i]-u[i] for i in (r.randrange(len(g)) for _ in g))/len(g) for _ in range(2000))
print('diferencia pareada e intervalo bootstrap:',(sum(g)-sum(u))/len(g),diff[49],diff[1949])

In this run both allocations cover 109 of 200 problems and observed difference is zero. The paired interval resamples these problems; it does not prove the rules equivalent. Estimation from only four probes is noisy, a constant-probability model is imposed, and the first GSM8K problems are not a random sample. Reaching a correct answer is also oracle coverage: a real selector must recognize it. In deployment without a known true answer, those probe labels cannot be obtained directly without a reliable verifier.

Parallel, sequential, and training

Parallel scaling generates independent or approximately independent candidates. Sequential scaling uses an earlier answer or critique to decide the next step: revision, search, or longer thought. A sequence can correct an error but also repeat it or add errors and correlation. Measure samples, tokens per sample, evaluation tokens, and latency separately.

Budget forcing manipulates when thought ends or extends generation. s1 studies both closing thought and adding “Wait” when it tries to end. A cap can save tokens and cut off a necessary derivation; forcing more text can correct or worsen an answer. An isolated result does not establish a general causal relationship: assign conditions by problem, retain traces, and measure the same test in each condition.

InteractiveChange the thinking budget

Loading data.

Abstentions count in the denominator of ‘Accuracy / all’ and are excluded from ‘Accuracy / extracted’. The first interval covers the rate over all questions; the difference interval resamples paired questions and is expressed in percentage points. A requested wait is inserted only if natural closure appears first.

Intervention
1
Accuracy / allno data
Accuracy / extractedno data
95% intervalno data
Paired difference vs. 1024no data
Thinking tokensno data
Not extractedno data
Compare five conditions on the same MATH-500 questions; traces are distinct generations and intervals resample by problem.

In the local run of three caps, the comparator observed 52, 77, and 88 correct answers on the same 200 questions for 256, 512, and 1024 tokens, with 137, 118, and 100 abstentions respectively. Against 1024, paired difference across all questions was −18.0 percentage points for 256 (95% bootstrap interval [−24.5, −12.0]) and −5.5 for 512 ([−10.5, −0.5]). Resampling uses 2000 replicates and keeps conditions together by question. These are one generation per condition and problem: they include extractable-format effects and do not by themselves identify improved reasoning. An unboxed answer may contain a useful result while remaining an abstention for this comparator. The 600 records and protocol permit inspection.

In 16 of the first 200 questions, the source statement includes [asy] code for a diagram. The model received that code as text without a rendered image; some questions may therefore require visual information that this configuration does not present in the same way. Results describe this text input and these 200 rows, not a multimodal measurement of the complete set.

Truncation can also cause incorrect extraction even when earlier text contains the solution: on question 5 at cap 1024, the answer mentions “Evelyn,” but the final box is cut at \boxed{Evel and the comparator does not match it to the reference. The figure marks the truncated answer and describes extraction match, not human grading of the entire reasoning.

With one requested wait, 58 waits were inserted over 200 questions; with two, 103 were inserted in total: 47 questions received two, nine one, and 144 none. Extracted correct counts were 81 and 77, with 110 and 109 abstentions. Against the 1024 cap without wait, paired differences were −3.5 percentage points (95% bootstrap CI [−8.0, 1.0]) and −5.5 ([−10.5, −0.5]), respectively. This does not prove extending always hurts: the intervention acts only after natural closure, samples and format vary, and the comparator abstains on many answers. The 1000 complete traces include waits and recorded stop reasons.

An exploratory comparison between two short candidates and one extended candidate can use those same traces. If an oracle with the reference accepts either answer at caps 256 or 512, it covers 82 of 200 questions; one generation with a requested wait gets 81 right. The paired difference is +0.5 percentage points (95% bootstrap CI [−5.5, 6.5]). The two short attempts consume a mean of 1153.1 thinking and answer tokens in total versus 1086.0 in the wait condition; they also use two prompts versus one, and the latter adds 2.9 wait tokens on average. These are counts, not equal FLOPs or times: they omit repeated prefill and selection costs. Candidates share seeds and may correlate; the oracle uses the correct answer while the other condition has one answer. One cannot conclude here that a deployable strategy wins at equal cost. The reproducible analysis and result retain the comparison and its limits.

The training–inference compute tradeoff also depends on usage volume: expensive training is amortized over many queries, while expensive search is paid for each query. Jones observes a training/test compute tradeoff in AlphaZero and Hex; transferring its exponents to language models would require another measurement.

Local labs: budgets and sizes

The closing and extension experiment uses budget_forcing.py, or the batched vLLM generator, with the math comparator, record audit, and paired summary. Pin DeepSeek-R1-Distill-Qwen-1.5B to the script’s revision and the first 200 rows of MATH-500 to its declared revision. Five conditions comprise three thought caps and two extension requests; a wait is inserted only if the model tries to close early. Save trace, answer, and whether closure was forced. The batched backend uses segment seeds: do not assume bitwise reproduction of Transformers output.

python budget_forcing.py --model-path "$REASONER" --output budget_smoke --count 1
python budget_forcing.py --model-path "$REASONER" --output budget_run --count 200
python audit_budget.py --traces budget_run --data "$MATH500_JSONL" --output audit.json
python summarize_budget.py --traces budget_run --output budget_summary.json --count 200
python prepare_widget.py --traces budget_run --summary budget_summary.json --data "$MATH500_JSONL" --output budget-forcing.json --count 200

The figure packager checks identifier, reference, and level against the source file before adding statements; $MATH500_JSONL points to the pinned revision’s test.jsonl.

Evaluator math-verify attempts to extract and compare mathematical expressions. An unextracted answer is an abstention, not a diagnosis of incorrect reasoning. The summary shows correct answers across all questions and among extracted ones, with problem-level intervals and paired differences against cap 1024. On platforms where the parser’s internal timeout does not work, script configuration disables it: document that condition and inspect any comparison that does not finish.

In a paired comparison, for each problem ii define Di=Yi(c)−Yi(1024)D_i=Y_i^{(c)}-Y_i^{(1024)}, where each YY indicates an extracted success under its condition. The mean of DiD_i answers how much the measured rate changes on these same questions; resampling whole problems retains dependence between conditions. Running five conditions on 200 statements does not yield 1000 independent problems. Nor does this difference equal improved reasoning: a format change may alter which answers the extractor can interpret.

The denominator also changes the question. The rate over all questions counts abstentions as no observed success; the rate over extracted answers excludes those outputs and may favor a condition that makes only easy cases recognizable. Present both and the abstention fraction. If a wait adds text but the final answer does not change, consumed time and tokens still count; if the model does not try to close before the cap, the planned wait is never inserted. Thus actually inserted waits are recorded, not only requested ones.

For the size frontier, a maximum grid of 32, 10, and 2 samples was fixed before generation for Qwen2.5 0.5B, 1.5B, and 7B in GGUF, respectively. Approximation 2NkL2NkL puts maximum costs close when lengths are equal; FLOPs are then compared with effective lengths only in the mean budget range shared by all three. Voting between two distinct candidates breaks ties by choosing the first without consulting the reference. Best-of-two with an exact verifier knows the answer in this benchmark and is an oracle bound, not a selector available for every problem.

The vLLM generator produces the 0.5B model outputs; reuse_frontier_l03.py verifies the corpus and reevaluates already-generated 1.5B answers with extractor v2; the 7B server client reuses an already started llama.cpp CUDA instance. Transformers and llama-cpp-python implementations are also available for an alternative replication. The extractor, its dependency, and lesson 3 questions and traces are needed. The audit checks questions, extraction, tokens, and complete batches; frontier analysis compares voting and oracle coverage, reserves four small-model samples to estimate difficulty, and charges their cost. The descriptive fit declares range and dependence between points.

python generate_frontier_vllm.py --model-path "$SNAPSHOT_05" --samples muestras_200x64.jsonl.gz --output qwen05 --count 200 --n 32
python reuse_frontier_l03.py --model-path "$SNAPSHOT_15" --samples muestras_200x64.jsonl.gz --output qwen15
python generate_frontier_server.py --model-path "$GGUF_7B_FIRST_SHARD" --server-log "$SERVER_LOG" --samples muestras_200x64.jsonl.gz --output qwen7 --count 200 --n 2 --batch-rows 5
python audit_frontier.py --samples muestras_200x64.jsonl.gz --run qwen05=qwen05 --run qwen15=qwen15 --run qwen7=qwen7 --output audit_frontier.json
python frontier_analysis.py --run qwen05=qwen05 --run qwen15=qwen15 --run qwen7=qwen7 --grid qwen05=32 --grid qwen15=10 --grid qwen7=2 --pilot-model qwen05 --output frontier.json
python fit_frontier.py --frontier frontier.json --output frontier_fit.json
python export_frontier.py --run qwen05 --output frontier-qwen05.jsonl.gz

The 7B client runs against a previously started llama.cpp b9354 server with both shards and requires a log confirming 29 of 29 layers loaded on GPU. Each invocation writes at most five new problems and can repeat until all 200 are complete, yielding the server between batches. Detecting an available GPU does not prove the model loads or runs correctly: check the log and do not call a CPU run GPU time.

Times are retained at measured granularity. In inherited 1.5B traces, the only timing point is the full batch of 32 answers with additional log-probability computation; we do not divide that time to attribute it to the first ten. vLLM sums only full batches and the 7B server records each sequential call. Backends, batches, cache, and scoring tasks differ: the seconds plot does not isolate size effects. The fit is descriptive and the map interpolates only within each size’s observed range; it does not extrapolate to 32 samples from 7B.

The measured 0.5B outputs, 32 reanalyzed 1.5B answers per question, and two measured 7B answers include original manifests and timings; the packager preserves each campaign in compressed JSONL and the importer reconstructs files for audit. For example, python import_frontier.py --archive frontier-qwen05.jsonl.gz --output qwen05 prepares the folder used by analysis. Of 1.5B answers, the first ten per question form the FLOPs grid; all 32 are used together only at the timing point measured for that full batch.

Among 6400 outputs from 0.5B, 4067 were truncated and 4213 unextracted; these counts are not interchangeable. Among the first ten 1.5B outputs per question there were 995 abstentions in 2000 outputs. Figure coverage and voting therefore concern answers the extractor could interpret. Extraction failures and different backends limit interpretation of differences between sizes.

Among 400 attempts from 7B, 151 outputs were truncated and 146 unextracted. With a mean limit of approximately 5.50×10125.50\times10^{12} estimated FLOPs per problem, the measured points include 16 samples from 0.5B, five from 1.5B, and one from 7B. Voting accuracy was 43.5%, 61.0%, and 61.0%; estimated mean costs were 5.505.50, 5.075.07, and 4.96×10124.96\times10^{12} FLOPs respectively. Oracle coverage was 55.0%, 68.5%, and 61.0%. These costs are close under a common cap, not identical, and figures do not demonstrate a causal size difference: quantization, backend, batches, and extraction change. The comparison covers the first 200 GSM8K test problems, not a random sample.

Exercises

ProofWhy the largest increment wins
Prove: Prove greedy allocation is optimal for increasing discrete curves with non-increasing increments.
0
Each sample costs one and the budget permits B samples.

Step 1 of 3. How do you express the benefit of allocating n samples to problem i?

Numeric
Using only 2N FLOPs per generated token, how many trillions of FLOPs do 16 samples of 500 tokens cost with N=1.5 billion?
Numeric
For c(k)=1−exp(−0.3√k), how many additional integer samples are needed from the smallest k reaching 60% to the smallest k reaching 80%?
Code
Implement greedy_allocation(curves, budget). curves[i] is a list of values fᵢ(0), fᵢ(1), ... with non-negative non-increasing increments. Return integer allocations summing to budget. Each curve has finite capacity; reject negative budget or budget exceeding capacity. Break ties by smaller index.
def greedy_allocation(curves, budget):
  pass
Shift+Enter to run
Quiz
The first answer is usually nearly correct and a reliable critic can identify the error. What experiment is reasonable?
Key idea
Optimal budget depends on difficulty, strategy, and full cost; a coverage curve does not replace a selection measurement.