AutoPyVerifier: Learning Compact Executable Verifiers for Large Language Model Outputs

TL;DR

AutoPyVerifier uses DAG search to automatically learn compact Python verifiers, improving target F1 by up to 55 points.

cs.CL 🔴 Advanced 2026-04-25 45 views
Pouya Pezeshkpour Estevam Hruschka
verification large models automation program synthesis search optimization

Key Findings

Methodology

The approach employs an LLM to generate candidate verifier sets, organizes them in a directed acyclic graph (DAG), and iteratively refines them via a scoring function based on task-specific metrics like F1. The process involves: initial verifier synthesis via LLM prompts, DAG construction representing verifier transformations, node scoring combining task performance, exploration, size penalty, and feasibility, and guided expansion using a critic and modifier LLM components. The final verifier set balances interpretability, coverage, and efficiency, enabling automated learning of verification logic aligned with target objectives.

Key Results

  • Across benchmarks in mathematical reasoning, coding, function calling, and instruction-following, AutoPyVerifier improved target F1 scores by up to 55.0 points over initial LLM-generated verifier sets, with only 1-6 functions per set. The learned verifiers demonstrated strong transferability across models and datasets, including out-of-distribution scenarios, with improvements up to 54.4 points. Incorporating these verifiers as external tools during inference led to performance gains of up to 17.0 points, confirming their practical utility.
  • Experimental results showed that the search process significantly enhances verification accuracy, especially on challenging benchmarks like ComplexFuncBench and IFBench. The approach maintains a compact verifier set, favoring structural and semantic checks over superficial content presence, indicating a shift toward deeper verification logic. The method's robustness across models (GPT-5.4, Gemini-3.1 Pro) and data distributions underscores its potential for broad application.
  • Analysis of verifier categories revealed a transition from content-based checks to internal consistency and semantic correctness, reflecting the learned verification logic's depth. The approach's ability to generate reusable, interpretable, and effective verification rules marks a substantial advance over prior manual or heuristic methods, paving the way for more reliable AI systems.

Significance

This work addresses a fundamental challenge in AI verification: how to automate the design of effective, interpretable, and generalizable verification logic. By leveraging LLMs and structured search, it shifts verification from manual rule crafting to data-driven learning, enabling scalable and adaptable solutions. The resulting verifier sets improve model reliability, transparency, and safety, crucial for deploying AI in real-world, high-stakes environments. The methodology also opens avenues for integrating verification into training and inference pipelines, fostering more trustworthy AI systems.

Technical Contribution

The paper introduces a novel DAG-based search framework that systematically explores the space of executable Python verifiers generated by LLMs. It combines task-specific scoring, exploration bonuses, and complexity penalties to efficiently identify compact, high-quality verifier sets. The integration of LLM critic and modifier modules for iterative refinement, along with detailed category analysis of learned verifiers, advances the state of the art in automated verification logic induction. The approach demonstrates strong transferability and utility in downstream tasks, representing a significant technical innovation.

Novelty

This is the first work to formulate verification logic learning as a DAG search problem guided by LLM synthesis and iterative refinement. Unlike prior approaches relying on fixed rules or single-model classifiers, it dynamically discovers verification strategies that are both interpretable and effective. The combination of structured search, multi-objective optimization, and verification category analysis constitutes a new paradigm for automated verification in AI systems.

Limitations

  • The approach relies heavily on multiple calls to large language models, incurring high computational costs, which may limit scalability in production environments.
  • Verification categories are predefined, potentially restricting the discovery of more nuanced or domain-specific checks.
  • While transferability is promising, some verifier sets show limited generalization, especially in highly complex or novel tasks, indicating room for improvement in robustness.

Future Work

Future research will explore multi-modal verification incorporating visual and symbolic data, optimize search algorithms for efficiency, and develop adaptive verification strategies that evolve during training. Extending the framework to unsupervised or semi-supervised settings, as well as integrating verification into end-to-end training pipelines, will further enhance AI reliability and interpretability.

AI Executive Summary

The rapid advancement of large language models (LLMs) has revolutionized AI capabilities in reasoning, coding, and instruction following. However, ensuring the correctness and reliability of their outputs remains a significant challenge. Traditional verification methods often depend on manually crafted rules or opaque neural judges, which either lack coverage or lack interpretability. This gap hampers the deployment of trustworthy AI systems, especially in high-stakes applications.

To address this, the paper introduces AutoPyVerifier, a novel framework that automates the induction of executable Python verifiers through a structured search process. The core innovation lies in representing the search space as a directed acyclic graph (DAG), where each node corresponds to a candidate verifier set. Starting from LLM-generated initial sets, the system iteratively refines these verifiers by guided modifications, using a combination of task-specific scoring, exploration bonuses, and complexity penalties. The process involves three key components: an LLM critic that diagnoses verification gaps, a modifier that proposes improvements, and a search strategy that balances exploration and exploitation.

Experimental results across multiple benchmarks—mathematical reasoning (AIME), code generation (LiveCodeBench), multi-step reasoning (ComplexFuncBench), and instruction following (IFBench)—demonstrate the effectiveness of AutoPyVerifier. The learned verifier sets, containing only 1-6 functions, improved target F1 scores by up to 55 points, outperforming initial LLM proposals. These verifiers also generalized well to out-of-distribution data, with improvements up to 54.4 points, indicating strong transferability.

Further analysis revealed that the verification logic evolved from superficial content checks to deeper structural and semantic validations, enhancing interpretability and robustness. When integrated as external tools during inference, these verifiers boosted model accuracy by up to 17 points, confirming their practical utility. This work marks a significant step toward automated, scalable, and interpretable verification systems, with promising implications for AI safety, transparency, and deployment. Future directions include multi-modal verification, efficiency improvements, and integration into training pipelines, aiming to build more reliable AI systems in complex real-world scenarios.

Deep Analysis

Background

Recent progress in large language models (LLMs) such as GPT-4 and PaLM has significantly advanced AI reasoning, code synthesis, and instruction following. Despite these breakthroughs, the reliability and correctness of model outputs remain critical issues. Traditional verification approaches rely heavily on manual rule design or simple neural classifiers, which are either labor-intensive or lack interpretability. Recent efforts have explored using LLMs as judges, but their inherent variability and surface-level reasoning limit robustness. Programmatic verifiers, like Python functions, offer transparency and executability but require extensive manual engineering and often lack coverage for complex tasks. The challenge is to develop automated methods that can learn verification logic from data, ensuring both coverage and interpretability, thus enabling scalable verification for diverse AI applications.

Core Problem

The core problem is to automatically induce a small, effective set of Python verifiers that collectively approximate a target evaluation metric (e.g., correctness) over model outputs. Existing solutions are either manual, which is time-consuming and inflexible, or rely on fixed heuristics that cannot adapt to task complexity. The difficulty lies in balancing verification coverage, interpretability, and computational efficiency. Moreover, verification logic must generalize across models and data distributions to be truly useful. Achieving this requires a systematic search over candidate verifier sets, guided by performance metrics and structural considerations, which has not been adequately addressed in prior work.

Innovation

This paper introduces a DAG-based search framework that automates the learning of verification logic. Key innovations include:

  • �� Leveraging LLMs to synthesize diverse verifier candidates based on task descriptions;
  • �� Organizing the search space as a DAG, enabling iterative refinement and efficient exploration;
  • �� Combining task-specific metrics (like F1), exploration bonuses, and size penalties in a unified acquisition function;
  • �� Employing a critic-modifier loop where the critic diagnoses verification gaps and the modifier proposes targeted improvements;
  • �� Analyzing verifier categories to shift from superficial to structural and semantic checks.

These innovations collectively enable automatic induction of compact, high-quality verification sets that generalize across models and tasks.

Methodology

  • �� Initial verifier synthesis: Use LLM prompts to generate multiple sets of Python verification functions, covering structural, formatting, and correctness checks.
  • �� DAG construction: Each verifier set forms a node; edges represent transformations like adding, removing, or modifying verifiers.
  • �� Node scoring: Compute a utility combining task performance (F1), exploration bonus (UCB-inspired), size penalty, and feasibility (balanced TP/TN ratios).
  • �� Node selection: Pick the highest-scoring node for expansion.
  • �� Critic analysis: An LLM critic examines false positives/negatives, diagnoses gaps, and suggests improvements.
  • �� Modifier generation: An LLM proposes refined verifier sets based on critic feedback, focusing on adding, replacing, or removing verifiers.
  • �� Iterative search: Repeat scoring, selection, critic analysis, and modification until convergence or budget exhaustion.
  • �� Final selection: Choose the node with the best utility as the learned verifier set, which is then deployed for evaluation or inference.

Experiments

The framework was evaluated on four benchmarks: AIME (mathematical reasoning), LiveCodeBench (code generation), ComplexFuncBench (multi-step reasoning), and IFBench (instruction following). Using GPT-4.1 as the backbone, the search ran for 20 steps, generating up to 3 verifier sets per node. Hyperparameters (α, β, γ) were tuned via grid search. Performance was measured by F1 scores on both in-distribution and out-of-distribution datasets, comparing initial versus refined verifier sets. Transferability was tested by applying learned verifiers to different models (e.g., Gemini-2.5). Ablation studies analyzed the impact of each search component and category analysis of learned verifiers.

Results

Results show that the search process consistently improves verification accuracy, with gains up to 55 points F1, while maintaining small verifier sets. The learned verifiers generalize well across models and datasets, with improvements up to 54.4 points OOD. Category analysis indicates a shift toward structural and semantic checks, enhancing interpretability. When used as external tools during inference, these verifiers boost downstream accuracy by up to 17 points, demonstrating practical benefits. The approach outperforms baseline heuristics and manual rules, establishing a new standard for automated verification.

Applications

The learned verifier sets can serve as reliable proxies for correctness evaluation, improve model reranking, and guide self-correction during inference. They are applicable in high-stakes domains like education, code verification, and safety-critical systems, where interpretability and robustness are essential. Additionally, the methodology can be integrated into training pipelines for reinforcement learning or fine-tuning, fostering more trustworthy AI systems. Future work may extend to multi-modal verification and adaptive, task-aware logic induction.

Limitations & Outlook

The reliance on multiple large model calls increases computational costs, limiting scalability. The predefined verifier categories may restrict capturing complex or domain-specific checks. Transferability, while promising, is not universal; some tasks or models show limited improvement. Further research is needed to reduce costs, expand verifier types, and enhance robustness in diverse scenarios.

Plain Language Accessible to non-experts

想象你在厨房里准备一道菜,验证器就像厨师检查食材是否新鲜、调料是否合适。以前,厨师自己写很多规则,比如“盐不能太多”,但每次都得手工调试,既麻烦又不灵活。现在,有个聪明的厨师(AutoPyVerifier),它可以根据菜谱自动学习哪些检查最重要,比如“菜色是否均匀”、“味道是否正宗”。它会用一种像拼图的方式,把不同的检查拼在一起,试试哪些组合最有效。这样,你只需要告诉它目标(比如菜要好吃),它就能自动学会一套简洁又可靠的检查方法。最终,这些检查规则可以帮你快速判断菜是否合格,也能提醒你哪里出错。这个过程就像让厨房变得更智能、更省事,做饭也更有保障。

ELI14 Explained like you're 14

想象你在学校写作文,老师会检查你的内容是不是有错别字、逻辑是否清楚。以前,老师自己写很多规则,比如“每段都要有主题句”,但每次都得手工写,太麻烦了。现在,有个聪明的机器人(AutoPyVerifier),它可以根据你以前写的作文,自己学习哪些检查最重要,比如“有没有拼写错误”、“句子是否通顺”。它会用一种像拼图一样的方法,把不同的检查拼在一起,试试哪些组合最能帮你写得更好。最后,它会告诉你哪些地方需要改,帮你写出更棒的作文。这样,你不用每次都自己想检查点,机器人帮你自动学习,作文质量自然就提高了。这就像有个超级帮手,让写作变得更简单、更靠谱。

Abstract

Verification is becoming central to both reinforcement-learning-based training and inference-time control of large language models (LLMs). Yet current verifiers face a fundamental trade-off: LLM-based verifiers are expressive but hard to control and prone to error, while deterministic executable verifiers are reliable and interpretable but often limited in capability. We study the following question: given a development set of LLM outputs and labels for a target objective, such as correctness, can we automatically induce a minimal set of Python verifiers whose joint satisfaction closely matches that objective? We propose AutoPyVerifier, a framework that uses an LLM to synthesize candidate verifier functions and then refines them through search over a directed acyclic graph (DAG). By navigating the DAG, AutoPyVerifier systematically explores the space of deterministic executable verifiers and selects a compact verifier set whose joint satisfaction best approximates the target objective. Across mathematical reasoning, coding, function calling, and instruction-following benchmarks for several state-of-the-art LLMs, AutoPyVerifier improves target-objective prediction by up to 55.0 F1 points over the initial LLM-generated verifier sets. Additional analyses show that the most useful verification targets vary by benchmark and model, and that the DAG-based search shifts the learned verifier sets toward more structural and semantically grounded checks. We further show that exposing the discovered verifier set to an LLM as an external tool improves downstream accuracy by up to 17.0 points. We release our code

cs.CL cs.LG cs.PL