Calculation Model Generation from Natural Language via DSL and JSON
Find Innovative SolutionsGenerate Solutions
Solution Overview
Problem
Current calculation models are generated manually, which is labor-intensive and prone to user error, often leading to the use of inappropriate or incorrect functions for the desired calculation.
Innovation Solution
Utilize a large language model, such as the Generative Pre-trained Transformer (GPT), combined with prompt engineering and domain-specific language (DSL) to automatically generate a calculation model from a user's natural language input, converting it to JSON format for precision.
Engineering Contradictions & Design Principles
Engineering Contradiction Analysis
1Ease of operation
If manual generation of calculation models is used, then flexibility in model selection is maintained, but labor intensity and user error increase
Solution Approach 1:
The system performs automatic generation of calculation models using machine learning algorithms, eliminating the need for manual model construction. The system serves itself by automatically selecting appropriate functions and parameters based on input data characteristics, thereby reducing both labor intensity and user error while maintaining model accuracy.
Solution Approach 2:
The manual mechanical process of selecting and constructing calculation models is replaced with an automated computational system using machine learning. The system substitutes human operators with algorithms that automatically generate models, convert them to executable code, and validate results, thereby improving reliability while maintaining operational flexibility.
2Reliability
If automatic generation using large language models is implemented, then user error is reduced, but system complexity increases
Solution Approach 1:
A domain-specific language (DSL) layer is introduced as an intermediary between the large language model and the final calculation model. The LLM generates models in this controlled intermediate language with predefined structures and validation rules, which then gets automatically converted to executable code. This intermediary layer simplifies the overall system by providing a buffer that manages complexity while ensuring accuracy.
Solution Approach 2:
The system transforms the unstructured natural language output of the LLM into a structured DSL format with specific parameter constraints and validation rules. By changing the parameter representation from free-form text to structured data with defined schemas, the system reduces complexity in the conversion process while maintaining high accuracy in the generated calculation models.
Data Source
Figure 1
Figure 2
Figure 3
AI summary
A computer-implemented method, computer system, and computer program product for generating a calculation model. An input natural language text prompt describing a calculation in a particular domain is received. Using a large language model, a domain-specific language (DSL) version of the input text prompt is generated and the DSL version of the prompt is converted to a JavaScript Object Notation (JSON) form that represents a model of the calculation, resulting in a calculation model, which is output to a user.