Co-Synthesis of Code and Formal Models Using Large Language Models and Functors
Large Language Models (LLMs) have demonstrated remarkable capabilities in generating code from natural language descriptions, including code for parallel systems. However, ensuring that this code is free of errors, particularly in concurrent and synchronization-heavy contexts, remains a significant challenge. In this paper, we introduce a new approach that employs LLMs to co-synthesize the code, its formal model and the functor that establishes the mapping between the code and its formal model. The formal models are then verified against temporal logic specifications using model checking. The functors serve as human-auditable artifacts that help establish equivalence between the code and its formal model. Our methodology is demonstrated through experiments involving the co-synthesis of C code and its formal model for the dining philosophers problem. Our experimental results using models from OpenAI, Anthropic, and Meta evaluate the effectiveness of our approach.
Authors
- Rickard Ewetz (ORCID: https://orcid.org/0000-0002-4183-6926)
- Susmit Jha (ORCID: https://orcid.org/0000-0001-5983-9095)
- Alvaro Velasquez (ORCID: https://orcid.org/0000-0001-6757-105X)
- Sumit Kumar Jha (ORCID: https://orcid.org/0000-0003-0354-2940)
Institutions
- SRI International (US)
- University of Colorado Boulder (US)
- Florida International University (US)
- University of Florida (US)
- Menlo School (US)
Publication Details
- Published
- 2024-10-28
- DOI
- https://doi.org/10.1109/milcom61039.2024.10773930
- Citations
- 2
- Primary Topic
- Model-Driven Software Engineering Techniques
- Type
- article
- Field-Weighted Citation Impact
- 0.97