Skip to main navigation Skip to search Skip to main content

NL2SMT — A LLM based SMT-LIB generation framework

  • East China Normal University
  • National Trusted Embedded Software Engineering Technology Research Center

Research output: Contribution to journal › Article › peer-review

Abstract

Context: SMT-LIB is the most widely adopted standard language for SMT - Satisfiability Module Theories, a fundamental problem in automated reasoning. Translating natural language (NL) into SMT-LIB formulas is a critical step toward making formal verification more accessible and automatable. Recent advances in large language models (LLMs) provide a promising foundation for NL-to-formal translation, yet applying LLMs to SMT-LIB remains challenging due to the intricate logical structures and strict syntactic requirements of SMT-LIB assertions. Objective: This paper aims to leverage large language models to address the NL-to-SMT translation problem by designing an LLM-based two-stage framework that combines prompting with model finetuning. Methods: We propose an LLM-based two-stage framework for NL-to-SMT translation. First, we construct a dataset of over 5000 NL–SMT pairs by applying few-shot prompting with LLMs to SMT assertions extracted from SMT-LIB benchmarks. In the translation stage, to bridge the gap between natural language and SMT-LIB, each NL input is transformed into a structured intermediate representation that reflects its underlying syntactic and logical structure through syntax-aware prompting. Then, a finetuned language model converts this intermediate representation into the corresponding SMT assertion. Results: Experimental results demonstrate that the proposed LLM-based two-stage framework significantly outperforms direct end-to-end LLM prompting, achieving up to 90.56% accuracy through the combination of GPT-4o prompting and a finetuned T5-large model. Conclusions: This work demonstrates that an LLM-based two-stage framework effectively addresses the challenges of translating natural language into SMT-LIB assertions. By combining LLM-driven syntax-aware prompting with LLM finetuning, the proposed approach improves translation accuracy over end-to-end LLM prompting. The results also suggest that this LLM-centered decomposition may benefit other NL-to-formal translation tasks.

Original languageEnglish
Article number108229
JournalInformation and Software Technology
Volume198
DOIs
StatePublished - Oct 2026

Keywords

  • Large language model
  • Model finetuning
  • Prompt engineering
  • SMT-LIB

Fingerprint

Dive into the research topics of 'NL2SMT — A LLM based SMT-LIB generation framework'. Together they form a unique fingerprint.

Cite this