SEVerA: Verified Synthesis of Self-Evolving Agents
Organizations: University of Illinois Urbana-Champaign, USA · Google, USA
Abstract
Recent advances have shown the effectiveness of self-evolving LLM agents on tasks such as program repair and scientific discovery. In this paradigm, a planner LLM synthesizes an agent program that invokes parametric models, including LLMs, which are then tuned per task to improve performance. However, existing self-evolving agent frameworks provide no formal guarantees of safety or correctness. Because such programs are often executed autonomously on unseen inputs, this lack of guarantees raises reliability and security concerns. We formulate agentic code generation as a constrained learning problem, combining hard formal specifications with soft objectives capturing task utility. We introduce Formally Guarded Generative Models (FGGM), which allow the planner LLM to specify a formal output contract for each generative model call using first-order logic. Each FGGM call wraps the underlying model in a rejection sampler with a verified fallback, ensuring every returned output satisfies the contract for any input and parameter setting. Building on FGGM, we present SEVerA (Self-Evolving Verified Agents), a three-stage framework: Search synthesizes candidate parametric programs containing FGGM calls; Verification proves correctness with respect to hard constraints for all parameter values, reducing the problem to unconstrained learning; and Learning applies scalable gradient-based optimization, including GRPO-style fine-tuning, to improve the soft objective while preserving correctness. We evaluate SEVerA on Dafny program verification, symbolic math synthesis, and policy-compliant agentic tool use (-bench). Across tasks, SEVerA achieves zero constraint violations while improving performance over unconstrained and SOTA baselines, showing that formal behavioral constraints not only guarantee correctness but also steer synthesis toward higher-quality agents.
Figures & tables
| Dataset | Total | Train |
|---|---|---|
| HumanEvalDafny | 135 | 30 |
| DafnyBench | 760 | 50 |
| -bench Retail | 114 | 15 |
| -bench Airline | 50 | 10 |
| GSM-Symbolic | 100 | 50 |
| Symbolic Regression | 1000 | 600 |
| Dataset | Method | Ver. & NoDiff (%) | Ver. (%) | Vio. (%) | Time (s) | |||
|---|---|---|---|---|---|---|---|---|
| HumanEvalDafny | LLM (Claude Sonnet 4.5) | 73.7 | 76.8 | 8.1 | 9.8 | |||
| DafnyBench baseline | 86.9 | 87.9 | 4.0 | 16.1 | ||||
| SEVerA (w/o constraints) | 84.8 | 88.9 | 5.1 | 15.7 | ||||
| SEVerA | 97.0 | (+10.1) | 97.0 | (+9.1) | 0.0 | (-4.0) | 18.2 | |
| DafnyBench | LLM (Claude Sonnet 4.5) | 68.7 | 71.1 | 10.3 | 10.3 | |||
| DafnyBench baseline | 81.6 | 84.0 | 8.2 | 20.1 | ||||
| Domain | Method | Pass Rate (%) | Violation (%) | Time (s) | ||
|---|---|---|---|---|---|---|
| Retail | LLM (Qwen3-8B) | 11.3 | 76.3 | 146.6 | ||
| Agent-C (Qwen3-8B) | 42.2 | 0.0 | 234.7 | |||
| SEVerA (w/o constraints) | 49.4 | 10.3 | 238.3 | |||
| SEVerA | 53.6 | (+11.4) | 0.0 | (0.0) | 212.4 | |
| Airline | LLM (Qwen3-8B) | 13.2 | 68.4 | 184.8 | ||
| Agent-C (Qwen3-8B) | 39.4 | 0.0 | 272.6 | |||
| Method | Accuracy (%) | Violation (%) | Time (s) | ||
|---|---|---|---|---|---|
| LLM (Qwen3-8B) | 38.3 | 10.6 | 10.9 | ||
| CRANE ( Banerjee et al., 2025 ) | 44.7 | 2.1 | 18.4 | ||
| SEVerA (no parameter tuning) | 53.2 | (+8.5) | 0.0 | (-2.1) | 12.8 |
| SEVerA (with parameter tuning) | 66.0 | (+21.3) | 0.0 | (-2.1) | 11.7 |
| Configuration | Accuracy (%) | Violation (%) | ||
|---|---|---|---|---|
| LLM (Qwen3-8B) | 38.3 | 10.6 | ||
| SEVerA (no parameter tuning) | 53.2 | (+14.9) | 0.0 | (-10.6) |
| SEVerA (local only parameter tuning) | 55.3 | (+17.0) | 0.0 | (-10.6) |
| SEVerA (global only parameter tuning) | 61.7 | (+23.4) | 0.0 | (-10.6) |
| SEVerA (full) | 66.0 | (+27.7) | 0.0 | (-10.6) |
| Benchmark | Trig. | FB Acc. | Gain | Gain ∗ |
|---|---|---|---|---|
| HumanEvalDafny | 5.1 | 5.1 | +10.1 | +8.1 |
| DafnyBench | 7.9 | 29.3 | +7.5 | +5.9 |
| -Retail | 15.6 | 5.2 | +11.4 | +10.6 |
| -Airline | 21.6 | 5.4 | +13.2 | +9.7 |
| GSM-Symbolic | 2.1 | 0.0 | +21.3 | +21.3 |
| Benchmark | Sampler | Trig. | Perf. |
|---|---|---|---|
| HumanEvalDafny | Stateless | 9.1 | 88.8 |
| Stateful | 5.1 | 97.0 |
Appendix figures & tables16 assets
Supplementary material from the paper’s appendix.
Appendix
| Category | Hyperparameter | Value |
| Shared pipeline | Planner search budget ( ) | 10 |
| FGGM rejection-sample budget ( ) | 5 | |
| In-context examples | 3 (2 for -bench) | |
| GRPO / LoRA (GSM-Symbolic) | Base model | Qwen3-8B |
| LoRA rank | 16 | |
| LoRA alpha ( ) | 32 |
| Task | Method | Input | Output | Total |
|---|---|---|---|---|
| HumanEvalDafny | Baseline (Claude Sonnet 4.5) | 860 | 639 | 1,499 |
| DafnyBench | 2,254 | 1,836 | 4,090 | |
| SEVerA | 2,740 | 2,279 | 5,019 | |
| DafnyBench | Baseline (Claude Sonnet 4.5) | 925 | 836 | 1,761 |
| DafnyBench | 3,419 | 1,968 | 5,387 | |
| SEVerA | 4,123 | 2,302 | 6,425 |
Agentic Code Generation
Agentic code generation uses AI agents to plan, write, test, and revise executable programs with tools and feedback.
See all 121 papers