A Solver-in-the-Loop Framework for Improving LLMs on Answer Set Programming for Logic Puzzle Solving

Read full text
Authors: Association for Artificial Intelligence 2026, Annemarie Friedrich, Tobias Kaminski, Lukas Lange, Simon Razniewski, Timo Pierre Schrader
Cited by: 0

Abstract

The rise of large language models (LLMs) has sparked interest in coding assistants. While general purpose programming languages are well supported, generating code for domain-specific languages remains a challenging problem for LLMs. In this paper, we focus on the LLM-based generation of Answer Set Programming (ASP) code, a particularly effective approach for finding solutions to combinatorial search problems. However, the effectiveness of LLMs in ASP code generation is hindered by the limited number of examples seen during their initial pre-training phase. In this paper, we introduce a novel approach for solver-guided instruction-tuning of LLMs for addressing the highly complex semantic parsing task inherent in ASP code generation. We sample ASP statements for program continuations proposed by LLMs for unriddling logic puzzles and categorize them into chosen and rejected instances based on solver feedback. We then apply supervised fine-tuning to train LLMs on the curated data, and further improve robustness using a solver-guided search that includes best-of-N sampling. Our experiments demonstrate consistent improvements in two distinct prompting settings on different datasets.

Fields of Study & Subjects

Logic Reasoning and Knowledge Topic Modeling Natural Language Processing Techniques

Publication details

Journal / source
Underline Science Inc.
Publication date
7 January 2026
Language
EN