Manuscript Offprint

arXiv:2610.05701

Second-Order Problem Solving for Recursive Self-Improvement in Formal Verification

Yuxuan Jiang, Aditya Vempaty, Ashish Jagmohan

Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.

ABSTRACT

Recursive self-improvement (RSI) enables agents to iteratively optimize their workflows via execution feedback. However, standard RSI typically operates as a first-order optimizer: it repeatedly patches surface-level parameters in response to immediate failure symptoms, often leading to trial-and-error thrashing without resolving underlying mechanisms. To address this limitation, we introduce SO-RSI, a framework that elevates workflow optimization to a second-order diagnostic inquiry—investigating why failures occur before committing to structural interventions. SO-RSI passively monitors execution traces for three structural anomalies (recurrence, opposing edits, and expectation mismatch) to trigger targeted mechanism investigations. By executing lightweight diagnostic probes and maintaining persistent inquiry memory across RSI rounds, SO-RSI accumulates causal evidence to guide systematic workflow edits rather than parameter patches. Across Lean 4 proof generation and Verus-based verifiable code generation, SO-RSI improves final held-out pass rates over Naive RSI by 21.8 and 25.8 percentage points under matched 24-hour search budgets. Behavioral analyses further confirm that SO-RSI substantially suppresses failure recurrence and eliminates unproductive zero-progress optimization loops.

1 INTRODUCTION

Recursive self-improvement (RSI) progressively improves an executable agent through repeated cycles of observing problems, exploring their causes, and attempting solutions (Robeyns et al., 2025). While such quick fixes can efficiently restore progress, remaining at this level of first-order problem solving can leave the underlying causes of those problems unexplored (Tucker & Edmondson, 2003).

Consider a RSI trajectory for a Lean 4 proof agentic workflow that retrieves lemmas before generating a proof (Figure 1). When a proof attempt fails, first-order RSI relies on immediate quick fixes. Observing a failure due to missing lemmas, RSI directly increases the retrieval count to k=20k = 20—a quick fix that temporarily restores progress. However, a subsequent attempt fails as the excessive lemma text exceeds the context limit, prompting RSI to apply the opposite quick fix by decreasing the count to k=15k = 15. In a later round, as the reduced window omits critical lemmas again, RSI fine-tunes the parameter back up to k=18k = 18, only to encounter the original context-overflow error in the next iteration, forcing yet another reduction. This oscillation reveals a fundamental blind spot of first-order problem solving: misinterpreting a structural failure—low retrieval relevance—as a mere hyperparameter tuning task of search-testing for the "optimal lemma count," thereby failing to investigate the core mechanism of re-ranking and filtering.

This observation reveals a central risk for RSI. First-order problem solving is necessary to overcome immediate obstacles, but stopping at this level leaves the causes of recurring problems unresolved. RSI may then repeatedly confront similar failures and face conflicting prescriptions, without a clear basis for deciding which to follow. What restores progress in one attempt can therefore leave the agent caught between opposing changes in the next. Appendix B.1 provides further examples involving failure history and tactic fallbacks.

∗^{*}Work done during an internship at Emergence AI.

Task: Improve a Lean 4 proof workflow through recursive self-improvement

Component: Lemma retrieval

Parameter: Number of retrieved lemmas (k)

First-order response / Adjust the retrieval count

Round 3

Compiler feedback: unsolved goals

Hypothesis: Insufficient recall

Set k = 20

Round 5

Oscillation

Compiler feedback: unsolved goals

Hypothesis: Context length exceeded

Set k = 15

Round 12

Oscillation

Compiler feedback: unsolved goals

Hypothesis: Insufficient recall

Set k = 18

Underlying issue: Low retrieval relevance

Adjust window length to include key lemmas

k = 20

k = 15

k = 18

Relevant to the goal

Irrelevant to the goal

Selected context window

Dense, relevant context

k = 4

Rerank + Filter

Filtered out

Key lemma retained within a small context window

Key lemma

Figure 1: One symptom, opposite fixes. Repeated unsolved goals feedback leads a first-order response to alternate between hypotheses of insufficient recall (k = 20) and exceeded context limit (k = 15, 18). Top: The agent oscillates through parameter patching without resolving the failure. Bottom: The underlying issue is poor retrieval ranking—a large window introduces excessive noise, while smaller windows exclude the low-ranked key lemma. Relevance-based reranking and filtering eliminate this trade-off, producing a dense context. Blue/dark-blue tiles denote relevant/key lemmas, and gray tiles denote noise.

Recent work on RSI and agent improvement already supports reflection, failure diagnosis, and workflow modification (Robeyns et al., 2025; Chen et al., 2026). The remaining question is how to direct this research when immediate fixes leave conflicting outcomes unexplained. Second-order problem solving provides a concrete target: investigate how the workflow produces the problem, obtain evidence that distinguishes explanations, and use it to guide a change to that process (Tucker & Edmondson, 2003). The depth of inquiry is determined by this target, rather than by the length of reflection or the number of follow-up questions.

Our work addresses three fundamental questions. First, first-order RSI is limited by an explanation gap: LLMs easily propose plausible failure explanations, but without explicit verification, they resort to blind parameter patching that fails to resolve structural flaws. Second, elevating to second-order inquiry is necessary because stopping recurring failures requires diagnosing the underlying mechanism rather than patching surface symptoms, replacing conflicting edits with durable workflow improvements. Third, we operationalize second-order inquiry through a persistent diagnostic architecture that detects anomalies, formulates testable hypotheses, validates them via executable probes, and executes evidence-guided workflow edits.

We introduce SO-RSI, which monitors three signals: recurrence, opposing edits, and expectation mismatch. Triggered observations initiate mechanism investigation (I): gathering evidence, forming explanations, and testing predictions. Evidence accumulates across RSI rounds and guides workflow improvements (G), which return to ordinary RSI for evaluation and further optimization. Across Lean proving and Verus-based verifiable code generation (VCG), SO-RSI improves final pass rate over Naive RSI by 21.8 and 25.8 percentage points under the same 24-hour budget.

Our contributions are threefold:

• Diagnostic analysis: We document reversals in recorded RSI decisions and audit the evidence supporting their causal explanations.

• Empirical motivation: We quantify investigation depth, intervention gains, and repeated unproductive editing across 134 attempts.

• The SO-RSI framework: We use second-order problem solving to specify the target and evidence requirements of inquiry, integrating selective detection and persistent investigation into continuing RSI, with ablations supporting the value of probes and memory.

References (63)