The Commonplace
Home Papers Evidence Explore Trends Syntheses Digests References Docs 🎲 Workforce Futures
← Papers
Direction, evidence grade, and study type are AI-generated labels (gpt-5-mini), not human-verified. Syntheses are LLM-written. "Tensions" are machine-detected candidates, not confirmed contradictions. A research-acceleration tool, not peer review. How this is built →

Stopping rules that balance expected quality gains against per-call costs can make self-refinement far more cost-efficient: threshold policies derived from an optimal-stopping formulation outperform heuristic stopping on a 50-task coding benchmark across three frontier models, reducing API expenditure while preserving code quality.

Optimal Stopping of Self-Refining Foundation Models
Kim Hammar, Tansu Alpcan, Emil C. Lupu · August 11, 2026
arxiv theoretical medium evidence 7/10 relevance Full text usable extracted full text Source PDF

Structured author observations

Linked only from stored provider relations; the raw author line above is never matched by name.

Arxiv

Latest observation:

  1. Kim Hammar unresolved corpus identity
  2. Tansu Alpcan unresolved corpus identity
  3. Emil C. Lupu unresolved corpus identity

Semantic Scholar

Latest observation:

  1. Kim Hammar provider ID
  2. Tansu Alpcan provider ID
  3. Emil C. Lupu provider ID
The paper frames self-refinement of foundation models as an optimal stopping problem, proves threshold-based optimal policies under empirically identified dynamics, and shows these policies yield better cost-efficiency than heuristic stopping on a coding benchmark across three models.

Citation observations

Cumulative provider counts captured on specific dates; providers are never combined.

Foundation models can improve their outputs through a self-refinement process driven by external feedback. In this process, the model is embedded in an iterative loop where it generates outputs, receives feedback from verifiers, and refines its responses through in-context learning. Following a novel approach, we formalize this process as an optimal stopping problem where the number of refinement iterations is decided based on expected improvement relative to cost. We derive optimal stopping policies and show that they can be efficiently computed through stochastic approximation. To evaluate our approach experimentally, we apply it to a coding benchmark for foundation models. The empirical results show that our stopping policies are significantly more cost-efficient than stopping policies proposed in prior work.

Summary

Main Finding

Self-refinement (iterative generate → verify → revise) for foundation models can be framed and solved as a finite-horizon optimal stopping problem. Under empirically identified dynamics for code-generation tasks, the optimal policy has a simple threshold structure (stop when the current score exceeds a stage-dependent threshold). These policies can be computed efficiently (via dynamic programming/stochastic approximation) and, on a coding benchmark, yield substantially better cost–quality trade-offs than previously used heuristic stopping rules.

Key Points

  • Problem formulation

    • Each refinement iteration incurs cost c > 0 and produces a new quality score x ∈ [0,1].
    • Objective: maximize expected payoff E[g(x_τ) − c τ] where τ is the stopping time and g is a payoff (in experiments g(x) = β x).
    • Dynamics modeled as x_{k+1} = f(x_k, w_k); the process is Markovian and runs for at most N iterations.
  • Theoretical results

    • Bellman recursion: V_k(x) = max{ g(x), −c + E[V_{k+1}(f(x,w))] }.
    • Under empirically observed structure (f nondecreasing in x; diminishing returns: f(x,w) − x nonincreasing in x), the optimal value V_k is nondecreasing and V_k − g is nonincreasing.
    • Consequently, there exists an optimal threshold policy: at stage k stop iff x ≥ α_k, for thresholds α_0,...,α_{N−1}.
    • Thresholds can be computed efficiently via dynamic programming and stochastic approximation.
  • Empirical observations guiding theory

    • Using a code-optimization task, all three tested models show most improvement in the first 3–4 refinement iterations and then diminishing returns.
    • Token usage and monetary cost grow approximately linearly with iterations, creating a clear trade-off.

Data & Methods

  • Use case and metric

    • Task: code optimization (EFFIBENCH). Candidate score \tilde x ∈ [0,1] combines correctness, execution time and memory (tests failing ⇒ 0; otherwise normalized execution-time/memory metric).
    • State x_k = best candidate score so far (x_k = max{x_{k−1}, \tilde x_k}).
  • Models and experimental setup

    • Models: HAIKU 4.5, GEMINI FLASH-LITE 3.1, GPT CODEX MINI 5.1.
    • Runs: self-refinement loop for N = 10 iterations, across 50 tasks per model.
    • Continuation cost c set to empirical average per-iteration monetary cost (table in paper; e.g., HAIKU 4.5: $0.01/iter; costs computed from per-token charges as of 2026-03-17).
  • System identification

    • Transition model: x_{k+1} = min{1, max{x_k, q(x_k) + w_k}}; w_k Gaussian noise.
    • q(·) estimated by Gaussian Process regression (mean m(x)=x, Matérn 5/2 covariance), yielding posterior mean \tilde q(x) and noise variance σ^2.
    • Two empirical structural observations from GP posterior: (1) monotonicity (q nondecreasing → f nondecreasing), (2) diminishing returns (\tilde q(x) − x nonincreasing).
  • Optimization/Computation

    • Standard dynamic programming / Bellman recursion for finite horizon.
    • Use of stochastic approximation to compute thresholds efficiently in practice.
    • Implementation of method published by authors (reference [13] in paper).
  • Empirical results

    • The stopping policies derived from the optimal stopping formulation outperform heuristic stopping rules in cost-efficiency on the code benchmark: similar or better final-quality per dollar spent, due to early stopping when marginal improvement falls below cost.
    • Most model improvement occurs early; thus optimal stopping tends to accept after a small number of iterations unless low initial quality justifies more attempts.

Implications for AI Economics

  • Quantifying per-invocation value: The formulation makes explicit the marginal-value calculus for each API/model invocation (expected quality gain vs cost), enabling rational decisions about how many refinement calls to make.
  • Pricing and billing design: Providers and consumers can use such stopping rules to estimate willingness-to-pay per call, set tiered pricing, or design metered products that align payments with expected marginal benefit.
  • Resource allocation and throughput: In production systems, stopping policies reduce wasted compute/time by terminating refinement when expected gain < cost, improving overall system throughput and reducing operational spend.
  • Contracting and SLAs: The framework supplies a transparent criterion (threshold α_k tied to β, c, and dynamics) for specifying SLAs or pay-per-improvement contracts (e.g., pay until quality threshold or marginal benefit floor).
  • Product design and UX: Systems that offer iterative refinement (code assistants, scientific assistants) can expose controls or defaults that reflect optimal stopping thresholds tailored to customer value-weights β.
  • Calibration of verifier investment: The model depends on the verifier/score; investing in better verification (more accurate scores) could improve thresholding decisions and overall cost-effectiveness — a trade-off analyzable in the same framework.

Caveats and extensions - Assumptions: linear payoff g(x)=βx, constant per-iteration cost c, finite horizon, and Markovian score dynamics. Real applications may require non-linear utilities, variable cost (e.g., varying token counts), multi-criteria payoffs, or partial observability. - Estimation errors: GP-based dynamics are approximations; misestimation of q or noise can shift thresholds. Robust or online/adaptive stopping policies could mitigate this. - Multi-agent or strategic settings: If multiple agents share model resources or if providers alter pricing dynamically, game-theoretic extensions will be needed. - Broader tasks and verifiers: Results come from a code benchmark; other modalities (dialogue, design, planning) with different verifier structures may exhibit different dynamics and thresholds.

Overall, the paper provides a principled decision-theoretic approach to when to stop self-refinement loops, with theoretical guarantees under empirically justified structural assumptions and practical gains in monetary efficiency on coding tasks.

Assessment

Paper Typetheoretical Evidence Strengthmedium — The paper provides formal theoretical results (existence and threshold structure of optimal policies) and empirical validation showing improved cost-efficiency on a coding benchmark across three LLMs. However, the experimental evaluation is limited in scope (50 tasks, single benchmark, N=10 iterations, three models), uses a hand-chosen linear payoff weight β rather than estimating use-case valuations, and relies on per-token cost assumptions and automated test-suite feedback that may not generalize to many real-world settings. Methods Rigormedium — The theoretical component is rigorous: clear optimal stopping formulation, proofs of structural properties, and derivation of threshold policies. The empirical system identification uses standard, appropriate methods (Gaussian process regression) and reports uncertainty. However, the experimental design is modest in scale, payoff calibration is ad hoc, and only one task domain (code optimization with automated verifiers) is tested, limiting robustness and external validity. SampleEmpirical data come from running self-refinement loops on the EFFIBENCH coding benchmark: three foundation models (HAIKU 4.5, GEMINI FLASH-LITE 3.1, GPT CODEX MINI 5.1), 50 programming tasks, up to N=10 refinement iterations per task; per-iteration metrics recorded include test-pass status, execution time, memory profile (aggregated into a 0–1 candidate score), token consumption (input/output/total), per-iteration wall-clock time, and computed monetary cost using per-token charges as of March 17, 2026. Themesproductivity adoption IdentificationNo causal identification; the paper casts self-refinement as an optimal stopping problem and identifies model components by system identification: estimates the transition dynamics f via Gaussian process regression on observed score trajectories from a coding benchmark (EFFIBENCH), sets continuation cost c as average per-iteration monetary cost computed from per-token charges, and specifies payoff g(x)=βx (β chosen as a configuration parameter, not estimated). GeneralizabilityOnly evaluated on a single domain (code optimization) with automated test-suite feedback; other tasks (e.g., open-ended text, design, research) may have different score dynamics., Small sample size (50 tasks) and only three specific models — results may not hold across broader model families or larger tasks sets., Payoff function uses a linear weighting β chosen by configuration rather than estimated from real user valuation; different user preferences could change optimal thresholds., Continuation cost modeled as constant per-iteration monetary cost; in practice costs may vary with tokens, latency, or model scaling., Verifier assumed to provide informative scalar scores; human feedback or noisier verifiers could alter dynamics and identifiability., GP regression assumptions (smoothness, Gaussian noise) and clipping approximations may mischaracterize transition dynamics in other settings.

Claims (8)

ClaimDirectionOutcomeConfidence & EvidenceDetails
The proposed optimal stopping policies are significantly more cost-efficient than stopping policies proposed in prior work. Organizational Efficiency positive Cost-efficiency of stopping policies, balancing output quality against refinement cost.
Reading fidelity high
Study strength medium
n=50
0.12
Self-refinement improves code efficiency for all three evaluated foundation models, but the improvements exhibit diminishing returns. Output Quality positive Code efficiency, reflected in execution time, memory usage, and the aggregated candidate score.
Reading fidelity high
Study strength medium
n=150
0.12
Most of the improvement from self-refinement occurs within the first three to four iterations. Output Quality positive Improvement in code performance during successive refinement iterations.
Reading fidelity high
Study strength medium
n=150
Most improvement within 3–4 iterations
0.12
Token consumption and monetary refinement cost grow approximately linearly with the number of refinement iterations. Organizational Efficiency negative Token consumption and monetary cost of self-refinement.
Reading fidelity high
Study strength medium
n=150
Approximately linear growth with refinement iterations
0.12
The estimated refinement dynamics show diminishing returns: lower-quality states tend to obtain larger gains from refinement, while gains become smaller at higher-quality states. Output Quality positive Expected improvement in the retained quality score from another refinement iteration.
Reading fidelity high
Study strength medium
n=150
0.12
Under the paper's modeled dynamics and linear payoff function, an optimal stopping policy can be chosen with a score threshold at each stage: stop when the current score is at least the stage-specific threshold and continue otherwise. Task Allocation positive Optimal allocation of refinement versus stopping decisions based on the current quality score.
Reading fidelity high
Study strength high
not reported
0.2
The optimal stopping policy is obtained by comparing the payoff from stopping with the expected value of continuing after paying the refinement cost. Task Allocation positive Expected net payoff from stopping or continuing refinement.
Reading fidelity high
Study strength high
not reported
0.2
The proposed stopping policies can be computed efficiently through stochastic approximation. Organizational Efficiency positive Computational efficiency of calculating stopping policies.
Reading fidelity high
Study strength medium
not reported
0.12

Notes