🤖 AI Summary
This work addresses the limitations of existing code-generation agents, whose tool-calling strategies often rely on rigid rules and struggle to balance cost and accuracy. The paper introduces, for the first time, Bayesian sequential decision-making into tool scheduling for code agents, formulating tool orchestration as a cost-sensitive sequential hypothesis testing problem. A Bayesian controller dynamically maintains belief in the correctness of candidate solutions and adaptively decides whether to gather more evidence, optimize, verify, or terminate execution. This approach yields an interpretable correctness score that surpasses conventional uncertainty measures based on token probabilities or tool success rates. Empirical validation across six code generators and nine programming benchmarks demonstrates its effectiveness, particularly in scenarios where verification is costly and critics provide rich yet imperfect feedback.
📝 Abstract
Modern coding agents pair LLM generators with various tools, including cheap diagnostics and expensive verifiers. The tool-use decisions are typically governed by orchestrators that often use fixed rules and ignore uncertainty. We formulate orchestration as cost-sensitive sequential hypothesis testing: a Bayesian controller maintains a belief over candidate correctness and dynamically decides whether to gather more evidence, refine the candidate, verify it, or stop. Across six generators and nine coding benchmarks, Bayesian control proves to be most valuable when verification is costly and critics are informative but imperfect. Beyond control, the belief state yields an interpretable correctness score that outperforms token-probability and raw tool-success baselines for uncertainty quantification.