Towards the LLM-Based Generation of Formal Specifications from Natural-Language Contracts: Early Experiments with Symboleo
Preprint
Abstract
Over the past decade, different domain-specific languages (DSLs) were proposed to formally specify requirements stated in legal contracts, mainly for analysis but also for code generation. Symboleo is a promising language in that area. However, writing formal specifications from natural-language contracts is a complex task, especial for legal experts who do not have formal language expertise. This paper reports on an exploratory experiment targeting the automated generation of Symboleo specifications from business contracts in English using Large Language Models (LLMs). Combinations (38) of prompt components are investigated (with/without the grammar, semantics explanations, 0 to 3 examples, and emotional prompts), mainly on GPT-4o but also to a lesser extent on 4 other LLMs. The generated specifications are manually assessed against 16 error types grouped into 3 severity levels. Early results on all LLMs show promising outcomes (even for a little-known DSL) that will likely accelerate the specification of legal contracts. However, several observed issues, especially around grammar/syntax adherence and environment variable identification (49%), suggest many areas where potential improvements should be investigated.Keywords
All Related Versions
This publication has 21 references indexed in Scilit:
- Towards the LLM-Based Generation of Formal Specifications from Natural-Language Contracts: Early Experiments with Symboleo2025
- SpecGen: Automated Generation of Formal Program Specifications via Large Language Models2025
- Extracting Formal Smart-Contract Specifications from Natural Language with LLMs2024
- SymboleoPC: checking properties of legal contractsSoftware and Systems Modeling, 2024
- Leveraging Large Language Models for Automatic Smart Contract Generation2024
- Automated generation of smart contract code from legal contract specifications with Symboleo2SCSoftware and Systems Modeling, 2024
- AutoMTLSpec: Learning to Generate MTL Specifications from Natural Language Contracts2023
- Specification and analysis of legal contracts with SymboleoSoftware and Systems Modeling, 2022
- From Legal Contracts to Formal Specifications: A Systematic Literature ReviewSN Computer Science, 2022
- Text mining tool for translating terms of contract into technical specifications: Development and application in the railway sectorComputers in Industry, 2021