CodeGrad: Integrating Multi-Step Verification with Gradient-Based LLM Refinement

Fuente: arXiv
Guardado en:
Detalles Bibliográficos
Autores principales: Zhang, Yueke, Zhang, Yifan, Leach, Kevin, Huang, Yu
Formato: Preprint
Publicado: 2025
Materias:
Acceso en línea:
Etiquetas: Agregar Etiqueta
Sin Etiquetas, Sea el primero en etiquetar este registro!
_version_ 1866909767885127680
author Zhang, Yueke
Zhang, Yifan
Leach, Kevin
Huang, Yu
author_facet Zhang, Yueke
Zhang, Yifan
Leach, Kevin
Huang, Yu
contents While Large Language Models (LLMs) have demonstrated remarkable capabilities in code generation, they often produce solutions that lack guarantees of correctness, robustness, and efficiency. This limitation is particularly acute in domains requiring strict constraints. CodeGrad introduces a principled framework that integrates rigorous verification techniques directly into an iterative LLM-based generation loop. It uniquely treats code as a differentiable variable, converting structured feedback and mathematical constraints into a textual pseudo-gradient. This gradient guides the model to iteratively refine solutions, ensuring they are not only functional but also robust and mathematically justified. We evaluate CodeGrad on the HumanEval, HumanEval+, and LiveCodeBench benchmarks. Our implementation outperforms strong baselines, achieving an absolute improvement of up to 27% on HumanEval and a 41% relative improvement on the challenging LiveCodeBench V6. StructuredGrad generates mathematically justified code that is robust and efficient, paving the way for reliable AI-assisted software development in high-stakes applications.
format Preprint
id arxiv_https___arxiv_org_abs_2508_10059
institution arXiv
publishDate 2025
record_format arxiv
spellingShingle CodeGrad: Integrating Multi-Step Verification with Gradient-Based LLM Refinement
Zhang, Yueke
Zhang, Yifan
Leach, Kevin
Huang, Yu
Software Engineering
While Large Language Models (LLMs) have demonstrated remarkable capabilities in code generation, they often produce solutions that lack guarantees of correctness, robustness, and efficiency. This limitation is particularly acute in domains requiring strict constraints. CodeGrad introduces a principled framework that integrates rigorous verification techniques directly into an iterative LLM-based generation loop. It uniquely treats code as a differentiable variable, converting structured feedback and mathematical constraints into a textual pseudo-gradient. This gradient guides the model to iteratively refine solutions, ensuring they are not only functional but also robust and mathematically justified. We evaluate CodeGrad on the HumanEval, HumanEval+, and LiveCodeBench benchmarks. Our implementation outperforms strong baselines, achieving an absolute improvement of up to 27% on HumanEval and a 41% relative improvement on the challenging LiveCodeBench V6. StructuredGrad generates mathematically justified code that is robust and efficient, paving the way for reliable AI-assisted software development in high-stakes applications.
title CodeGrad: Integrating Multi-Step Verification with Gradient-Based LLM Refinement
topic Software Engineering
url https://arxiv.org/abs/2508.10059