用大模型当裁判,自动评估和优化生成的Bash脚本质量。
LLM-as-a-Judge for Reference-less Automatic Code Validation and Refinement for Natural Language to Bash in IT Automation
- 设计双向匹配与逻辑表示,让大模型无参考地判断Bash代码正确性。
- 评估准确率媲美执行测试,最高比基线提升8%。
- 构建反思型代码代理,使代码自优化,准确率最高提升24%。
为自动评估并选择最佳模型以提升IT自动化中故障修复代码的质量,需验证生成的修复代码在语法、语义上是否正确且可按预期执行。现有方法包括:1)基于表面形式相似性(如词元匹配、精确匹配)的常规方法,存在诸多局限;2)基于执行的评估,依赖测试用例的通过/失败判断功能;3)大模型作为裁判(LLM-as-a-Judge),依据预定义指标判断答案正确性。本文聚焦于增强无参考的自动验证与优化能力,提出结合双向功能匹配与逻辑表示的大模型裁判方法,用于自然语言转Bash代码的生成任务。以执行结果为真实标签评估其性能,结果显示该方法在准确率与一致性上表现优异,最高较基线提升8%。此外,我们构建了反思式代码代理,利用评估反馈进行代码迭代优化,实现高达24%的准确率提升。
原文摘要 · Abstract (English)
In an effort to automatically evaluate and select the best model and improve code quality for automatic incident remediation in IT Automation, it is crucial to verify if the generated code for remediation action is syntactically and semantically correct and whether it can be executed correctly as intended. There are three approaches: 1) conventional methods use surface form similarity metrics (token match, exact match, etc.) which have numerous limitations, 2) execution-based evaluation focuses more on code functionality based on pass/fail judgments for given test-cases, and 3) LLM-as-a-Judge employs LLMs for automated evaluation to judge if it is a correct answer for a given problem based on pre-defined metrics. In this work, we focused on enhancing LLM-as-a-Judge using bidirectional functionality matching and logic representation for reference-less automatic validation and refinement for Bash code generation to select the best model for automatic incident remediation in IT Automation. We used execution-based evaluation as ground-truth to evaluate our LLM-as-a-Judge metrics. Results show high accuracy and agreement with execution-based evaluation (and up to 8% over baseline). Finally, we built Reflection code agents to utilize judgments and feedback from our evaluation metrics which achieved significant improvement (up to 24% increase in accuracy) for automatic code refinement.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。