Large Language Model-Driven Framework for Automated Constraint Model Generation in Configuration Problems
Source abstract
Abstract
Constraint satisfaction problems (CSPs) are widely used in domains such as product configuration, scheduling, and resource allocation. However, formulating constraint models remains a significant challenge that often requires specialized expertise in constraint programming (CP). This study introduces the Automatic Constraint Model Generator (ACMG), a novel framework that leverages fine-tuned large language models (LLMs) to automate the translation of natural language problem descriptions into formal CSP models. The ACMG employs a multi-step process involving semantic entity extraction, constraint model generation, and iterative validation using the MiniZinc solver. Our approach achieves state-of-the-art (SOTA) or near-SOTA results, demonstrating the viability of LLMs in simplifying the adoption of CP. Its key contributions include a high-quality dataset for fine-tuning, a modular architecture with specialized LLM components, and empirical validation which shows its promising results for complex configuration tasks. By bridging the gap between natural language and formal constraint models, the ACMG significantly lowers the barrier to CP, making it more accessible to non-experts while maintaining a high level of robustness for industrial applications.
Source: crossref · Quality: baseline
Research context
OpenAlex topics: Model-Driven Software Engineering Techniques · Constraint Satisfaction and Optimization · Assembly Line Balancing Optimization
SciVX discovery tags are terminology-based. OpenAlex topics are source-provided classifications.
Affiliations
Ericsson Nikola Tesla d.d., Krapinska 45, 10000 Zagreb, Croatia
University of Zagreb Faculty of Electrical Engineering and Computing, 10000 Zagreb, Croatia
Funding
Ericsson Nikola Tesla d.d
References (57)
Show source-provided references
1. Rossi, F., van Beek, P., and Walsh, T. (2006). Handbook of Constraint Programming, Elsevier.
2. Tsouros, D., Verhaeghe, H., Kadıoğlu, S., and Guns, T. (2023). Holy Grail 2.0: From natural language to constraint models. arXiv.
3. Grand challenges for constraint programming10.1007/s10601-013-9155-1 ↗
4. Yuksekgonul, M., Chandrasekaran, V., Jones, E., Gunasekar, S., Naik, R., Palangi, H., Kamar, E., and Nushi, B. (2023). Attention satisfies: A constraint-satisfaction lens on factual errors of language models. arXiv.
5. Régin, F., De Maria, E., and Bonlarron, A. (2024). Combining constraint programming reasoning with large language model predictions. arXiv.
6. Vaswani, A., Shazeer, N., Parmar, N., Uszkoreit, J., Jones, L., Gomez, A.N., Kaiser, Ł., and Polosukhin, I. (2017). Attention is all you need. arXiv.
7. ImageNet classification with deep convolutional neural networks
8. Jiang, J., Wang, F., Shen, J., Kim, S., and Kim, S. (2024). A survey on large language models for code generation. arXiv.
9. OpenAI (2025, April 01). ChatGPT: A Large Language Model. Available online: https://chat.openai.com.
10. Ridnik, T., Kredo, D., and Friedman, I. (2024). Code generation with AlphaCodium: From prompt engineering to flow engineering. arXiv.
11. Chen, M., Tworek, J., Jun, H., Yuan, Q., Pinto, H.P.D.O., Kaplan, J., Edwards, H., Burda, Y., Joseph, N., and Brockman, G. (2021). Evaluating large language models trained on code. arXiv.
12. Kahneman, D. (2011). Thinking, Fast and Slow, Farrar, Straus and Giroux.
13. Yao, S., Yu, D., Zhao, J., Shafran, I., Griffiths, T.L., Chen, Y., and Narasimhan, K. (2023). Tree of thoughts: Deliberate problem solving with large language models. arXiv.
14. Lee, J., Tay, Y., Bommasani, R., Raffel, C., Zoph, B., Borgeaud, S., Yogatama, D., Bosma, M., Zhou, D., and Metzler, D. (2022). Emergent abilities of large language models. arXiv.
15. Chung, H.W., Hou, L., Longpre, S., Zoph, B., Tay, Y., Fedus, W., Li, E., Wang, X., Dehghani, M., and Brahma, S. (2022). Scaling instruction-finetuned language models. arXiv.
16. Almonacid, B. (2023). Towards an automatic optimisation model generator assisted with generative pre-trained transformers. arXiv.
17. Constraint modelling with LLMs using in-context learning
18. Nicosia, G., Pardalos, P., Giuffrida, G., Umeton, R., and Sciacca, V. (2023). Ner4Opt: Named entity recognition for optimization modelling from natural language. Machine Learning, Optimization, and Data Science, Springer.
19. Penco, R. (2025, April 01). Dataset for Fine-Tuning LLM to Generate Minizinc [Data Set]. Kaggle. Available online: https://doi.org/10.34740/KAGGLE/DSV/11207997.
20. (2025, April 01). ACMG Code Repository. Available online: https://github.com/erobpen/ACMG/.
21. Minaee, S., Mikolov, T., Nikzad, N., Chenaghlu, M., Socher, R., Amatriain, X., and Gao, J. (2024). Large language models: A survey. arXiv.
22. Chowdhery, A., Narang, S., Devlin, J., Bosma, M., Mishra, G., Roberts, A., Barham, P., Chung, H.W., Sutton, C., and Gehrmann, S. (2022). PaLM: Scaling language modeling with Pathways. arXiv.
23. Touvron, H., Lavril, T., Izacard, G., Martinet, X., Lachaux, M., Lacroix, T., Rozière, B., Goyal, N., Hambro, E., and Azhar, F. (2023). LLaMA: Open and efficient foundation language models. arXiv.
24. OpenAI (2023). GPT-4 technical report. arXiv.
25. Enis, M., and Hopkins, M. (2024). From LLM to NMT: Advancing low-resource machine translation with Claude. arXiv.
26. Zhang, S., Dong, L., Li, X., Zhang, S., Sun, X., Wang, S., Li, J., Hu, R., Zhang, T., and Wu, F. (2023). Instruction tuning for large language models: A survey. arXiv.
27. Sahoo, P., Singh, A.K., Saha, S., Jain, V., Mondal, S., and Chadha, A. (2024). A systematic survey of prompt engineering in large language models: Techniques and applications. arXiv.10.1007/979-8-8688-0569-1_4 ↗
28. Wei, J., Bosma, M., Zhao, V.Y., Guu, K., Yu, A.W., Lester, B., Du, N., Dai, A.M., and Le, Q.V. (2021). Finetuned language models are zero-shot learners. arXiv.
29. Liu, P., Yuan, W., Fu, J., Jiang, Z., Hayashi, H., and Neubig, G. (2021). Pre-train, prompt, and predict: A systematic survey of prompting methods in natural language processing. arXiv.
30. Radford, A., Narasimhan, K., Salimans, T., and Sutskever, I. (2025, April 01). Improving Language Understanding by Generative Pre-Training. OpenAI. Available online: https://cdn.openai.com/research-covers/language-unsupervised/language_understanding_paper.pdf.
31. Khashabi, D., Min, S., Khot, T., Sabharwal, A., Tafjord, O., Clark, P., and Hajishirzi, H. (2020). UnifiedQA: Crossing format boundaries with a single QA system. arXiv.10.18653/v1/2020.findings-emnlp.171 ↗
32. Brown, T.B., Mann, B., Ryder, N., Subbiah, M., Kaplan, J., Dhariwal, P., Neelakantan, A., Shyam, P., Sastry, G., and Askell, A. (2020). Language models are few-shot learners. arXiv.
33. Lewis, P., Perez, E., Piktus, A., Petroni, F., Karpukhin, V., Goyal, N., Küttler, H., Lewis, M., Yih, W., and Rocktäschel, T. (2020). Retrieval-Augmented Generation for Knowledge-Intensive NLP Tasks. arXiv.
34. Gao, L., Madaan, A., Zhou, S., Alon, U., Liu, P., Yang, Y., Callan, J., and Neubig, G. (2022). PAL: Program-aided language models. arXiv.
35. Doan, X.-D. (2022). VTCC-NLP at nl4opt competition subtask 1: An ensemble pre-trained language models for named entity recognition. arXiv.
36. Ning, Y., Liu, J., Qin, L., Xiao, T., Xue, S., Huang, Z., Liu, Q., Chen, E., and Wu, J. (2023). A novel approach for auto-formulation of optimization problems. arXiv.
37. Wang, K., Chen, Z., and Zheng, J. (2023). Opd@nl4opt: An ensemble approach for the NER task of the optimization problem. arXiv.
38. Ramamonjison, R., Yu, T.T., Li, R., Li, H., Carenini, G., Ghaddar, B., He, S., Mostajabdaveh, M., Banitalebi-Dehkordi, A., and Shi, Y. (2023). NL4Opt competition: Formulating optimization problems based on their natural language descriptions. arXiv.
39. Gunasekar, S., Zhang, Y., Aneja, J., Mendes, C.C., Del Giorno, A., Gopi, S., Javaheripi, M., Kauffmann, P., De Rosa, G., and Saarikivi, O. (2023). Textbooks Are All You Need. arXiv.
40. Nicosia, G., Pardalos, P., Umeton, R., Giuffrida, G., and Sciacca, V. (2022). Highlighting named entities in input for auto-formulation of optimization problems. Machine Learning, Optimization, and Data Science, Springer.
41. Nethercote, N., Stuckey, P.J., Becket, R., Brand, S., Duck, G.J., and Tack, G. (2007, January 25–29). MiniZinc: Towards a standard CP modelling language. Proceedings of the 13th International Conference on Principles and Practice of Constraint Programming, Providence, RI, USA.
42. Nightingale, P. (2021). Savile Row Manual. arXiv.
43. Akgün, Ö., Frisch, A.M., Gent, I.P., Jefferson, C., Miguel, I., Nightingale, P., and Salamon, A.Z. (2021). Towards Reformulating Essence Specifications for Robustness. arXiv.
44. Guns, T. (2019, January 30). Increasing Modeling Language Convenience with a Universal N-Dimensional Array, CPpy as Python-Embedded Example. Proceedings of the 18th Workshop on Constraint Modelling and Reformulation at CP (ModRef 2019), Stamford, CT, USA.
45. Stuckey, P.J., Marriott, K., and Tack, G. (2025, April 01). MiniZinc Documentation (Version 2.8.3). MiniZinc. Available online: https://www.minizinc.org/doc-latest/en/index.html.
46. (2025, April 01). ACMG Control Prompts Repository. Available online: https://github.com/erobpen/ACMG/tree/main/appendices/Appendix_1.
47. Efficient constraint propagation engines10.1145/1452044.1452046 ↗
48. Tack, G. (2009). Constraint Propagation: Models, Techniques, Implementation. [Ph.D. Dissertation, Saarland University]. Available online: https://www.gecode.org/papers/Tack_PhD_2009.pdf.
49. Schulte, C., Tack, G., and Lagerkvist, M.Z. (2025, April 01). Modeling and Programming with Gecode. Available online: https://www.gecode.org/doc-latest/MPG.pdf.
50. Google OR-Tools (2025, April 01). Google Optimization Tools. Available online: https://developers.google.com/optimization.
51. (2025, April 01). ACMG Validation Test Suite Repository. Available online: https://github.com/erobpen/ACMG/tree/main/appendices/Appendix_7.
52. Wei, J., Wang, X., Schuurmans, D., Bosma, M., Ichter, B., Xia, F., Chi, E., Le, Q., and Zhou, D. (2022). Chain-of-Thought Prompting Elicits Reasoning in Large Language Models. arXiv.
53. Soudani, H., Kanoulas, E., and Hasibi, F. (2024). Fine Tuning vs. Retrieval Augmented Generation for Less Popular Knowledge. arXiv.10.1145/3673791.3698415 ↗
54. Wang, Y., Kordi, Y., Mishra, S., Liu, A., Smith, N.A., Khashabi, D., and Hajishirzi, H. (2022). Self-Instruct: Aligning Language Models with Self-Generated Instructions. arXiv.10.18653/v1/2023.acl-long.754 ↗
55. Hoffmann, J., Borgeaud, S., Mensch, A., Buchatskaya, E., Cai, T., Rutherford, E., Casas, D.D., Hendricks, L.A., Welbl, J., and Clark, A. (2022). Training Compute-Optimal Large Language Models. arXiv.
56. Guo, D., Yang, D., Zhang, H., Song, J., Zhang, R., Xu, R., Zhu, Q., Ma, S., Wang, P., and Bi, X. (2025). DeepSeek-R1: Incentivizing Reasoning Capability in LLMs via Reinforcement Learning. arXiv.
57. Bai, J., Bai, S., Chu, Y., Cui, Z., Dang, K., Deng, X., Fan, Y., Ge, W., Han, Y., and Huang, F. (2023). Qwen Technical Report. arXiv.