HERO: Harnessing Evidence for Test-time Refinement and Prompt Optimization in Program Generation
Mingyu Lu, Timothy Ossowski, Tristan Naumann, Hoifung Poon, Peniel Argaw
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.
Create a lesson
Related papers
Latent Compaction with Test-Time Training
Shared title terminologycs.CLYingfa Chen, Xingyu Shen, Chaojun Xiao et al.
REWIND: Uncertainty-Guided Trajectory Repair for Test-Time Reasoning
Shared title terminologycs.CLYi Ding, Mengyu Wang, Min Zhou et al.
Worth the Wait? How Response Time and Streaming Shape Judgments of Generative AI Answers and Chatbot Engagement
Shared title terminologycs.CLZihan Chen, Di Zhu, Lei Nico Zheng
Can LLM-Simulated Respondents Pre-Test Survey Questions? Evidence From Preregistered Prospective Validation
Shared title terminologycs.CLSristi Bafna, Mac MacComas, Michael Bader et al.
Beyond Self-Consistency: Recursive Self-Improvement at Test Time
Shared title terminologycs.CLJianyu Wu, Yizhou Wang, Encheng Su et al.
AtomSearch: Evidence-Grounded Tree Search for Agent Skill Optimization
Shared title terminologycs.CLJia Tong, Senyou Deng, Min Peng et al.