## 4 Automatic Constraint Model Generator (ACMG)
### ACMG Process  
The generic building blocks of the ACMG process are provided in Figure 4. The input message prepared by the ACMG engine (yellow) is the input for the next step of the ACMG process (dark blue outline). In this step, the ACMG aggregates the input message with the corresponding control prompt (green); which control prompt is selected depends on the present phase of the ACMG process. This aggregated prompt is sent to the LLM, which generates an output prompt; that is, a message (light blue). Note that in Figure 4, there is a light blue box with the text v/f LLM, denoting that this can be either a vanilla or fine-tuned LLM. The ablation study (Section 5.3) we conducted demonstrates the consequences of using different combinations of vanilla and fine-tuned LLMs. Figure 4: Generic building blocks of the ACMG process. The key steps to our approach are provided in Figure 5. Figure 5 consists of a specific instantiation of the building block shown in Figure 4 (steps 7 and 8 are omitted in Figure 5 as they do not require communication with the LLM). The pipeline decomposes constraint modeling into four formally distinct phases (see Appendix A). The full data flow is shown in Figure 5.  
The numbers in the figures refer to the steps of the process, detailed descriptions of which are provided below:  
1. A natural language prompt (i.e., the user's message) is forwarded to the LLM to discern the content of the user's message. With help from the specially designed control prompt [46], an attempt is made to extract the constraint task and model description. 2. The input user message is separated into a constraint task and a model. Each has a separate flow, indicated by 2.a and 2.b. In addition, in this step, with help from the LLM, a name is generated for the new model that is about to be created. 3. At this stage, the fine-tuned LLM (the Recognizer) is used to recognize (i.e., extract) the relevant semantic entities from the prompt. Those extracted entities and the original messages that contain the model described in natural language are forwarded to step 4. This step is inspired by studies of the authors of [18; 19]. Figures 5 and 6 show steps 3 and 4, respectively. Green is the control prompt fetched from the memory module, yellow are the prompts prepared by the ACMG engine, and blue is the response from the LLM. Figure 5: Overview of the ACMG process (**a**) and its data flow (**b**). Figure 7 shows an example of an aggregated input prompt based on the example shown in Figure 6. This prompt is constructed from the model, which is parsed from the input user message. The input user message is presented in the description of Figure 3, which is provided in the last paragraph of Section 2.3. The input user message is parsed in step 2, and the model and the constraint task are extracted. In Figure 4, the top box on the left contains the parsed model, while the bottom box on the left contains the control prompt for the recognition step. These two prompts are concatenated; the result of this concatenation is presented in Figure 7 and sent to the LLM, while Figure 8 shows an example of the prompts used during the ACMG process's Generator phase. From the given text, extract the following semantic entities: Input parameters, Constraints, Relations between parameters. There are two types of boards: Board A and Board B. Board A can only go into odd slots, and Board B can go into any slot, but not three in sequence. There are three Board As and five Board Bs. Allocate Board As and Bs into available free slots. Next, another fine-tuned LLM (the Generator) uses the semantic entities and the model description from step 2 to generate a constraint model in the MiniZinc modeling language. The generated MiniZinc model is forwarded to step 6. The constraint task is still in natural language form. The constraint task, the valid MiniZinc model generated in step 6, and the relevant control prompt are sent to the LLM, which transforms the constraint task into a data MiniZinc file, i.e., dzn file [46].