TensorX
返回文献探索

Paper · arXiv 2310.09342

Ranking LLM-Generated Loop Invariants for Program Verification

Saikat Chakraborty, Shuvendu K. Lahiri, Sarah Fakhoury, Madanlal Musuvathi, Akash Lal, Aseem Rastogi, Aditya Senthilnathan, Rahul Sharma, Nikhil Swamy

3 upvotesOctober 13, 2023arXiv 预印本
AI 摘要

A re-ranking approach using a contrastive ranker improves the accuracy of synthesized loop invariants from LLMs, reducing the need for program verifier calls.

Large Language Models (LLMs)synthesizeinductive loop invariantsre-rankingcontrastive ranker

Abstract

Synthesizing inductive loop invariants is fundamental to automating program verification. In this work, we observe that Large Language Models (such as gpt-3.5 or gpt-4) are capable of synthesizing loop invariants for a class of programs in a 0-shot setting, yet require several samples to generate the correct invariants. This can lead to a large number of calls to a program verifier to establish an invariant. To address this issue, we propose a {\it re-ranking} approach for the generated results of LLMs. We have designed a ranker that can distinguish between correct inductive invariants and incorrect attempts based on the problem definition. The ranker is optimized as a contrastive ranker. Experimental results demonstrate that this re-ranking mechanism significantly improves the ranking of correct invariants among the generated candidates, leading to a notable reduction in the number of calls to a verifier.

北京市昌平区探索星信息技术及软件开发工作室

京ICP备2026059466号