Skip to main navigation Skip to search Skip to main content

LLM-Assisted Translation and Bounded Model Checking of Python Code

  • Shivkumar Shivaji*
  • , Natalia Lobakhina
  • , Klaus Havelund
  • , Alessandro Pinto
  • , Lucas Cordeiro
  • *Corresponding author for this work

Research output: Chapter in Book/Conference proceedingConference contributionpeer-review

Abstract

Formal verification of Python programs remains challenging due to the language’s dynamic nature and rich semantic constructs. We present an approach that combines Large Language Models (LLMs) with Bounded Model Checking (BMC) to verify Python code. Our system uses an LLM to translate Python programs into C code suitable for formal verification using ESBMC, enabling the detection of critical bugs, including arithmetic overflows, array bounds violations, and concurrency errors. We evaluate our approach on a benchmark of 23 carefully designed Python programs with planted bugs representing common verification challenges. The LLM orchestrator successfully detected all planted bugs by iteratively coordinating static, dynamic, and formal verification tools. Our results demonstrate that LLM-assisted translation can make mature C verification tools accessible for Python code analysis, though the approach is limited to programs amenable to BMC (15–50 lines, bounded loops, statically-sized data structures).
Original languageEnglish
Title of host publication3rd Artificial Intelligence ISoLA
Publication statusAccepted/In press - 1 Feb 2026

Keywords

  • formal verification
  • bounded model checking
  • Python
  • large language models
  • code translation

Fingerprint

Dive into the research topics of 'LLM-Assisted Translation and Bounded Model Checking of Python Code'. Together they form a unique fingerprint.

Cite this