Lune

ICML2023Top-tier venue

Can Large Language Models Reason about Program Invariants?

Kexin Pei, David Bieber, Kensen Shi, Charles Sutton, Pengcheng Yin

Abstract

Identifying invariants is an important program analysis task with applications towards program understanding, bug finding, vulnerability analysis, and formal verification. Existing tools for identifying program invariants rely on dynamic analysis, requiring traces collected from multiple executions in order to produce reliable invariants. We study the application of large language models to invariant prediction, finding that models trained on source code and fine-tuned for invariant generation can perform invariant prediction as static rather than dynamic analysis. Using a scratchpad approach where invariants are predicted sequentially through a program gives the best performance, finding invariants statically of quality comparable to those obtained by a dynamic analysis tool with access to five program traces.

Ask Lune

Know this paper in minutes, not an afternoon.

Lune can read every page of it and the top-tier papers that cite it, and gives you its claims, its evidence and its limits, each one cited to the paper it comes from. No skimming, no AI slop.

38 top-tier papers have cited it since. Know what they found before your reviewers do.

Questions to start from

Lune can draw on

the full paper · the top-tier papers that cite it · related work

Get the answer

Free to start. No credit card required.

Lineage

  • Enchanting Program Specification Synthesis by Large Language Models Using Static Analysis and Program Verification cites Lemur: Integrating Large Language Models in Automated Program Verification
  • Representing Partial Programs with Blended Abstract Semantics cites Learning to Represent Programs with Property Signatures
  • NExT: Teaching Large Language Models to Reason about Code Execution cites Static Prediction of Runtime Errors by Learning to Execute Programs with External Resource Descriptions
  • NExT: Teaching Large Language Models to Reason about Code Execution cites Learning to Execute Programs with Instruction Pointer Attention Graph Neural Networks
  • Static Prediction of Runtime Errors by Learning to Execute Programs with External Resource Descriptions cites Learning to Execute Programs with Instruction Pointer Attention Graph Neural Networks
Builds onCited byLeft to right by year; the more cited, the higher.

Cited by top-tier papers38

  1. "Do Anything Now": Characterizing and Evaluating In-The-Wild Jailbreak Prompts on Large Language ModelsXinyue Shen, Zeyuan Chen, Michael Backes, Yun Shen et al.CCS 2024 · 132 citations
  2. NExT: Teaching Large Language Models to Reason about Code ExecutionAnsong Ni, Miltiadis Allamanis, Arman Cohan, Yinlin Deng et al.ICML 2024 · 73 citations
  3. CodePlan: Repository-Level Coding using LLMs and PlanningRamakrishna Bairi, Atharv Sonwane, Aditya Kanade, Vageesh D. C. et al.FSE 2024 · 67 citations
  4. Lemur: Integrating Large Language Models in Automated Program VerificationHaoze Wu, Clark W. Barrett, Nina NarodytskaICLR 2024 · 67 citations
  5. Enchanting Program Specification Synthesis by Large Language Models Using Static Analysis and Program VerificationCheng Wen, Jialun Cao, Jie Su, Zhiwu Xu et al.CAV 2024 · 60 citations

Builds on5

  1. CLN2INV: Learning Loop Invariants with Continuous Logic NetworksGabriel Ryan, Justin Wong, Jianan Yao, Ronghui Gu et al.ICLR 2020 · 72 citations
  2. Learning to Execute Programs with Instruction Pointer Attention Graph Neural NetworksDavid Bieber, Charles Sutton, Hugo Larochelle, Daniel TarlowNeurIPS 2020 · 51 citations
  3. Learning to Represent Programs with Property SignaturesAugustus Odena, Charles SuttonICLR 2020 · 34 citations
  4. Representing Partial Programs with Blended Abstract SemanticsMaxwell I. Nye, Yewen Pu, Matthew Bowers, Jacob Andreas et al.ICLR 2021 · 23 citations
  5. Static Prediction of Runtime Errors by Learning to Execute Programs with External Resource DescriptionsDavid Bieber, Rishab Goel, Daniel Zheng, Hugo Larochelle et al.ICLR 2023 · 2 citations

Related papers

  1. LLM Meets Bounded Model Checking: Neuro-symbolic Loop Invariant InferenceGuangyuan Wu, Weining Cao, Yuan Yao, Hengfeng Wei et al.ASE 2024 · 9 citations
  2. Ranking LLM-Generated Loop Invariants for Program VerificationSaikat Chakraborty, Shuvendu K. Lahiri, Sarah Fakhoury, Akash Lal et al.EMNLP Findings 2023 · 36 citations
  3. Not All Invariants Are Equal: Curating Training Data to Accelerate Program Verification with SLMsIdo Pinto, Yizhak Elboher, Haoze Wu, Nina Narodytska et al.ICML 2026 · 1 citation
  4. Towards More Accurate Static Analysis for Taint-Style Bug Detection in Linux KernelHaonan Li, Hang Zhang, Kexin Pei, Zhiyun QianASE 2025 · 5 citations
  5. NESA: Relational Neuro-Symbolic Static Program AnalysisChengpeng Wang, Yifei Gao, Wuqi Zhang, Xuwei Liu et al.FSE 2026 · 1 citation
Dusk over the sea between two cliffs drawn in fine vertical lines