betaFeedback

WorksComputer Science

HERO: Harnessing Evidence for Test-time Refinement and Prompt Optimization in Program Generation

Abstract

Harness optimization improves LLMs by refining reusable prompts and scaffolding, yet requires further adaptation for program generation tasks such as text-to-SQL and text-to-Python. Existing methods often rely on LLM reflectors to propose harness updates, which can fix observed failures but also disrupt previously correct behavior. Text-to-code tasks offer a natural way to mitigate this issue: we can execute generated outputs, allowing us to evaluate and verify the effects of proposed updates directly. Building on this signal, we introduce HERO Harnessing Evidence for Refinement and Optimization), which combines offline and test-time harness optimization. At the first stage, HERO learns reusable prompt updates from execution-verified successes and failures and validates candidate revisions before adoption. At test time, we treat the generated code as an instance-specific harness and refine it using execution feedback. Across four SQL, Cypher, and Python benchmarks, HERO achieves the best offline performance, improving pass@1 by 7.6 points over the initial prompt, while test-time refinement adds another 2.0 points and improves execution efficiency.

Introduction

LLM agents are increasingly employed to interact with external environments through tools, often by generating executable programs such as SQL and Cypher queries and Python functions [11, 5] (Schick et al. 2023; Zhuo et al. 2025; Ouyang et al. 2026). These artifacts provide a flexible interface for models to perform computation and interact with external systems [6] (Wang et al. 2024). Their quality depends not only on the underlying model, but also on the surrounding harness—the prompts, tools, and memory that shape generation [9, 10, 12, 14]. This makes the harness a natural target for improving LLM agent performance. Accordingly, existing work has pursued two related directions: optimizing reusable harness components across tasks [10, 13, 2] (Yang et al. 2026), and using test-time feedback to select or refine generated outputs [16, 4, 15]. Improving program generation through these directions presents two linked challenges. First, reusable updates must correct recurring errors without degrading behavior that already works. LLM-generated feedback can be unreliable without external grounding [7, 8], and prompt revisions that resolve failures can introduce regressions on previously successful cases (Wu et al., 2024b). The challenge is therefore to derive grounded diagnoses of what to change and preserve from execution outcomes, and translate these diagnoses into reusable guidance. Second, this general guidance must be complemented by feedback specific to the current instance. An optimized prompt captures strategies learned across training tasks, but a generated program may still encounter errors that require observations from its own execution. Approaches such as Dynamic Cheatsheet (DC) and ACE accumulate experience through evolving shared contexts (Suzgun et al., 2026; Zhang et al., 2026). When shared context is updated at test time, unreliable or overly specific feedback can become persistent guidance, allowing errors from one instance to affect subsequent tasks. Together, these challenges motivate grounding offline harness updates in execution evidence while keeping test-time corrections local to the current program.

To address these challenges, we introduce HERO (Harnessing Evidence for Refinement and Optimization), a two-level framework that grounds reusable guidance updates in execution evidence and confines test-time adaptation to the current program. Our contributions are threefold:

  • A unified two-level formulation. We formulate program generation as a two-level optimization problem that couples offline prompt optimization with test-time refinement of instance-specific programs.

  • Execution-grounded feedback and verification. Offline, we use execution evidence from successful and failed programs under prior prompts to identify what to correct and preserve. At test time, execution feedback and retrieved verified training examples guide program revisions, which are accepted only when supported by evidence.

  • Empirical evaluation and analysis. We demonstrate correctness gains over existing offline harness optimizers across diverse query-generation and programming tasks, with further improvements from test-time refinement. We further evaluate execution efficiency and computational cost, finding that the learned prompts remain compact across tasks.

Related Works

Prompt and harness optimization. Prompt and harness optimization improves frozen LLMs by adapting reusable components around them. MIPRO (Opsahl-Ong et al. [17]) jointly optimizes instructions and few-shot demonstrations using task-level feedback. Reflection-based approaches include GEPA (Agrawal et al. [2]), which uses trajectory feedback to propose prompt revisions, and STRAGO (Wu et al. (2024b)), which derives refinement strategies from both successful and failed examples to mitigate prompt drift. Other approaches broaden the optimization target: ACE (Zhang et al. (2026)) maintains an evolving context through generation, reflection, and curation; SkillOpt (Yang et al. (2026)) optimizes reusable textual skills; and Meta-Harness (Lee et al. [10]) searches over harness implementations using source code, scores, and execution traces. Building on this line of work, HERO adopts a similar offline optimization loop but enriches reflection with execution feedback from successful and failed programs generated under prior prompt revisions, aiming to improve program generation while limiting regressions.

Test-time refinement. Test-time methods refine model outputs using feedback available during inference. ReAct (Yao et al. (2022)) interleaves reasoning, actions, and environment observations, while Reflexion and related self-refinement methods use feedback from earlier attempts to revise subsequent outputs ([15] (Shinn et al. 2023)). Dynamic Cheatsheet (DC) (Suzgun et al. (2026)) further accumulates self-curated strategies across queries through persistent memory. These methods emphasize adaptation from test-time experience. HERO complements this adaptation with reusable guidance learned through offline prompt optimization. The optimized prompt remains fixed during inference, while execution feedback and retrieved, verified training examples guide refinement of the current program.

Harness Optimization for Program Generation

Problem Setup: Program Generation

In this work, we focus on program generation—tasks that map natural language specifications to programs, including text-to-SQL, text-to-Cypher, and text-to-Python function generation. Each instance xx contains a specification and available task context, such as a database schema or function signature. An LLM generates a candidate program yy, whose execution yields observations such as runtime errors, returned values, and execution traces (Wang et al. (2024)). We denote its task performance by an execution-based evaluation reward R(y,x)∈RR(y,x) \in\mathbb{R}. We distinguish this evaluation reward from the feedback available during refinement: in our setting, test-time refinement can access execution observations but not test reference solutions or hidden correctness labels.

A Unified View of Harness Optimization

Prior work improves fixed LLMs through reusable prompt or harness optimization ([2, 10]) and feedback-driven refinement across attempts ((Shinn et al., 2023)). We represent these forms of adaptation through a harness comprising external state that conditions a fixed policy πθ\pi_\theta or mediates its interaction with the environment. For an instance xx, we decompose this state as

hx=(hshared,hxinst),(1)h_x = \left(h^{\mathrm{shared}}, h_x^{\mathrm{inst}}\right), \tag*{(1)}

where hsharedh^{\mathrm{shared}} is reused across instances and hxinsth_x^{\mathrm{inst}} contains instance-specific state. During refinement, previously generated programs, their execution feedback, and retrieved examples can become part of hxinsth_x^{\mathrm{inst}}, conditioning subsequent revisions. Given the harness, the policy generates the next candidate program:

y∼πθ(⋅∣x;hx).(2)y \sim\pi_\theta\left(\cdot\mid x; h_x\right). \tag*{(2)}

Optimizing shared state targets the expected reward across instances, whereas optimizing instance-specific state targets the current instance.

Method

Building on this unified view, we propose HERO, a two-stage framework that optimizes the harness at complementary scopes while keeping the underlying LLM fixed. The first stage, offline optimization (HERO-O), learns a shared harness hsharedh^{\mathrm{shared}} from execution feedback across training tasks (Figure 1(a)). The second stage, test-time refinement (HERO-T),

Overview of HERO

Figure 1. Overview of HERO. (a) HERO-O: Offline prompt optimization learns a shared prompt across training tasks. (b) HERO-T: Test-time refinement refines the generated artifact using environment feedback.

Algorithm 1 HERO

Require: Initial prompt $h^{\mathrm{shared}}_0$; diagnostic set $\mathcal{D}_{\mathrm{diag}}$; update set $\mathcal{D}_{\mathrm{upd}}$; selection set $\mathcal{D}_{\mathrm{sel}}$; optimizer LLM $M_{\mathrm{opt}}$; candidates per iteration $N$; iterations $T$; program-refinement operator $\Phi_B$ with per-query action budget $B$

Stage 1: Prompt Optimization
1: $\mathcal{A} \leftarrow \{h^{\mathrm{shared}}_0\}$; $\mathcal{R}_{-1} \leftarrow \varnothing$
2: for $t = 0, \ldots, T - 1$ do
3: $\mathcal{F}_t \leftarrow M_{\mathrm{opt}}(h^{\mathrm{shared}}, \mathcal{R}_{t-1}, \mathcal{D}_{\mathrm{diag}})$ ▷ reflect on diagnostic programs and execution outcomes
4: $\mathcal{H}_t \leftarrow \{M_{\mathrm{edit}}^{(i)}(h^{\mathrm{shared}}, \mathcal{F}_t)\}_{i=1}^{N}$ ▷ propose candidate prompts
5: $(h^{\mathrm{shared}}_{t+1}, \mathcal{H}^{+}_t) \leftarrow \operatorname{ScreenAndAccept}(h^{\mathrm{shared}}, \mathcal{H}_t, \mathcal{D}_{\mathrm{upd}})$ ▷ Algorithm 2
6: $\mathcal{R}_t \leftarrow \mathcal{H}_t \setminus \{h^{\mathrm{shared}}_{t+1}\}$
7: $\mathcal{A} \leftarrow \mathcal{A} \cup \mathcal{H}^{+}_t$
8: end for
9: $\hat{h}^{\mathrm{shared}} \leftarrow \arg\max_{h \in \mathcal{A}} \operatorname{Acc}(h, \mathcal{D}_{\mathrm{sel}})$

Stage 2: Test-Time Refinement
10: for all test instances $x$ do
11: $y_0(x) \sim \pi_\theta(\cdot \mid x; \hat{h}^{\mathrm{shared}})$
12: $\hat{y}(x) \leftarrow \Phi_B(x, y_0(x); \hat{h}^{\mathrm{shared}})$
13: end for
14: return $\hat{h}^{\mathrm{shared}}$ and refined programs $\{\hat{y}(x)\}$

keeps the shared harness fixed while adapting an instance-specific harness hxinsth_x^{\mathrm{inst}} using evidence from the current test instance (Figure 1(b)). The overall procedure is summarized in Algorithm 1.

HERO-O: Offline Prompt Optimization

Stage 1 of HERO instantiates the hsharedh^{\mathrm{shared}} optimization by learning a reusable prompt across training tasks. We denote htsharedh_t^{\mathrm{shared}} for the accepted prompt at iteration tt. Starting from h0sharedh_0^{\mathrm{shared}}, optimization alternates between diagnosing the current prompt, proposing revisions, and validating them on held-out examples. To prevent overfitting, we use three data splits with distinct roles: Ddiag\mathcal{D}_{\mathrm{diag}} provides evidence for proposing revisions, Dupd\mathcal{D}_{\mathrm{upd}} determines whether a revision is accepted, and Dsel\mathcal{D}_{\mathrm{sel}} selects

Algorithm 2 SCREENANDACCEPT - line 5 of Algorithm 1

Require: Current prompt htsharedh_t^{\mathrm{shared}}; candidates Ht\mathcal{H}_t; update set Dupd\mathcal{D}_{\mathrm{upd}} partitioned into chunks C1,…,CKC_1,\ldots,C_K; budget bb; margin τ\tau; confidence multiplier zz

1: Pull C1C_1 for all h∈Hth \in\mathcal{H}_t 2: while b>0b > 0 and not Resolved(Ht)(\mathcal{H}_t) do 3: (Δ^h,σ^h)←(\widehat{\Delta}_h,\widehat{\sigma}_h) \leftarrow PairedDelta(h,ht)(h,h_t) for all h∈Hth \in\mathcal{H}_t 4: ℓ←arg⁡max⁡hΔ^h\ell\leftarrow\arg\max_h \widehat{\Delta}_h; c←arg⁡max⁡h≠ℓ(Δ^h+zσ^h)c \leftarrow\arg\max_{h\ne\ell}(\widehat{\Delta}_h+z\widehat{\sigma}_h) 5: Pull(ℓ,Cnℓ+1)(\ell,C_{n_\ell+1}); b←b−1b \leftarrow b-1 6: if b>0b > 0 and Δ^c+zσ^c>τ\widehat{\Delta}_c+z\widehat{\sigma}_c>\tau then 7: Pull(c,Cnc+1)(c,C_{n_c+1}); b←b−1b \leftarrow b-1 8: end if 9: end while 10: (Δ^h,σ^h)←(\widehat{\Delta}_h,\widehat{\sigma}_h) \leftarrow PairedDelta(h,ht)(h,h_t) for all h∈Hth \in\mathcal{H}_t 11: ℓ←arg⁡max⁡hΔ^h\ell\leftarrow\arg\max_h \widehat{\Delta}_h 12: ht+1←{ℓ,Δ^ℓ>τ,ht,otherwiseh_{t+1} \leftarrow\begin{cases} \ell, & \widehat{\Delta}_\ell> \tau, \\ h_t, & \text{otherwise} \end{cases} 13: Ht+←{h∈Ht:Δ^h>τ}\mathcal{H}_t^+ \leftarrow\{h \in\mathcal{H}_t : \widehat{\Delta}_h > \tau\} 14: return ht+1,Ht+h_{t+1},\mathcal{H}_t^+

the final prompt. Thus, examples used to propose an update are not used to determine its acceptance.

Textual Gradients from Execution-grounded Experience

Prompt optimization can be viewed as a discrete analogue of gradient-based optimization, where natural language critiques or reflections serve as “textual gradients” for prompt updates (Pryzant et al., 2023; Yuksekgonul et al., 2024). Prior work uses LLM reflection to guide prompt updates [13, 2] (Pryzant et al. 2023), but such feedback can be unreliable without external grounding [7, 8]. Following Wu et al. (2024b), we use both successful and failed cases but enrich reflection with execution outcomes and traces from programs generated under prior prompt revisions to identify what to correct and preserve. This connects prior edits to observed program behavior, providing concrete context for diagnosing what to correct and preserve. At iteration tt, the optimizer LLM reviews the prompt edits proposed at t−1t-1, along with kk generated programs from both successful and failed cases and their corresponding execution outcomes (e.g., failure errors or predicted output mismatches). Correct programs indicate behaviors to preserve, while incorrect programs identify behaviors to revise. The optimizer summarizes this evidence into feedback FtF_t, providing an execution-grounded direction for updating the current htsharedh_t^{\mathrm{shared}}.

Conditioned on htsharedh_t^{\mathrm{shared}} and FtF_t, the same optimizer LLM proposes NN candidate shared harnesses,

Ht={Mopt(i)(htshared,Ft)}i=1N.(3)\mathcal{H}_t = \left\{M_{\mathrm{opt}}^{(i)}\left(h_t^{\mathrm{shared}},F_t\right)\right\}_{i=1}^{N}. \tag*{(3)}

We instruct the optimizer to propose revisions as reusable rules rather than instance-specific fixes, and reject candidates that copy instance-specific content or reference answers using deterministic filters, e.g., filtering out prompts that memorize training answers.

Adaptive Paired Acceptance

Prior work has explored bandit-based candidate selection (Pryzant et al., 2023) and minibatch comparisons of prompt revisions against their parent prompts [2]. Our acceptance procedure combines these strategies to improve the reliability and efficiency of prompt updates: paired comparisons capture both fixes and regressions relative to the current prompt, uncertainty-guided allocation focuses evaluation on uncertain candidates, and a minimum improvement margin guards against accepting marginal gains (Algorithm 2). For each candidate prompt h∈Hth \in\mathcal{H}_t, we compute the per-instance improvement

dh(x)=R(yh,x)−R(yt,x),(4)d_h(x)=R(y_h,x)-R(y_t,x), \tag*{(4)}

where yh∼πθ(⋅∣x;h)y_h \sim\pi_\theta(\cdot\mid x;h) and yt∼πθ(⋅∣x;htshared)y_t \sim\pi_\theta(\cdot\mid x;h_t^{\mathrm{shared}}) are generated by the candidate and current shared prompts, respectively, on the same instance xx. For the binary correctness reward used during acceptance, dh(x)∈{−1,0,+1}d_h(x) \in\{-1,0,+1\}, corresponding to a regression, unchanged correctness, or a fix. The mean paired improvement therefore measures net fixes per evaluated instance. We denote its estimate by Δ^h\widehat{\Delta}_h and its estimated standard error by σ^h\widehat{\sigma}_h.

All candidates are initially evaluated on a common subset of Dupd\mathcal{D}_{\mathrm{upd}}. At each allocation step, we identify the leader with the largest Δ^h\widehat{\Delta}_h and the alternative with the highest upper confidence bound (UCB)-inspired score Δ^h+zσ^h\widehat{\Delta}_h+z\widehat{\sigma}_h [3], where zz controls the uncertainty bonus. The leader receives the next evaluation chunk, while the alternative receives additional evaluations only if its score exceeds the acceptance margin τ\tau. This continues until the decision is resolved or the budget is exhausted (Algorithm 2). The candidate with the largest final Δ^h\hat{\Delta}_h replaces the current prompt only if Δ^h>τ\hat{\Delta}_h > \tau; otherwise, the current prompt is retained.

After TT iterations, we select the final shared harness h^shared\hat{h}^{\mathrm{shared}} from the archive A\mathcal{A} using the separate selection set Dsel\mathcal{D}_{\mathrm{sel}}. This decouples per-iteration acceptance from final harness selection and allows an earlier candidate to be recovered if later updates generalize less well.

HERO-T: Evidence-Grounded Test-Time Refinement

Stage 2 of HERO adapts the instance-specific harness while keeping the learned shared prompt fixed. Given a test instance xx, we first generate

y0∼πθ(⋅∣x;h^shared).(5)y_0 \sim\pi_\theta(\cdot\mid x; \hat{h}^{\mathrm{shared}}). \tag*{(5)}

We then refine this program for at most BB steps using only evidence available at test time, without access to the test solution or correctness label.

Two Sources of Refinement Evidence

Refinement draws on two complementary sources. Execution evidence includes execution traces, runtime errors, returned outputs, and environment probes that help identify instance-specific problems. Retrieved demonstration evidence consists of execution-verified training examples that provide implementation patterns, such as library-specific conventions, that execution feedback alone may not reveal.

The refiner combines environment interaction and execution-based program refinement (Yao et al., 2022; Chen et al., [4]) with instance-specific demonstration retrieval. Unlike MIPROv2, which selects demonstrations during offline optimization (Opsahl-Ong et al., [17]), we select demonstrations separately for each test instance. Specifically, we retrieve up to nn verified training examples using lexical similarity, then let the refiner select at most three relevant demonstrations.

Evidence-gated Refinement

At refinement step kk, let eke_k denote newly gathered execution observations and, when available, retrieved demonstrations. The instance-specific harness contains the current program and accumulated evidence:

hx,kinst=(yk−1,e1:k).(6)h^{\mathrm{inst}}_{x,k} = (y_{k-1}, e_{1:k}). \tag*{(6)}

Conditioned on this state and the fixed shared prompt, the same LLM used for initial generation proposes a revised program:

y~k∼πθ(⋅∣x;h^shared,hx,kinst),k=1,…,B.(7)\tilde{y}_k \sim\pi_\theta\left(\cdot\mid x; \hat{h}^{\mathrm{shared}}, h^{\mathrm{inst}}_{x,k}\right), \qquad k = 1,\ldots,B. \tag*{(7)}

We apply an evidence gate rather than accepting every revision. First, the controller executes y~k\tilde{y}_k and rejects it if it fails the available programmatic checks. For revisions that pass, the same LLM compares yk−1y_{k-1} and y~k\tilde{y}_k using both the accumulated evidence e1:ke_{1:k} and the revision’s execution results. It assesses whether the changes address an observed issue or implement a convention supported by the retrieved demonstrations. A revision is accepted only if it passes the programmatic checks and the LLM judges its changes to be supported by the evidence.

Let Gk∈{0,1}G_k \in\{0,1\} denote this combined acceptance decision. We update

yk={y~k,Gk=1,yk−1,Gk=0.(8)y_k = \begin{cases} \tilde{y}_k, & G_k = 1,\\ y_{k-1}, & G_k = 0. \end{cases} \tag*{(8)}

Rejected revisions leave the current program unchanged; accepted revisions become the starting point for the next step. After K≤BK \le B refinement steps, we return yKy_K.

Experimental Setup

Benchmarks

We evaluate on four text-to-function generation benchmarks spanning SQL, Cypher, and Python generation.

BIRD-SQL (Li et al., [11]). BIRD-SQL evaluates text-to-SQL generation over realistic SQLite databases from diverse application domains. Given a natural-language question, database schema, and optional external knowledge, the model generates an executable SQL query.

CypherBench (Feng et al., [5]). CypherBench evaluates text-to-Cypher generation over large-scale Neo4j property graphs derived from Wikidata, covering query patterns such as multi-hop retrieval, aggregation, comparison, and temporal reasoning.

BigCodeBench-Instruct (Zhuo et al. (2025)). BigCodeBench-Instruct evaluates text-to-Python function generation from text instruction across diverse programming and library-use tasks.

DSCodeBench (Ouyang et al. (2026)). DSCodeBench evaluates text-to-Python function generation for practical data-science tasks spanning ten widely used libraries.

For each benchmark, we construct a diagnostic set Ddiag\mathcal{D}_{\mathrm{diag}} to provide examples and execution feedback for prompt optimization, and an update set Dupd\mathcal{D}_{\mathrm{upd}} to evaluate candidate revisions. For final harness selection, we use a separate set Dsel\mathcal{D}_{\mathrm{sel}} where dataset size permits; otherwise, we reuse Dupd\mathcal{D}_{\mathrm{upd}}. Split sizes are reported in Table 4, with further details on preprocessing, split construction, and evaluation procedures in Section A.

Models and Baselines

We compare against three classes of methods: (i) offline prompt optimization3, including GEPA (Agrawal et al. [2]), MIPROv2 (Opsahl-Ong et al. [17]), ACE (Zhang et al. (2026)), and SkillOpt (Yang et al. (2026)); (ii) test-time refinement, including ReAct (Yao et al. (2022)) and Dynamic Cheatsheet (DC-Cu) (Suzgun et al. (2026)); and (iii) end-to-end harness optimization, represented by Meta-Harness (Lee et al. [10]). Offline optimizers start from the same seed prompt (Section G) and use the same optimization data and execution-based correctness signal. Test-time methods use only information available at inference time, without access to reference solutions, reference outputs, or correctness labels.

For each benchmark, we set a fixed rollout budget based on GEPA’s auto=heavy setting (Table 4) and apply the same budget to HERO and all baselines, matching rollout counts as closely as their procedures permit. Unless otherwise stated, all methods use GPT-5 with medium reasoning effort as the backbone model. We report results over three seeds. Additional implementation details for HERO and the baselines are provided in Section C.

Evaluation Metrics

Execution accuracy. Our primary metric is pass@1. We generate one solution for each instance and report the fraction that satisfies the benchmark’s correctness criteria.

Execution efficiency. Accuracy alone does not distinguish between correct programs with different execution costs (Waghjale et al. (2024)). We therefore measure runtime efficiency using the Valid Efficiency Score (VES) (Li et al. [11]),

VES=1N∑n=1N1(Vn=V^n)E(Yn)E(Y^n)(9)\mathrm{VES} = \frac{1}{N}\sum_{n=1}^{N} \mathbf{1}(V_n = \widehat{V}_n)\sqrt{\frac{E(Y_n)}{E(\widehat{Y}_n)}} \tag*{(9)}

where VnV_n and V^n\widehat{V}_n denote the reference and predicted execution results, and E(Yn)E(Y_n) and E(Y^n)E(\widehat{Y}_n) their corresponding execution times. Incorrect solutions receive zero credit, while faster correct solutions receive higher scores. Detailed timing and scoring protocols are provided in Section C.3.

Cumulative fix-to-break ratio. To characterize how reliably performance improves during offline optimization, we track whether accepted prompt updates fix previously incorrect instances or break previously correct ones. At optimization progress tt, we define

ρ(t)=∑s=0tfixeds∑s=0tbrokens,(10)\rho(t) = \frac{\sum_{s=0}^{t} \mathrm{fixed}_s}{\sum_{s=0}^{t} \mathrm{broken}_s}, \tag*{(10)}

where fixeds\mathrm{fixed}_s and brokens\mathrm{broken}_s count incorrect-to-correct and correct-to-incorrect transitions induced by accepted updates at iteration ss. A ratio ρ(t)>1\rho(t) > 1 indicates that accepted updates cumulatively correct more instances than they disrupt.

Results

Fixes and Regressions During Prompt Optimization

We first examine how offline prompt optimization affects program generation. While validation accuracy captures the net effect of an update, it does not reveal the balance between fixing incorrect instances and introducing regressions on previously correct ones. We therefore analyze the cumulative fix-to-break ratio

(10) to characterize this balance over optimization.

As shown in Figure 2, HERO-O maintains more fixes than regressions throughout optimization and achieves the highest ratios overall. On BIRD-SQL, HERO-O reaches a cumulative ratio of approximately 3.0, compared with 2.0 for MIPROv2 and SkillOpt, 1.5 for GEPA, and 1.2 for ACE. ACE, which incrementally accumulates instance-derived strategy bullets, initially favors fixes but gradually approaches a ratio of 1.0, whereas methods that make broader prompt revisions maintain higher ratios. A similar pattern holds on BigCodeBench, where HERO-O reaches approximately 2.2, comparable to GEPA and higher than MIPROv2 (1.4) and ACE (1.2). Our ablation further shows that using only failed cases reduces the average fix-to-break ratio from 2.23 to 1.91 (Table 7), suggesting that combining successful and failed cases provides more informative feedback for prompt revisions than failures alone. These results suggest that our feedback design helps accumulate fixes while limiting regressions during prompt optimization.

Figure 2. Cumulative fix-to-break ratio. The y-axis reports the cumulative ratio across optimization iterations on the x-axis. The dashed line indicates an equal number of fixes and regressions.

SettingBIRD-SQLBigCodeBenchDSCodeBenchCypherBenchMean
Full3.011.611.702.062.10
Failure-only2.611.711.491.411.81

Table 7. Effect of successful diagnostic examples. Cumulative fix-to-break ratios over accepted rounds, averaged over three seeds. Full: 32 failed + 32 passing cases; failure-only: 32 failed cases. Mean averages the four benchmarks.

Benchmark Performance of Offline Prompt Optimization

We next evaluate whether the resulting prompts improve pass@1 on held-out text-to-SQL, text-to-Cypher, and text-to-Python code-generation tasks.

As shown in Table 1, HERO-O improves pass@1 over the initial prompt across all four benchmarks, with gains of 4.16 points on BIRD-SQL, 4.66 on BigCodeBench, 10.1 on DSCodeBench, and 11.5 on CypherBench. HERO-O also achieves the highest mean pass@1 among offline prompt optimizers on all four benchmarks. It reaches 63.5 on BIRD-SQL, compared with 62.5 for GEPA and 61.3 for SkillOpt; 52.5 on BigCodeBench, compared with 51.9 for ACE and 51.8 for SkillOpt; 54.8 on DSCodeBench, compared with 52.1 for GEPA; and 85.5 on CypherBench, compared with 84.1 for SkillOpt. By contrast, Meta-Harness, which optimizes the end-to-end harness, does not consistently improve performance and can underperform the initial prompt, achieving 58.2 on BIRD-SQL and 45.3 on BigCodeBench.

DatasetBaselineOffline Prompt OptimizationTest-Time AdaptationHarness Optimization
SeedHERO-OSkillOptGEPAMIPROv2ACEDC-CuHERO-O+THERO-O + ReActHERO-O + DC-CuMeta-Harness
BIRD DEV59.39 (0.32)63.55 (0.21)61.31 (1.19)62.59 (0.59)60.87 (0.57)60.87 (0.10)60.22 (0.79)64.81 (0.21)63.12 (1.03)62.44 (1.43)58.24 (2.18)
BigCodeBench47.93 (0.74)52.59 (0.31)51.81 (0.47)50.13 (1.00)50.65 (0.59)51.96 (1.25)44.79 (0.83)53.79 (0.33)52.64 (0.24)51.70 (0.89)45.26 (2.52)
DSCodeBench44.74 (0.24)54.84 (1.87)51.87 (1.50)52.14 (1.99)51.73 (1.76)51.31 (0.43)42.81 (0.24)56.04 (1.87)56.22 (2.87)54.70 (0.87)45.99 (0.52)
CypherBench74.00 (0.44)85.50 (1.40)84.10 (1.30)78.73 (1.53)78.27 (3.04)77.13 (1.74)77.13 (1.74)89.93 (1.46)87.00 (0.21)81.77 (2.98)77.03 (2.59)

Table 1. Performance across four code-generation benchmarks. Results (pass@1) are reported as mean (standard deviation) over three runs. Bold highlights the best mean within each category.

We further examine performance across pre-specified BIRD-SQL difficulty levels (Figure 3). HERO-O achieves pass@1 scores of 70.5, 53.6, and 51.4 on simple, moderate, and challenging questions, respectively. Its advantage is largest on challenging questions, where HERO-O reaches 51.4, outperforming the next-best method, GEPA (46.8), by 4.6 points. These results show that the gains from grounded prompt optimization persist across difficulty levels and are most pronounced on challenging instances.

Figure 3. BIRD-SQL DEV pass@1 by question difficulty (simple n=923n=923, moderate n=463n=463, challenging n=144n=144 scored instances). Bars are the mean over three seeds; error bars are the sample standard deviation.

Learned prompts and optimization cost. We next examine whether these performance gains come at the cost of larger prompts or greater per-call token usage (Table 2). HERO-O, GEPA, and SkillOpt produce compact instruction sets, whereas MIPROv2 additionally selects few-shot demonstrations and ACE accumulates a substantially larger playbook. Averaged across benchmarks, HERO-O produces the shortest final prompts (1,949 tokens), compared with 2,003 for GEPA, 2,704 for MIPROv2, and 35,881 for ACE. Our cost analysis also shows that more compact prompts generally correspond to lower per-call token usage: HERO-O averages 2.79K tokens per optimization call, comparable to GEPA (2.47K) and SkillOpt (2.87K), and substantially below ACE (31.89K).

MethodTokens/call (K)Prompt length (tokens)
ACE31.89 (1.17)35,881 (7,563)
MIPROv23.47 (0.02)2,704 (70)
SkillOpt2.87 (0.10)2,021 (628)
GEPA2.47 (0.24)2,003 (541)
HERO-O (Ours)2.79 (0.18)1,949 (389)

Table 2. Optimization context and token cost. Input plus output tokens per LLM call during optimization and the length of the final prompt. Averaged over four benchmarks per seed; mean (SD) over three seeds.

Upon inspection of the learned prompt, we found that HERO-O primarily retains general task-level instructions (Figure 9), whereas other optimizers preserve varying amounts of training-specific content (Figure 10 and Figure 11). Together, these results suggest that HERO learns compact, reusable guidance rather than accumulating instance-specific details, while achieving its performance gains without substantially larger prompts (Figure 5).

Figure 5. Pass@1 versus cost. Pass@1 performance against optimization token budget (top) and final prompt length (bottom) per benchmark. Points show 3-seed means with standard deviation (log-scale x-axes).

Example optimized system prompt produced by HERO on BIRD-SQL

Figure 9. Example optimized system prompt produced by HERO on BIRD-SQL. The prompt provides detailed instructions for query planning, schema grounding, SQL generation, and verification.

Example GEPA-optimized system prompt on BIRD-SQL

Figure 10. Example GEPA-optimized system prompt on BIRD-SQL.

Example ACE-optimized system prompt on BIRD-SQL

Figure 11. Example ACE-optimized system prompt on BIRD-SQL. ACE extends the initial system prompt with a playbook of accumulated strategies, formulas, code templates, and common mistakes. Each entry includes helpful and harmful counts; additional entries and some long templates are omitted.

Test-Time Refinement Complements Offline Prompt Optimization

Offline prompt optimization captures reusable task-level guidance but may leave instance-specific errors unresolved. We therefore evaluate whether HERO-T—evidence-grounded test-time refinement—provides additional gains and how it compares with alternative test-time adaptation strategies. For each dataset, we initialize test-time refinement with the best offline prompt obtained from HERO-O.

As shown in Table 1, HERO-T improves pass@1 on all benchmarks, by 1.26 points on BIRD-SQL, 1.20 on BigCodeBench, 1.20 on DSCodeBench, and 4.43 on CypherBench, for an average gain of 2.02 points. The resulting system achieves the highest mean pass@1 on three of four benchmarks; on DSCodeBench, ReAct is marginally higher (56.22 vs. 56.04). Alternative test-time methods are less consistent: ReAct improves performance on three benchmarks but slightly degrades BIRD-SQL, while DC-Cu decreases performance on all four when applied after offline optimization. To distinguish whether this behavior arises from combining DC-Cu with offline optimization, we also apply DC-Cu directly to the initial prompt. The results remain mixed: it improves BIRD-SQL and CypherBench by 0.83 and 3.13 points, respectively, but decreases BigCodeBench and DSCodeBench by 3.14 and 1.93 points.

These results suggest that the two stages of HERO are complementary: offline optimization captures reusable task-level guidance, while test-time refinement provides additional improvements for individual instances.

Execution Efficiency

For SQL queries and Python code, correctness alone does not fully capture solution quality: programs that produce the same correct result can differ substantially in execution cost ([11]). We therefore report VES alongside pass@1 to assess whether improvements in correctness also preserve execution efficiency.

As shown in Table 3, HERO-O achieves the highest mean VES on three of four benchmarks: BIRD-SQL (91.9), BigCodeBench (75.0), and DSCodeBench (57.8). Together with the corresponding pass@1 gains, these results indicate that the improved correctness on these tasks is not achieved at the expense of execution efficiency. On CypherBench, SkillOpt attains the highest mean VES (137.7), though with substantial variability across runs (SD 50.8). With HERO-T, VES further improves on BIRD-SQL, BigCodeBench, and DSCodeBench, alongside the corresponding gains in pass@1. On CypherBench, however, pass@1 increases from 85.5 to 89.93, while VES decreases from 109.8 to 101.7. This divergence highlights a correctness–efficiency trade-off: test-time refinement solves more instances, but the resulting programs are less efficient under VES. Overall, HERO delivers concurrent gains in correctness and execution efficiency on three of four benchmarks, demonstrating that its performance improvements generally extend beyond accuracy alone.

MethodBIRDBigCodeBenchDSCodeBenchCypherBench
Seed prompt79.1 (5.0)61.2 (3.6)48.7 (0.5)85.6 (1.5)
Stage Offline Harness Optimization
GEPA73.1 (3.6)69.1 (3.9)56.0 (2.2)86.7 (3.8)
MIPROv277.9 (7.1)69.7 (2.7)55.4 (1.3)86.5 (3.2)
ACE72.3 (2.2)71.3 (2.5)55.3 (0.5)103.8 (15.2)
SkillOpt75.9 (4.0)69.7 (1.0)54.8 (1.0)137.7 (50.8)
Metaharness74.5 (10.3)58.5 (3.0)84.8 (4.3)50.5 (0.7)
HERO-O91.9 (6.4)75.0 (3.5)59.8 (1.7)109.8 (39.8)
Stage Test-Time Adaptation
DC-Cu83.7 (4.5)54.5 (7.2)48.8 (0.8)74.2 (1.9)
HERO-O + DC-Cu91.4 (4.9)70.6 (1.9)60.0 (1.2)92.6 (16.0)
HERO-O + ReAct92.3 (7.6)76.2 (3.6)60.7 (2.3)110.1 (42.8)
HERO-O + T93.4 (6.1)76.2 (3.6)61.5 (1.4)101.7 (7.8)

Table 3. Valid Efficiency Score (VES) of generated programs. Results are mean (SD) over three seeds; higher is better. Bold denotes the best mean.

Ablation Study and Sensitivity Analysis

We ablate the main components of offline optimization on BIRD-SQL and BigCodeBench and examine sensitivity to the amount of diagnostic evidence and optimization budget.

Ablation study. Removing the rendered success and failure cases consistently reduces performance: pass@1 drops from 63.55 to 59.15 on BIRD-SQL and from 52.5 to 50.08 on BigCodeBench (Figure 4). This indicates that validation signals alone do not provide sufficient guidance for prompt revision; concrete execution examples help the optimizer identify what to correct and what to preserve.

Figure 4. Sensitivity to the number of rendered diagnostic cases. Pass@1 as the number of cases rendered varies. Results are the mean ± SD over three seeds.

Sensitivity analysis and model generalization. HERO remains relatively stable across a range of configurations, including the number of candidates, optimization rounds, and rendered diagnostic examples, with performance consistently above the seed prompt.

and rendered diagnostic examples, with performance consistently above the seed prompt. Similarly, increasing the test-time refinement budget yields limited additional gains beyond the default B=3B = 3 (Section D.2). These results suggest that the observed improvements are not highly sensitive to hyperparameter choices or prolonged refinement. Experiments with GPT-5.4 (Table 9) further show consistent gains over the evaluated baselines, indicating that the approach extends beyond the GPT-5 backbone.

DatasetSeedOursSkillOptGEPAMIPROv2ACEDC-CuOurs + RefineOurs + ReActOurs + DC-CuMeta-Harness
BIRD DEV58.91 (0.44)63.66 (1.18)64.38 (1.21)63.01 (1.30)63.03 (0.84)63.36 (1.57)62.14 (0.27)65.38 (1.13)63.57 (1.10)64.12 (0.69)58.52 (0.72)
BigCodeBench52.22 (0.77)52.43 (0.57)52.96 (0.36)52.69 (0.48)52.54 (1.94)52.49 (0.36)50.71 (1.77)52.59 (0.57)53.48 (0.50)53.38 (1.13)51.49 (0.28)
DSCodeBench50.83 (0.55)55.39 (1.70)54.56 (0.72)53.94 (0.55)54.84 (0.94)55.26 (1.22)45.09 (1.69)54.63 (0.32)54.08 (0.43)54.49 (0.21)50.14 (2.80)
CypherBench73.13 (0.45)83.67 (1.10)79.00 (1.37)76.87 (2.05)79.37 (2.36)82.17 (2.10)73.83 (1.01)88.63 (2.02)87.87 (1.42)81.13 (3.20)82.47 (1.96)

Table 9. Performance across four code-generation benchmarks using GPT-5.4. Results (pass@1) are reported as mean (standard deviation) over three runs. Bold highlights the best reported mean within each optimization stage.

Conclusion

In this work, we introduced HERO, a two-stage harness framework for program generation that combines grounded offline prompt optimization with evidence-grounded test-time refinement. Across four SQL, Cypher, and Python benchmarks, HERO consistently outperforms the initial prompt and existing prompt optimization baselines, with test-time refinement providing further gains on every benchmark. Our analyses show that execution-grounded updates reduce regressions during optimization, while the learned prompts remain compact and robust across optimization settings. Together, these results support combining reusable cross-task optimization with instance-specific refinement for more effective program generation.

Limitations

Budgeting and computational cost. Our evaluation uses fixed, benchmark-specific budgets, which may limit the gains that some methods could achieve with longer searches. Substantially expanding these budgets is computationally demanding: even under the evaluated budgets, ACE and Meta-Harness require approximately 12 and 24 hours of wall-clock time, respectively, on BigCodeBench in our setup. To support controlled comparisons within these practical constraints, we use task-rollout counts as a common measure of evaluation effort and match budgets as closely as method-specific procedures permit. This measure, however, does not fully capture differences in the costs of reflection, candidate generation, and selection. Nevertheless, we have sought to make the comparisons as fair and transparent as possible within these computational and methodological constraints.

Model dependency. Our main evaluation relies on proprietary GPT-5 and GPT-5.4 models, whose future updates or deprecation may affect exact harness reproducibility. However, HERO operates entirely at the harness level and does not require access to or modification of model weights, allowing the same optimization procedure to be applied to other compatible backbones. Learned prompts may still require re-optimization when the underlying model changes.

DatasetTaskDdiag\mathcal{D}_{\mathrm{diag}}Dupd\mathcal{D}_{\mathrm{upd}}Dsel\mathcal{D}_{\mathrm{sel}}Dtest\mathcal{D}_{\mathrm{test}}Rollout budget
BIRD-SQLText-to-SQL5002501,4001,5305,400
CypherBenchText-to-Cypher2502502501,0003,700
BigCodeBenchPython2502502506375,400
DSCodeBenchPython2502502504823,600

caption: Benchmarks, data splits, and optimization budgets. Rollout budgets cap task executions during offline optimization.

:::

Appendix

Datasets Details

Here, we provide additional details on each benchmark and our preprocessing and splitting procedures. Three conventions apply across all datasets. First, all splits are constructed once using a fixed dataset-level seed before any experiment, and pool membership is held fixed across methods and run seeds. Second, the diagnosis pool Ddiag\mathcal{D}_{\mathrm{diag}}, update pool Dupd\mathcal{D}_{\mathrm{upd}}, and, when applicable, selection pool Dsel\mathcal{D}_{\mathrm{sel}} are disjoint at the instance level. Third, the evaluation split is never accessed during optimization and is used only for final evaluation of the selected prompt.

BIRD-SQL ([11]). BIRD-SQL is a large-scale text-to-SQL benchmark designed to evaluate SQL generation in realistic database settings, where models must reason over database contents in addition to schemas. It contains 12,751 natural-language–SQL pairs across 95 SQLite databases and 37 application domains: 9,428 training examples over 69 databases, 1,534 development examples over 11 databases, and 1,789 examples over 15 databases in a concealed test set. Among the training and development databases, 32% originate from Kaggle, 48% from the CTU Prague Relational Learning Repository, and the remaining 20% from other publicly available tables. Each instance includes a natural-language question, a reference SQL query, the associated database, and optional expert-annotated external knowledge. The development set spans three difficulty levels: 925 simple, 465 moderate, and 144 challenging examples, categorized based on question understanding, external knowledge requirements, database complexity, and SQL complexity. BIRD also evaluates execution efficiency, enabling assessment of both correctness and runtime behavior.

Preprocessing and splits. Following StreamBench (Wu et al., 2024a), we use the official TRAIN split for optimization and the official DEV split for evaluation, both downloaded from 4; the concealed test set is not used. To evaluate cross-database transfer, we partition TRAIN at the database level. We reserve 14 of the 69 training databases for final prompt selection, sampling at most 100 questions per database. Of the remaining 55 databases, 15 are reserved exclusively for the update pool, from which we sample 250 questions, while the 500-question diagnosis pool is sampled from the remaining 40 databases with every database represented. Thus, the diagnosis, update, and selection pools are disjoint at the database level.

Before sampling, we exclude examples whose reference queries fail to execute or return empty results. For final evaluation, we use the 1,534 DEV examples and exclude four whose reference queries fail under our evaluator, yielding 1,530 scored examples. Correctness is determined using the official execution-accuracy comparator: predicted and reference outputs are compared as sets of tuples, ignoring row order and duplicates while preserving column order.

BigCodeBench-Instruct ((Zhuo et al., 2025)). BigCodeBench evaluates Python function generation on practical programming tasks requiring complex instruction following and composition of multiple library APIs. The benchmark contains 1,140 function-level tasks spanning seven application domains and 139 libraries, covering 723 distinct function calls. Tasks are derived from ODEX examples originating from Stack Overflow and are subsequently refactored, tested, and manually curated through a human–LLM collaborative process. Each task includes an executable reference implementation and unit tests, with an average of 5.6 tests and 99% branch coverage. BigCodeBench provides two prompt variants over the same tasks: BigCodeBench-Complete, which uses structured docstrings, and BigCodeBench-Instruct, which converts them into concise natural-language instructions. We use the BigCodeBench-Instruct release from 5.

Preprocessing and splits. Because BigCodeBench does not provide an official training split, we first audit all reference solutions in the official Docker environment. We exclude three tasks whose reference solutions do not pass their own tests: tasks 590 and 1005 depend on live network endpoints, while task 461 exceeds the canonical execution-time limit. We then shuffle the remaining 1,137 tasks once using a fixed seed. The first 500 form the optimization pool, divided equally into 250 diagnosis and 250 update examples; the remaining 637 examples form a frozen evaluation set. No separate selection pool is used, so final prompt selection is performed on the update pool.

The model is given the benchmark’s instruct_prompt as input and generates a single code block. We evaluate generated programs using the official execution protocol and Docker environment with the benchmark’s hidden unit tests. We additionally apply the official post-processing procedure to extract valid function implementations and remove code unrelated to the target entry point. During optimization, the model receives only pass/fail feedback and exception types; assertion messages containing expected outputs are withheld. Because the model endpoint does not support explicit temperature control, pass@1 is computed from a single generation using the default decoding configuration. For stratified sampling, tasks are grouped by their primary library into ten groups.

CypherBench (Feng et al., [5]). CypherBench evaluates natural-language-to-Cypher generation over large-scale Neo4j property graphs. It is designed to assess whether LLMs can query realistic knowledge graphs without relying on simplified schemas or external entity-linking pipelines. The benchmark contains 11 property graphs derived from an April 2024 Wikidata snapshot, comprising approximately 7.8 million entities across domains including art, biology, sports, companies, geography, movies, and politics. Questions cover 12 graph-query patterns, including multi-hop reasoning, aggregation, comparison, temporal reasoning, grouping, and global retrieval, and are constructed using templates followed by LLM-based rewriting and verification. We use the released CypherBench dataset from Hugging Face,6 which contains 10,882 question–Cypher pairs across 11 property graphs.

Preprocessing and splits. Rather than using the original graph-level train/test partition, we combine all 10,882 released questions and construct fixed question-level splits stratified by graph and query pattern. Using proportional sampling, we select 250 examples for the diagnosis pool, 250 for the update pool, and 1,000 for evaluation; the remaining examples are unused. We do not use a separate selection pool, and final prompt selection is performed on the update pool. Because the same graphs may appear in both the optimization and evaluation sets, this setting evaluates performance on previously observed graphs rather than generalization to unseen graphs.

Before constructing the splits, we execute all reference queries against the corresponding Neo4j graphs. All queries execute successfully within the 120 s timeout and return non-empty results, so no examples are excluded. The model is given the graph schema in the official PropertyGraphSchema format together with the natural-language question and generates a Cypher query. Generated queries are executed in a read-only Neo4j session. Following the benchmark evaluation protocol, predicted and reference outputs are compared as multisets while allowing column permutations. Row order is considered only when the reference query explicitly specifies an ordering, and queries that result in a Neo4j execution error are marked incorrect. We use a 60 s query timeout during optimization and a 120 s timeout during final evaluation. For stratified sampling and analysis, examples are grouped by graph.

DSCodeBench (Ouyang et al., 2026). DSCodeBench evaluates realistic data-science code generation across ten Python libraries. It contains 1,000 function-generation problems covering NumPy (131), Pandas (92), SciPy (112), Scikit-learn (108), Matplotlib (105), Seaborn (83), TensorFlow (110), PyTorch (101), Keras (104), and LightGBM (54). The benchmark is constructed using examples from DS-1000 and highly rated Stack Overflow answers to retrieve realistic implementations from public GitHub repositories. Retrieved code is converted into self-contained functions, filtered and perturbed to reduce direct code reuse and potential data leakage, and paired with natural-language problem descriptions and execution-based test cases, followed by manual verification. Each problem is evaluated using 200 test cases. We use the dataset released at 7.

Preprocessing and splits. Because DSCodeBench does not provide an official training split, we first validate all reference solutions in the benchmark’s pinned CPU environment. Each reference solution is executed twice on the official 200 seeded inputs and evaluated using the benchmark’s official comparator. We exclude 18 problems: seven whose reference solutions are incompatible with our evaluation setting because they fail under the official comparator, require GPU-only operations, or exceed a 30-minute timeout, and eleven that produce inconsistent outputs across repeated executions. We randomly shuffle the remaining 982 problems using a fixed seed. The first 500 form the optimization set, split evenly into 250 diagnosis and 250 update examples, while the remaining 482 form the evaluation set. We do not use a separate selection set; final prompt selection is performed on the update set.

The model is given the benchmark’s problem description as input and generates Python code. Following the official evaluation harness, we extract the first generated code block and invoke its final top-level function. A prediction is considered correct only if its outputs match the reference outputs on all 200 seeded inputs according to the benchmark’s type-specific comparator, with a 200-second execution limit per candidate. Reference outputs are precomputed and reused across candidate solutions. The test script is not provided to the model, and evaluation messages containing expected outputs are withheld during optimization. We use the same initial prompt as for BigCodeBench.

Software Environment

Benchmark-specific execution environments follow the official implementations where available. BIRD-SQL queries are executed with SQLite 3.53.4 through Python’s sqlite3 module.8 BigCodeBench programs are evaluated using the official Docker image (v0.2.1.post7),9 including the official code post-processing procedure. CypherBench queries are executed against Neo4j 5.20.0 Community Edition10 using the neo4j Python driver v6.3.111 in read-only sessions. DSCodeBench programs are evaluated on CPU using the benchmark’s pinned Python environment.12

Baseline Methods

We compare against methods that optimize different components of the harness defined in Equation (1). Offline prompt optimization methods modify the shared harness hsharedh^{\mathrm{shared}} using optimization data; test-time methods adapt external state during inference while keeping the model parameters fixed; and Meta-Harness searches over a broader shared harness that may include both prompts and executable control logic. Unless otherwise stated, all methods use the same initial prompt, task interface, and execution-based evaluator as our method.

Offline Prompt Optimization

Offline prompt optimizers modify only the shared harness while leaving instance-specific state unchanged. Given optimization data D\mathcal{D}, they can be viewed as searching for

h^shared=arg⁡max⁡hshared∈H1∣D∣∑x∈DEy∼pθ(⋅∣x;hshared)[R(y,x)].(11)\hat{h}^{\mathrm{shared}} = \arg\max_{h^{\mathrm{shared}}\in\mathcal{H}} \frac{1}{|\mathcal{D}|}\sum_{x\in\mathcal{D}} \mathbb{E}_{y\sim p_\theta(\cdot\mid x;h^{\mathrm{shared}})}[R(y,x)]. \tag*{(11)}

with different methods defining different representations and update procedures for hsharedh^{\mathrm{shared}}.

GEPA ([2]). GEPA is a reflective prompt optimizer that uses execution trajectories and evaluator feedback to iteratively improve the shared system prompt. An LLM reflects on the behavior of existing prompt candidates, identifies failure modes, and proposes targeted modifications. Candidate prompts are evaluated on task examples, and a Pareto frontier over per-instance performance guides subsequent proposal and selection. In our formulation, GEPA optimizes hsharedh^{\mathrm{shared}} with the system prompt as its only mutable component.

Implementation details. We use gepa package (v0.1.1)13 with its default configuration, including Pareto-based selection, reflection minibatches of three, and no prompt merging. The system prompt is initialized from our common seed prompt. The diagnosis and update pools serve as GEPA’s training and validation sets, respectively, and reflection records contain the execution verdict, failure category, and evaluator feedback. We evaluate 21 candidates on BIRD-SQL and 20 on BigCodeBench; for CypherBench and DSCodeBench, we use metric-call budgets of 3,700 and 3,600, respectively.

MIPROv2 [17]. MIPROv2 optimizes a shared prompt configuration consisting of an instruction and a set of few-shot demonstrations. It generates candidate instructions from task and data summaries and uses Bayesian optimization to search over instruction–demonstration combinations. In our formulation, hsharedh^{\mathrm{shared}} comprises the optimized instruction and selected demonstrations.

Implementation details. We adapt the reference mipro_optimizer_v2 implementation from DSPy14 to our setting using Optuna v5.0.015 with a TPE sampler. We retain the three-stage optimization procedure, using 18 candidate instructions and 18 demonstration sets with up to four demonstrations each. Demonstrations are bootstrapped using the initial program and supplemented with labeled examples when necessary. Candidate configurations are evaluated on minibatches of 35 examples, with a full evaluation on the update pool every five trials. We use metric-call budgets of 5,400 for BIRD-SQL and BigCodeBench, 3,700 for CypherBench, and 3,600 for DSCodeBench. The final shared harness consists of the selected instruction and its four demonstrations.

ACE (Zhang et al., 2026). Agentic Context Engineering (ACE) represents the shared harness as an evolving playbook of reusable strategies. Its Generator–Reflector–Curator procedure solves training tasks, extracts lessons from execution trajectories and evaluator feedback, and incrementally incorporates these lessons into the playbook. In our formulation, the learned playbook augments the initial prompt as part of hsharedh^{\mathrm{shared}}.

Implementation details. We use the authors’ offline batched implementation,16 retaining the original prompts and seven-section playbook format. We use three epochs with up to three Reflector rounds per epoch on BIRD-SQL, and five epochs with up to five Reflector rounds per epoch on BigCodeBench, CypherBench, and DSCodeBench. The diagnosis pool is processed in batches of 25, with the Curator constructing a delta context after every 10 reflections and incrementally updating the playbook. The token budget is treated as a soft constraint. For BIRD-SQL, we select among intermediate playbook snapshots using the held-out selection set; for the remaining benchmarks, we use the final playbook.

Test-Time Adaptation

Test-time methods modify external state during inference while keeping the learned shared prompt and model parameters fixed. For methods that refine the current instance, we write the update generically as

hx,t+1inst=U(hx,tinst,x,et),(12)h^{\mathrm{inst}}_{x,t+1} = \mathcal{U}\left(h^{\mathrm{inst}}_{x,t}, x, e_t\right), \tag*{(12)}

where ete_t denotes evidence obtained from the current interaction with the execution environment.

Dynamic Cheatsheet (DC-Cu) (Suzgun et al., 2026). Dynamic Cheatsheet maintains a textual memory that is updated during inference. We use its cumulative mode, DC-Cu, in which the model generates a solution conditioned on the current memory and subsequently updates the memory based on the problem and generated output. Because this memory persists across evaluation examples, it acts as an online-updated component of hsharedh^{\mathrm{shared}}.

Implementation details. We use the authors’ reference implementation,17 adapting the generator instructions to each task family while retaining the original curator prompt. For each example, the model may execute its generated program or query up to three times before the memory is updated. The update uses only the problem and model-generated outputs; no reference solutions, correctness labels, or evaluator verdicts are provided. The current memory and task-specific generator instructions are included in the model context for subsequent examples. We limit the memory to 20,000 characters and maintain five independent memory streams over the evaluation set to reduce sensitivity to example ordering.

ReAct ((Yao et al., 2022)). ReAct interleaves language-model reasoning with actions in an external environment. We use ReAct as an instance-level refinement baseline: the shared harness hsharedh^{\mathrm{shared}} remains fixed, while the current program and interaction history constitute hinsth^{\mathrm{inst}}. Execution feedback from the current instance is used to iteratively revise the generated program.

Implementation details. Because the original ReAct implementation18 uses free-form prompting for text-based tasks, we adapt ReAct to our test-time interaction framework. An initial candidate is first generated using the fixed shared prompt. During refinement, the model can invoke three tools through native function calling: a read-only diagnostic probe, execution of the current candidate, and submission of the final solution. We allow up to B=3B = 3 environment interactions, excluding the final submission, and provide no few-shot ReAct trajectories. Model reasoning remains internal rather than being emitted as explicit thought–action traces.

End-to-End Harness Optimization

Meta-Harness ([10]). Meta-Harness optimizes a broader shared harness than prompt-only methods. An agentic proposer generates candidate harness implementations using information from previously evaluated candidates, including their source code, execution traces, and validation performance. In our formulation, Meta-Harness optimizes hsharedh^{\mathrm{shared}} over a search space that includes prompting, memory, multi-call control flow, and self-verification, while keeping the underlying policy πθ\pi_{\theta} fixed.

Implementation details. We build on the authors’ reference implementation,19 retaining its optimization loop and Pareto-frontier selection procedure while adapting the data interface to our four benchmarks. We use GPT-5 as the proposer through the OpenAI Codex CLI and generate three candidate harnesses per iteration using the original skill instructions. Candidate harnesses may use read-only diagnostic tools, while evaluation examples and reference labels are not accessible during optimization. Each candidate is optimized on 100 diagnosis examples for BIRD-SQL and BigCodeBench and 50 for CypherBench and DSCodeBench, and evaluated on the full update pool. Search terminates when the corresponding rollout budget is reached, requiring 4–11 iterations across benchmarks. The final harness is selected based on update-pool performance, with the initial harness retained when no candidate achieves better performance.

Software environment.

All optimization, baseline, and evaluation pipelines run under Python 3.12.14. We use GPT-5 (snapshot 2025-08-07) as the generator for all methods through Azure OpenAI. Generation uses a maximum of 16,384 completion tokens and the deployment’s default sampling and reasoning settings. Additional baseline-specific dependencies and configurations are described in Section B.

Implementation Details of HERO

Model configuration. We use GPT-5 (snapshot 2025-08-07) for program generation, prompt optimization, and test-time refinement, with a maximum of 16,384 completion tokens and the deployment’s default sampling and reasoning settings.

Offline Prompt Optimization

We run T=5T = 5 optimization rounds with no early stopping. In each round, we evaluate the current prompt on the full diagnosis set and uniformly sample 32 incorrect and 32 correct examples. For incorrect examples, the reflector receives the task input, generated output, failure category, evaluator feedback, and available reference information; correct examples are included to identify behaviors that should be preserved. The optimization context also includes aggregate failure statistics and complementary feedback from the previous round. Based on this information, the reflector independently proposes four candidate prompt revisions, with up to eight edits per candidate. Proposals are rejected if they cannot be parsed, leave the prompt unchanged, or introduce task-specific values or identifiers found only in reference solutions.

Candidate evaluation and acceptance. In each optimization round, we compare four candidate prompts with the current prompt using adaptive paired evaluation (Algorithm 2). All candidates are initially evaluated on the same 50 examples from the 250-example update set, with a budget of two additional 50-example pulls allocated by the algorithm. Candidate scores are paired improvements in execution accuracy, macro-averaged across observed databases or domains. Standard errors are computed from the sample standard deviation of group means divided by the square root of the number of observed groups, floored by the pooled row-level standard error with minimum per-row variance 0.02. We set z=1z = 1 for evaluation allocation and early stopping, but accept an update only if the best candidate’s estimated mean improvement exceeds τ=0.01\tau= 0.01. Accepted prompts and any additional candidates exceeding this threshold are archived for final selection.

Final selection. After five optimization rounds, we select the final prompt through a second adaptive race over the archive, with a budget equal to 75% of the evaluations needed to score every archived prompt on the full selection set.

Test-Time Refinement

We apply test-time refinement independently to each evaluation instance after offline prompt optimization, without access to reference solutions or correctness labels. Each episode starts from the initial output generated by the selected offline prompt; therefore, B=0B = 0 recovers the corresponding unrefined prediction. Refinement is evaluated on the full evaluation set using the same execution-based evaluator as offline evaluation.

Tools and interaction budget. The refiner has access to four tools: (i) a read-only diagnostic probe for inspecting the database, graph, or program behavior; (ii) execution of the current candidate; (iii) retrieval of verified examples; and (iv) submission of the final candidate. We use an interaction budget of B=3B = 3, counting diagnostic, execution, and retrieval actions; final submission does not consume the budget. Diagnostic probes and candidate execution do not expose hidden evaluation tests or reference outputs.

Verified-example retrieval. The retrieval store is constructed exclusively from the offline optimization data; evaluation examples are never included. At the start of each episode, we construct a lexical shortlist of up to 20 examples based on task-text overlap and, for code tasks, shared libraries. The refiner may retrieve up to three examples, receiving their task descriptions and verified reference artifacts. These examples are used to identify reusable conventions rather than instance-specific solutions, and the refiner is instructed not to copy task-specific values or identifiers.

Refinement and verification. The refiner uses execution evidence and retrieved examples to determine whether the initial candidate should be revised. Retrieval-based revisions require consistent evidence for a relevant convention, while execution-based revisions must be supported by observations from the current instance. Any revised candidate must execute successfully before submission. The controller also verifies that the stated evidence for a revision was observed during the episode; unsupported revisions are rejected. If no supported improvement is identified, the initial candidate is retained. The ReAct baseline in Section B uses the same interaction framework without verified-example retrieval or evidence-based acceptance.

VES Details

We follow the VES definition of Li et al. [11]. For an instance xx with reference artifact yy and prediction y^\hat{y}, let E(⋅)E(\cdot) denote wall-clock execution time and R(x)=E(y)/E(y^)R(x) = E(y)/E(\hat{y}). The Valid Efficiency Score (VES) is

VES=100N∑x1[y^ correct]R(x),\mathrm{VES} = \frac{100}{N} \sum_x \mathbf{1}[\hat{y}\ \mathrm{correct}]\sqrt{R(x)},

where correctness follows each benchmark’s official execution-based evaluation (Section A); incorrect predictions receive zero reward. Higher VES therefore reflects both correctness and execution efficiency.

To estimate E(⋅)E(\cdot), we perform a separate timing pass over cached evaluation outputs without additional generation. For each instance, the reference and correct predictions are timed on the same worker, with repetitions interleaved to reduce machine-state variation. We execute each artifact kk times, where kk is benchmark-specific, remove timings outside mean ±3\pm3 standard deviations following Li et al. [11], and average the remaining runs. Instances whose references cannot be timed reliably are excluded for all methods, while correct predictions that fail during timing receive zero VES.

BIRD-SQL. We evaluate all 1,530 scored DEV questions. Queries execute with Python sqlite3 against read-only databases using the official 30s deadline. Timing covers query execution through full cursor consumption, with outputs above 200,000 rows treated as failures. We use k=100k = 100 repetitions.

BigCodeBench-Instruct. Of the 637 TEST tasks, 440 are included in efficiency evaluation. Because the hidden tests primarily consist of I/O-bound assertions, we instead time each task’s docstring example against the generated function; 197 tasks whose examples fail on the canonical solution are excluded for all methods. Imports occur outside the timer, and the example block is first executed for validity before timing. We use k=100k = 100 repetitions with a 20s per-execution and 600s per-task limit.

CypherBench. We evaluate all 1,000 frozen TEST questions against the 11 Neo4j 5.20 graphs using the official read-only execution setup and 120s timeout. Timing measures client-side wall time from query submission through full result consumption, including network and serialization overhead for both references and predictions. We use k=10k = 10 repetitions.

DSCodeBench. Of the 482 TEST problems, 453 are included in the VES evaluation; the remaining 29 are excluded because their reference solutions cannot be timed reliably. For each problem, DSCodeBench generates the same 200 test inputs from a fixed random seed and compares the predicted outputs with those of the reference solution. We use this same 200-input workload for runtime measurement in the benchmark’s CPU-only environment with the official 200 s limit. The reference and correct predictions are first validated and then timed over k=3k = 3 interleaved repetitions, with RR computed from their cleaned mean runtimes.

Additional Results

Token Consumption and prompt length

Table 5 compares methods along two dimensions: average tokens per LLM call during optimization and final prompt length, which affects recurring inference costs. ACE incurs substantially higher overhead on both dimensions, requiring 20.8–38.5K tokens per optimization call and producing playbooks of 17–53K tokens (8–38× longer than those of other methods). This overhead arises from repeatedly processing the accumulated playbook during reflection and curation. In contrast, the remaining methods generally require 1.8–3.4K tokens per call on three of the four benchmarks, although their relative efficiency varies across tasks. MIPROv2 has the lowest per-call cost on BIRD-SQL and CypherBench, while GEPA is cheapest on BigCodeBench. However, MIPROv2’s cost increases to 7.5K tokens per call on DSCodeBench, with a 6.4K-token final prompt, due to lengthy bootstrapped demonstrations.

MethodBIRD-SQLBigCodeBenchCypherBenchDSCodeBench
Tokens per call (K)
ACE38.46 ± 1.0631.51 ± 6.1620.84 ± 1.6636.63 ± 1.97
MIPROv22.17 ± 0.112.41 ± 0.331.82 ± 0.107.47 ± 0.12
SkillOpt3.17 ± 0.432.52 ± 0.192.36 ± 0.433.41 ± 0.40
GEPA2.42 ± 0.291.86 ± 0.122.24 ± 0.223.36 ± 0.49
Ours3.10 ± 0.482.10 ± 0.182.57 ± 0.093.36 ± 0.18
Prompt length (tokens)
ACE17,079 ± 25,73545,702 ± 11,12528,113 ± 2,89152,631 ± 5,026
MIPROv21,192 ± 1252,139 ± 4151,068 ± 5386,418 ± 177
SkillOpt2,119 ± 1,0112,350 ± 1,4201,905 ± 6081,710
GEPA2,053 ± 8781,339 ± 2431,882 ± 8182,736 ± 2,258
Ours2,223 ± 7411,655 ± 5332,538 ± 801,378 ± 425

Table 5. Optimization cost across datasets. Input plus output tokens per LLM call during optimization (top) and token length of the final prompt (bottom); mean ± SD over three seeds. Bold marks the lowest value per dataset.

Our method maintains competitive optimization efficiency, remaining within 1.1K tokens per call of the cheapest competing method across all benchmarks and achieving the lowest cost on DSCodeBench. Its additional overhead on BIRD-SQL and CypherBench primarily reflects the inclusion of 64 diagnosed cases in each whole-prompt rewrite. Importantly, our final prompts remain compact (1.4–2.5K tokens), achieving the shortest length on DSCodeBench and remaining within 2×2\times of the shortest prompts elsewhere. Prompt lengths are also stable across seeds (e.g., SD of 80 tokens on CypherBench, compared with 538–818 for MIPROv2 and GEPA). Since prompt length contributes to the input-token cost of each downstream query, these results indicate that the performance improvements in Table 1 are achieved without substantially increasing the shared prompt overhead at inference time.

Hyperparameter Sensitivity

Rendered diagnostic examples. Rendered diagnostic cases provide concrete evidence of failures to correct and successful behaviors to preserve. We examine whether

this evidence improves prompt revision and how performance depends on its amount (Table 6). Removing all rendered cases lowers mean pass@1 by 4.40 percentage points on BIRD-SQL and 2.51 points on BigCodeBench relative to the default of 32 failed and 32 passing cases. With examples included, performance remains above the seed prompt across all tested counts (8–64 per outcome), but does not improve monotonically with their number. The default achieves the highest mean accuracy on both benchmarks, and doubling the counts provides no further gain. These findings support using concrete diagnostic evidence while indicating that a moderate evidence set is sufficient in the evaluated settings.

HyperparameterValueBIRD-SQLBigCodeBench
Candidates per round KK4†4^\dagger63.55 (0.21)51.96 (0.00)
Candidates per round KK661.90 (1.25)52.07 (0.66)
Candidates per round KK862.39 (1.52)51.38 (0.55)
Candidates per round KK1061.74 (1.61)51.65 (1.41)
Candidates per round KK1262.83 (0.81)51.81 (1.34)
Search rounds TT361.66 (1.52)51.86 (0.81)
Search rounds TT462.00 (1.56)51.65 (0.96)
Search rounds TT5†5^\dagger63.55 (0.21)51.96 (0.00)
Search rounds TT661.52 (0.37)52.33 (0.24)
Search rounds TT762.90 (0.56)51.39 (0.50)
Rendered cases per outcome059.15 (0.93)50.08 (1.55)
Rendered cases per outcome862.38 (1.19)51.54 (1.81)
Rendered cases per outcome1661.39 (1.62)50.97 (1.19)
Rendered cases per outcome32†32^\dagger63.55 (0.21)52.59 (0.31)
Rendered cases per outcome6463.16 (0.39)51.39 (0.36)

Table 6. Offline search hyperparameter sensitivity. Pass@1 (mean (SD), three seeds) on BIRD-SQL DEV and BigCodeBench. Each section varies one setting; † marks defaults (K=4K = 4, T=5T = 5, 32 rendered cases per outcome). Bold denotes the best mean per section and benchmark.

Role of successful examples. Beyond the amount of diagnostic evidence, we examine whether successful executions provide useful guidance alongside failures. Failure cases expose errors to correct, while successful cases illustrate behaviors to preserve. To assess this balance, Table 7 compares the fix-to-break ratio under combined success-and-failure feedback and failure-only feedback. Including successful examples raises the mean ratio from 1.81 to 2.10, with improvements on three of four benchmarks. The largest increase occurs on CypherBench (1.41 to 2.06), although BigCodeBench slightly favors failure-only feedback (1.71 versus 1.61). This overall improvement supports including successful examples to guide revisions toward a better balance between fixes and regressions.

Offline search settings. We next examine whether the gains depend on specific choices of search breadth and depth (Table 6). Varying the number of candidates per round (K=4K = 4–12) and optimization rounds (T=3T = 3–7) yields mean pass@1 scores of 61.52–63.55 on BIRD-SQL and 51.38–52.33 on BigCodeBench. All tested configurations remain above the seed prompt, but increasing either KK or TT does not consistently improve accuracy. The gains therefore persist across multiple search configurations without requiring the largest tested search budgets.

Test-time refinement budget. We similarly examine whether refinement gains require a large per-query interaction budget (Table 8). Refinement improves mean pass@1 over the optimized prompt at every evaluated nonzero budget. At the default B=3B = 3, scores increase from 62.53 to 63.59 on BIRD-SQL and from 52.59 to 53.79 on BigCodeBench. The best scores at larger budgets add only 0.46 and 0.27 percentage points, respectively, indicating that the default captures much of the observed benefit.

DatasetMetric023†468ReAct B = 3
BIRD-SQLPass@1 (%)62.53 (1.82)63.38 (1.83)63.59 (1.43)63.53 (1.53)63.77 (1.47)64.05 (1.57)63.12 (1.02)
Env. actions01.351.591.661.761.780.79
LLM calls03.153.333.403.463.431.93
BigCodeBenchPass@1 (%)52.59 (0.31)53.38 (0.87)53.79 (0.33)53.95 (0.74)54.06 (0.33)53.85 (0.31)52.64 (0.24)
Env. actions01.882.312.402.492.501.91
LLM calls03.914.334.444.524.523.84

Table 8. Test-time refinement budget sensitivity. BB caps environment actions per query; † marks the default. B=0B = 0 denotes no refinement. Pass@1: mean (SD) over three seeds. Actions and calls: mean environment actions and refinement LLM calls per query. Bold denotes the highest mean pass@1 per benchmark.

The resource-usage figures help interpret these budget comparisons. Figure 6 and Figure 7 show that actual computation largely plateaus beyond B=3B = 3: increasing BB from 3 to 8 adds just 0.19 environment actions per query on each benchmark, while refinement LLM calls increase by 0.10 on BIRD-SQL and 0.19 on BigCodeBench. Thus, larger allowances remain partly unused and produce only small changes in average computation. At the same cap of B=3B = 3, our refinement also exceeds ReAct’s mean pass@1 by 0.47 and 1.15 percentage points, respectively, while using more environment actions and LLM calls.

Figure 6. Refinement resource usage on BigCodeBench. Mean environment actions (left) and LLM calls (right) per query versus budget BB. Hollow points: optimized prompt only; dashed lines: full budget utilization; gray points: plain ReAct (B=3B = 3).

Refinement resource usage on BIRD-SQL

Figure 7. Refinement resource usage on BIRD-SQL. Mean environment actions (left) and LLM calls (right) per query versus budget BB. Hollow points: optimized prompt only; dashed lines: full budget utilization; gray points: plain ReAct (B=3B = 3).

Model Generalization

Results on GPT-5.4 To assess generalization across model backbones, we extend our evaluation to GPT-5.4 on all four benchmarks. As shown in Table 9, our offline optimization improves over the seed prompt across all benchmarks, with gains of 4.75, 0.21, 4.56, and 10.54 percentage points on BIRD-SQL, BigCodeBench, DSCodeBench, and CypherBench, respectively. Our method achieves the highest offline pass@1 on DSCodeBench (55.39) and CypherBench (83.67), while remaining competitive with the strongest baselines on the other benchmarks.

Test-time refinement further improves performance on BIRD-SQL (63.66 to 65.38) and CypherBench (83.67 to 88.63), achieving the highest overall pass@1 on both benchmarks. However, gains are smaller on BigCodeBench (+0.16 points), and performance decreases slightly on DSCodeBench (-0.76 points), where offline optimization alone achieves the best result. On BigCodeBench, combining our optimized prompt with ReAct yields the highest performance (53.48). Overall, these results demonstrate that our offline optimization remains effective with GPT-5.4, while the additional benefits of test-time refinement are benchmark-dependent.

AI Use Statement

In this work, we used generative AI tools to assist with figure generation from experimental results, language and grammar editing, code generation for method implementation, experiment execution, and statistical analysis. All AI-assisted code was reviewed, verified, and tested for correctness by the authors. Separately, LLMs are also an explicit object of study within the proposed framework: both the frozen model that is used and the reflector that updates the harness.

We did not use generative AI to generate research ideas, formulate or refine hypotheses, generate scientific claims, develop theoretical or conceptual frameworks, formulate mathematical claims or proofs, or generate synthetic datasets. The authors take full responsibility for all text, claims, code, figures, and other artifacts in the final work.

Ethical Statement

HERO aims to improve the reliability and efficiency of automated code generation. However, improvements in code-generation capabilities could potentially be misused to automate malicious operations or access sensitive information. Deploying such systems may also raise privacy and security concerns, particularly when interacting with external tools or databases. We encourage responsible deployment practices, including sandboxed execution, appropriate access controls, and human oversight in sensitive applications.

Prompt Templates

BIRD-SQL. Think step by step. Use the provided database schema. Return exactly ONE SQLite query in a ```sql code block, selecting exactly the columns the question asks for, in the order asked. Check the query before returning it. BigCodeBench / DSCodeBench. Think step by step. Use the provided task specification. Return exactly ONE self-contained Python solution in a ```python code block, starting with exactly the imports and function signature specified in the task. Check the code before returning it. CypherBench. Think step by step. Use the provided graph schema. Return exactly ONE Cypher query in a ```cypher code block, returning exactly the entity names or property values the question asks for (never whole nodes or relationships). Check the query before returning it.

Figure 8. Seed system prompts across benchmarks. All optimization methods are initialized with the same benchmark-specific seed prompt. Task-specific inputs are provided separately in the user message.

Optimized Prompt for BIRD-SQL

HERO

Plan the query before writing it.

  • Determine the exact output the question requests: the column names, their order, and how many columns the result should have. If the request says "full name" and the schema stores name parts separately, treat the full name as those separate parts in multiple columns unless the question explicitly asks for a single combined string or the schema has a single full-name column.

  • Identify the required grain (per row, per day, per episode, per team/season, per order, etc.). If the question mentions a specific grain like "in a single day" or "per year", operate at that grain rather than pre-aggregating to a higher level.

  • Extract filters and map each to the correct column(s) by name (ids, codes, dates, categories). Keep filters minimal: include only constraints stated or necessary for the computation.

  • Choose the minimal set of tables that contain the needed columns. Prefer direct join paths indicated by foreign keys over indirect or text-based joins.

  • Decide the aggregation: COUNT rows for "how many" entities; SUM a numeric measure only when the question asks for a total of that measure (e.g., goals/points/units made) and the column stores that quantity per row; use AVG only when asked. Use DISTINCT only when the question says distinct/unique/different.

  • For "most/least/top N" questions, define the ordering expression, add a deterministic secondary tie-breaker (e.g., id or name ascending), and use LIMIT appropriately. Prefer ORDER BY ... LIMIT over equality to global MIN/MAX to avoid ties and type issues.

  • For multi-part questions that request different results, plan a single result schema that fits all parts. If parts share a single column type, combine them with UNION/UNION ALL into one column set. Do not add extra columns unless the question explicitly asks for them.

  • For percentages, define numerator and denominator explicitly to match the question, and compute numerator * 100.0 / denominator with REAL casting to avoid integer division.

  • Prefer the simplest correct formulation (fewest joins, no unnecessary subqueries/CTEs) to reduce the chance of timeouts.

Constrain all logic to the provided schema.

  • Use only existing tables/columns. Select join keys from declared foreign keys and primary keys; include all columns of composite keys in join predicates.

  • When a measure exists in multiple tables, pick the table that is the factual source of that measure (e.g., a detail/fact table) unless the question explicitly targets a summary/lookup.

  • Map natural-language attributes to columns with matching semantics:

    • Names: if the schema splits a name into parts, match on the appropriate first/last (and middle if needed) columns; do not use nickname/alias columns unless the question mentions them.

    • Birth/birthplace → birth_* columns; high school → hs* columns; college → college* columns; episode/season/series → the corresponding columns; addresses used by an order → the address referenced by the order, not a customer's unrelated addresses.

    • Facts related to weather, stations, or locations: when keys exist (e.g., zip or station id), join on both the date component and the location key rather than text-only or date-only joins.

  • Use INNER JOIN by default. Use LEFT JOIN only when the question requires keeping unmatched entities (e.g., "including those with zero"). Ensure no join omits a necessary key that would create a Cartesian product.

  • Do not introduce DISTINCT, extra GROUP BY, IS NOT NULL, or LIKE patterns unless the question calls for them or they are necessary to faithfully map natural-language tokens that may vary (e.g., case or pluralization).

  • Text comparisons:

    • Use case-insensitive equality (e.g., COLLATE NOCASE or UPPER(...)=UPPER(...)) for names and categories unless the column is a case-sensitive code.

    • For categorical/unit tokens where the natural-language term may differ in case or simple pluralization/punctuation from stored values, prefer case-insensitive equality; if ambiguity remains, use a narrowly targeted LIKE that matches the intended token (e.g., a substring of the unit name) rather than inventing multiple alternatives.

````text

  • Dates/times: use the stored formats. If extracting parts (year/month/day) is necessary, use SQLite text functions consistently with the stored format.

Return exactly ONE SQLite query in a ```sql code block.

  • Select exactly the columns requested, in the order requested. Do not add extra columns, labels, or computed/decoded values unless explicitly requested.

  • Names: if the schema stores name parts separately and the question requests a "full name", return the separate name-part columns (e.g., first, middle, last) as separate output columns; only concatenate into a single string if explicitly asked for a single combined full-name string or if a single full-name column exists in the schema.

  • Multi-part questions: produce a single column set across the whole result. If different parts request values of the same column type, combine them with UNION or UNION ALL so the output shape remains constant. Do not append unrelated extra columns to satisfy a later part.

  • Aggregation:

    • "How many" entities → COUNT over the relevant rows; use COUNT(DISTINCT ...) only if the question says distinct/unique/different or you are counting unique entities across multiple rows.

    • Totals of a numeric measure explicitly mentioned (e.g., goals/points/units made) → SUM the measure column over the filtered set.

    • Averages → AVG over the intended numeric expression; cast to REAL as needed to avoid integer division.

    • For "zero" conditions on an existing numeric column, filter that column equals 0 rather than using NOT EXISTS.

  • Joins:

    • Join tables using explicit foreign keys; include all parts of composite keys.

    • Prefer key-based joins (ids, codes) over text/date-string joins when keys exist.

    • For weather or other time/location facts, join on both date (or date substring) and the relevant location key (e.g., zip/station) when both are available.

  • Granularity:

    • Respect the grain implied by the question (e.g., per day/episode/order). For phrases like "in a single day" or per-episode counts, avoid pre-aggregating to coarser grains (e.g., per station overall) before ranking; order or aggregate at the specified grain.

  • Ordering and limits:

    • For "top N"/"lowest/highest" return ordered results with LIMIT N and a deterministic secondary tie-breaker (e.g., id or name ASC) when ties are unspecified.

    • Prefer ORDER BY with LIMIT to equality against global MIN/MAX to avoid missing rows due to ties or type casting.

  • Text filtering:

    • Use case-insensitive comparisons for names/categories (COLLATE NOCASE or UPPER(...)).

    • For unit/category tokens susceptible to singular/plural or punctuation differences, if exact equality is uncertain, use a careful LIKE on a stable substring of the token.

    • Keep the query minimal (avoid unnecessary CTEs/subqueries, DISTINCT, or extra joins) to reduce runtime and avoid timeouts.

Before returning the query, validate the following:

  • Output shape:

    • The number of columns and their order exactly match what the question asks. If a "full name" is requested and the schema has separate name parts, ensure the output includes those parts as separate columns (not concatenated) unless a single combined string is explicitly requested.

    • For multi-part requests, ensure a single, consistent set of columns is returned across all parts. Use UNION/UNION ALL across SELECTs that project the same columns rather than adding extra columns for later parts.

  • Joins:

    • Every join uses the correct key(s) as indicated by foreign keys; include all parts of composite keys.

    • There is no missing connecting condition that could create a Cartesian product. ````

  • Where both a date and a location key are relevant (e.g., facts to weather), both are part of the join/filter.

  • Filters:

    • Each literal maps to the correct column; no speculative alternatives (no extra ORs, no nickname fallbacks) unless required by the question.

    • Text comparisons are case-insensitive where appropriate. For unit/category tokens where singular/plural or punctuation could differ, consider using a precise LIKE on a meaningful substring if exact equality might fail.

    • Time filters match the specified range/grain and use the stored format correctly (e.g., year extraction, month/day substrings).

  • Aggregation and DISTINCT:

    • Use COUNT to answer "how many" entities; use SUM only when summing an explicit numeric measure is required by the question; use COUNT(DISTINCT ...) only when uniqueness is requested.

    • The grouping or lack of grouping matches the intended grain. Do not pre-aggregate to a higher grain than requested.

  • Ranking and extremes:

    • For top/bottom/most/least, verify ORDER BY uses the intended measure and includes a deterministic secondary tie-breaker; prefer ORDER BY ... LIMIT over equality to MIN/MAX.

  • Result sanity:

    • Avoid transforming requested raw values into derived labels (e.g., do not convert flags into Yes/No unless asked).

    • Check that the query is unlikely to return zero rows if the question implies an answer exists; if risk arises from equality to an extreme value or over-restrictive filters, consider re-expressing with ORDER BY/LIMIT or removing non-essential filters. If any check fails, revise the query before returning it.

GEPA

You will be given:

  • question: the natural-language request

  • database_schema: the exact SQLite schema available

  • external_knowledge: optional hints clarifying phrasing or value mappings

Your task:

  • Return exactly one SQLite query inside a single ```sql code block and nothing else.

  • Select exactly and only the columns the question asks for, in the order asked.

  • Use only tables and columns present in the provided database_schema.

  • Do not concatenate, compute, alias, or rename columns unless the question explicitly asks for it (e.g., “as a single string”).

  • Avoid extraneous filters, joins, DISTINCT, GROUP BY, or ORDER BY clauses unless required by the question.

Reasoning and verification:

  • Carefully map any domain-specific phrasing using external_knowledge, but ensure it aligns with actual schema columns/values.

  • Prefer the simplest query that satisfies the question to avoid timeouts (minimize joins and avoid large event tables unless explicitly needed).

  • Verify the output shape (number and order of columns) matches the question exactly and that the query runs logically on the given schema.

  • Do not add unnecessary conditions like IS NOT NULL unless the question requires them.

  • When computing ratios or percentages, ensure real (floating-point) division using 100.0 or CAST(... AS REAL) to avoid integer division.

- When aggregating over joins, do not add DISTINCT unless the question explicitly requires
it; count/sum/avg over the joined rows as-is.

- Use explicit INNER JOINs via declared foreign keys instead of EXISTS filters when linking
entities mentioned in the question.

General patterns:

- Use LIMIT for "top K" requests.

- Use ORDER BY only when the question implies an ordering (e.g., "top/most",
"lowest/highest", "earliest/latest").

- For "most/least" by a numeric measure, ORDER BY that measure DESC/ASC accordingly and LIMIT
1.

- Use COUNT or COUNT(DISTINCT ...) only when aggregation or distinctness is explicitly
required by the question.

- Join via declared foreign keys in the schema (e.g., donations.projectid ->
projects.projectid; app_labels.label_id -> label_categories.label_id; Crime.ward_no ->
Ward.ward_no).

- Do not add secondary sort keys unless specified; sort only as required (e.g., by COUNT DESC
for "top/most").

- When multiple years/records per entity exist and the question does not specify a time
period, keep the query simple: select the requested column(s) with the minimal required
filter and, if an extreme ("lowest/highest") is asked, order accordingly and LIMIT 1.

Domain-specific guidance and mappings:

- TV/person/credit schemas:

  - A "crew member from [Department]" maps to Credit.category = '<Department Name>'.

  - For average heights by department, join Person to Credit and filter Credit.category (e.g.,
  AVG(Person.height_meters) with INNER JOIN Credit on the appropriate key).

  - Depending on schema, Credit may reference Person by name or ID:

  - If Credit.person references Person.name, join ON Credit.person = Person.name.

  - If Credit.person_id references Person.person_id, join ON Credit.person_id =
  Person.person_id.

  - "credited" status refers to Credit.credited = 'true' (string).

  - To count how many times someone was credited, join Person to Credit, filter by Person.name
  and Credit.credited = 'true', and COUNT(*) (or COUNT of the joined key). Do not join Episode
  unless required by the question.

- DonorsChoose projects/resources:

  - "main subject area" maps to projects.primary_focus_area.

  - "resource type supplies" maps to resources.project_resource_type = 'Supplies'.

  - "most requested item" refers to the item with the highest resources.item_quantity; select
  resources.item_name, ORDER BY item_quantity DESC, LIMIT 1.

  - "public magnet school" maps to projects.school_magnet = 't'.

  - City filters (e.g., "Brooklyn") map to projects.school_city = 'Brooklyn'.

  - "projects created by a teacher working in ..." generally means filter using project
  attributes and join donations/resources only if the question references those tables’
  fields.

- Apps/categories dataset:

  - "categories" are label_categories.category.

  - For "top N categories with the most app users/popularity," aggregate over app_labels
  joined to label_categories:

  SELECT category, COUNT(app_id)
  FROM app_labels al
  JOIN label_categories lc ON al.label_id = lc.label_id
  GROUP BY category
  ORDER BY COUNT(app_id) DESC
  LIMIT N
  • Do not join events or device tables unless the question explicitly asks about devices or active/installed users.

  • Chicago crime and wards:

    • "case No. <ID>" maps to Crime.case_number = '<ID>'.

    • "alderman of the legislative district" means join Crime.ward_no to Ward.ward_no.

    • When asked for "full name," return two columns alderman_first_name and alderman_last_name in that order unless the question explicitly requests a single concatenated string.

    • For "percentage of crimes in <district name>," join Crime to District on district_no and compute the percentage in a single pass to avoid mismatched denominators and integer division:

SELECT CAST(SUM(CASE WHEN d.district_name = '<District Name>' THEN 1 ELSE 0 END) AS REAL) *
100.0 / COUNT(c.case_number)
FROM Crime c
INNER JOIN District d ON c.district_no = d.district_no
  • Use COUNT(c.case_number) (not COUNT(*)) when counting cases to align with case-based counts.

  • World Bank Indicators-style datasets:

    • Country name is typically Indicators.CountryName (or specific ShortName/LongName columns if explicitly required).

    • "arable land percentage" maps to IndicatorName LIKE 'Arable land (% of land area)'.

    • For "lowest/highest," use ORDER BY Value ASC/DESC LIMIT 1.

    • Do not add year filters or aggregations unless the question specifies a time period.

Style and correctness:

  • Use exact table/column names from database_schema. If the schema uses quoted identifiers (e.g., "Episode"), reference them exactly as defined.

  • Treat booleans as stored in the schema (commonly 'true'/'false' or 't'/'f' strings).

  • Ensure the final query returns exactly the requested columns and nothing else.

  • Output only the SQL query inside a single ```sql code block and no additional text.

ACE

Think step by step. Use the provided database schema. Return exactly ONE SQLite query in a ```sql code block, selecting exactly the columns the question asks for, in the order asked. Check the query before returning it.

PLAYBOOK

The playbook below contains strategies and insights accumulated from previous attempts at similar text-to-SQL questions. Read it carefully, apply the relevant bullets, and avoid the mistakes it lists.

STRATEGIES & INSIGHTS

[str-00001] helpful=606 harmful=22 :: Use the minimal set of predicates needed to answer the question; avoid adding redundant filters that can undercount or overconstrain results.

[str-00002] helpful=233 harmful=16 :: Aggregate at the source of truth for the metric (the table that records the event) to avoid join-induced row multiplication; only join after pre-aggregating or deduplicating if needed.

[... 68 more bullets omitted ...]

FORMULAS & CALCULATIONS

[calc-00006] helpful=34 harmful=0 :: BETWEEN is inclusive of both endpoints (e.g., age BETWEEN 13 AND 19 is equivalent to age >= 13 AND age <= 19).

[calc-00007] helpful=221 harmful=9 :: COUNT() counts rows; COUNT(column) ignores NULLs. Use COUNT() for total rows, and COUNT(DISTINCT key) for unique-entity counts across joins.

[... 38 more bullets omitted ...]

#### CODE SNIPPETS & TEMPLATES
[code-00123] helpful=27 harmful=0 :: Two percentage patterns -- choose based on intended
grain: event-weighted share (occurrence-based) versus entity-weighted share (per-parent
existence). Ensure numerator and denominator are derived from the same cohort and grain.
[... 50 more bullets omitted ...]

#### COMMON MISTAKES TO AVOID
[err-00013] helpful=25 harmful=93 :: Overfiltering by adding constraints not required by the
question (e.g., adding city/title when zip alone determines the answer).
[err-00014] helpful=7 harmful=4 :: Joining on incomplete keys (e.g., date-only joins to
contextual tables) that widen the join and distort aggregates; include all relevant keys
such as location.
[... 172 more bullets omitted ...]

#### PROBLEM-SOLVING HEURISTICS
[ph-00009] helpful=775 harmful=7 :: Determine the intended grain before writing the query
(row-level, per-group list, or single scalar) and ensure SELECT, GROUP BY, and HAVING
reflect that grain.
[... 32 more bullets omitted ...]

#### CONTEXT CLUES & INDICATORS
[ctx-00031] helpful=68 harmful=2 :: Language cues: words like 'total', 'sum', 'per', 'by',
'each' imply aggregation; phrases like 'highest/lowest [column]' without 'total' suggest
row-level ordering rather than grouping.
[... 79 more bullets omitted ...]
MIPRO-v2

You are a senior analytics engineer and SQLite text-to-SQL specialist working on a
cross-domain NL-to-SQL benchmark. Your job is to translate a natural-language question,
together with the provided SQLite schema and optional external knowledge, into exactly one
correct SQLite query.

Follow this process silently (do not show your reasoning; only output the SQL):
- Parse the question to identify:
  - The exact columns requested and their order.
  - Whether the result should be a scalar, a short list, or pairs/tuples.
  - Filters, time ranges, groupings, aggregates, ratios/percentages, and any
    “top/maximum/minimum” requirements.
  - Any requested sort order or limit. Do not add ORDER BY unless explicitly required or
    needed for “top/first/maximum/minimum”.
- Map terms to schema:
  - Use the provided CREATE TABLE statements and column names only.
  - Use the external knowledge hints for term/column mappings, formulas, and code-to-label
    linkages.
  - Resolve synonyms and paraphrases (e.g., "game" → game_name) and prefer human-readable
    label columns (name/title) over IDs when the question asks for names.
- Plan joins:
  - Use the minimal set of tables and equijoins on obvious keys (foreign keys, id columns, or
    name/code columns indicated by external knowledge).
  - Favor star-like joins (fact to dimensions). Avoid unnecessary joins that create
    duplicates.
  • Implement filters and computations:

    • Use WHERE for row filters; use HAVING for filters on aggregated results.

    • For "how many" counts of entities, use COUNT(DISTINCT appropriate_id_or_name) if duplicates are possible.

    • For "list" queries that imply uniqueness, use DISTINCT.

    • For ratios/percentages: 100.0 * CAST(numerator AS REAL) / NULLIF(denominator, 0). Only ROUND if requested.

    • For conditional logic, use CASE WHEN … END.

    • For maximum/minimum or "highest/lowest", use ORDER BY … DESC/ASC LIMIT 1, or use MAX/MIN with a subquery when ties or grouping require it.

  • Handle messy data robustly:

    • CAST text-encoded numbers to REAL/INTEGER after cleaning (e.g., REPLACE(text_col, ',', '')). Use TRIM to remove extra spaces.

    • For dates/timestamps stored as text, extract parts with SUBSTR or use strftime if stored in date-like formats. Example: SUBSTR(date_col, 1, 4) = '2020' for year filtering when needed.

    • Use COALESCE or IS NULL checks where appropriate.

  • Keep to SQLite-compatible SQL; CTEs are allowed but the entire answer must be a single executable SELECT query.

Output requirements:

  • Return exactly ONE SQLite query inside a single ```sql fenced code block.

  • Select exactly and only the columns the question asks for, in the precise order requested.

  • Do not include explanations, comments, or additional text outside the code block.

  • Do not use SELECT *.

  • Do not add ORDER BY unless explicitly requested by the question or required to pick extremes or "top N".

Final checklist before output:

  • Columns match the question’s requested fields and order.

  • Tables and columns exist in the provided schema.

  • Joins and filters reflect the question and any external knowledge mappings.

  • Aggregations, DISTINCT, and casts are correct; no integer-division errors.

  • No extraneous columns, ordering, or text beyond the single ```sql code block.

EXAMPLES

Example question/SQL pairs from this task (from other databases; schemas omitted). Use them to calibrate style and conventions.

Example 1

Question: What is the most requested item under the resource type "Supplies" for projects whose main subject area is Literacy & Language?

External knowledge: main subject area refers to primary_focus_area = 'Literacy & Language'; resource type supplies refers to project_resource_type = 'Supplies'; most requested item refers to Max(item_quantity);

SQL:

SELECT r.item_name
FROM resources r
JOIN projects p ON p.projectid = r.projectid
WHERE r.project_resource_type = 'Supplies'
  AND p.primary_focus_area = 'Literacy & Language'
ORDER BY r.item_quantity DESC
LIMIT 1
Example MIPRO-v2-optimized system prompt for BIRD-SQL, including instructions for SQL generation, schema grounding, query verification, and four example question–SQL pairs

Figure 12. Example MIPRO-v2-optimized system prompt for BIRD-SQL. The prompt includes instructions for SQL generation, schema grounding, query verification, and four example question–SQL pairs.

References

  1. [2]Lakshya A. Agrawal, Shangyin Tan, Dilara Soylu, Noah Ziems, Rishi Khare, Krista Opsahl-Ong, Arnav Singhvi, Herumb Shandilya, Michael J Ryan, Meng Jiang, et al. 2026. Gepa: Reflective prompt evolution can outperform reinforcement learning. In International Conference on Learning Representations, volume 2026, pages 8479–8565.arxiv.org/abs/2507.19457
  2. [3]Peter Auer, Nicolo Cesa-Bianchi, and Paul Fischer. 2002. Finite-time analysis of the multiarmed bandit problem. Machine learning, 47(2):235–256.DOI
  3. [4]Xinyun Chen, Maxwell Lin, Nathanael Schärli, and Denny Zhou. 2024. Teaching large language models to self-debug. In International Conference on Learning Representations, volume 2024, pages 8746–8825.
  4. [5]Yanlin Feng, Simone Papicchio, and Sajjadur Rahman. 2025. Cypherbench: Towards precise retrieval over full-scale modern knowledge graphs in the llm era. In Proceedings of the 63rd Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pages 8934–8958.
  5. [6]Luyu Gao, Aman Madaan, Shuyan Zhou, Uri Alon, Pengfei Liu, Yiming Yang, Jamie Callan, and Graham Neubig. 2023. Pal: Program-aided language models. In International conference on machine learning, pages 10764–10799. PMLR.arxiv.org/abs/2211.10435
  6. [7]Jie Huang, Xinyun Chen, Swaroop Mishra, Huaixiu Steven Zheng, Adams Yu, Xinying Song, and Denny Zhou. 2024. Large language models cannot self-correct reasoning yet. In International conference on learning representations, volume 2024, pages 32808–32824.arxiv.org/abs/2310.01798
  7. [8]Ryo Kamoi, Yusen Zhang, Nan Zhang, Jiawei Han, and Rui Zhang. 2024. When can llms actually correct their own mistakes? a critical survey of self-correction of llms. Transactions of the Association for Computational Linguistics, 12:1417–1440.
  8. [9]Omar Khattab, Arnav Singhvi, Paridhi Maheshwari, Zhiyuan Zhang, Keshav Santhanam, Saiful Haq, Ashutosh Sharma, Thomas Joshi, Hanna Moazam, Heather Miller, et al. 2024. Dspy: Compiling declarative language model calls into state-of-the-art pipelines. In International Conference on Learning Representations, volume 2024, pages 54928–54958.
  9. [10]Yoonho Lee, Roshen Nair, Qizheng Zhang, Kangwook Lee, Omar Khattab, and Chelsea Finn. 2026. Meta-harness: End-to-end optimization of model harnesses. arXiv preprint arXiv:2603.28052.arxiv.org/abs/2603.28052
  10. [11]Jinyang Li, Binyuan Hui, Ge Qu, Jiaxi Yang, Binhua Li, Bowen Li, Bailin Wang, Bowen Qin, Ruiying Geng, Nan Huo, et al. 2023. Can llm already serve as a database interface? a big bench for large-scale database grounded text-to-sqls. Advances in Neural Information Processing Systems, 36:43230–43257.arxiv.org/abs/2305.03111
  11. [12]Junjie Li, Xi Xiao, Yunbei Zhang, Chen Liu, Lin Zhao, Xiaoying Liao, Yingrui Ji, Janet Wang, Jianyang Gu, Yingqiang Ge, et al. 2026. Agent harness engineering: A survey. OpenReview preprint.
  12. [13]Jiahong Lin, Shichun Liu, Chengjun Pan, Lizhi Lin, Shihan Dou, Zhiheng Xi, Xuanjing Huang, Hang Yan, Zhenhua Han, Tao Gui, et al. 2026. Agentic harness engineering: Observability-driven automatic evolution of coding-agent harnesses. arXiv preprint arXiv:2604.28580.arxiv.org/abs/2604.25850
  13. [14]Ryan Lopopolo. 2026. Harness engineering: Leveraging codex in an agent-first world. URL https://openai. com/zh-Hans-CN/index/harness-engineering.
  14. [15]Aman Madaan, Niket Tandon, Prakhar Gupta, Skyler Hallinan, Luyu Gao, Sarah Wiegreffe, Uri Alon, Nouha Dziri, Shrimai Prabhumoye, Yiming Yang, et al. 2023. Self-refine: Iterative refinement with self-feedback. Advances in neural information processing systems, 36:46534–46594.arxiv.org/abs/2303.17651
  15. [16]Ansong Ni, Srini Iyer, Dragomir Radev, Veselin Stoyanov, Wen-tau Yih, Sida Wang, and Xi Victoria Lin. 2023. Lever: Learning to verify language-to-code generation with execution. In International Conference on Machine Learning, pages 26106–26128. PMLR.arxiv.org/abs/2302.08468
  16. [17]Krista Opsahl-Ong, Michael J Ryan, Josh Purtell, David Broman, Christopher Potts, Matei Zaharia, and Omar Khattab. 2024. Optimizing instructions and demonstrations for multi-stage language model programs. In Proceedings of the 2024 Conference on Empirical Methods in Natural Language Processing, pages 9340–9366.

Paper details

vlnc:W_kg2yjwew
Version
v1 · latest
Published
Fresh — added to the Hub within the last 30 days
Added
License
CC BY 4.0
Usage

views · 0

downloads · 0

A view counts once per browser per day, a download each time the PDF is requested.

  • Computer Science

generative AI tools

View statement
Looking for related papers…
Contents