KR2024Proceedings of the 21st International Conference on Principles of Knowledge Representation and ReasoningProceedings of the 21st International Conference on Principles of Knowledge Representation and Reasoning

Hanoi, Vietnam. November 2-8, 2024.

Edited by

ISSN: 2334-1033
ISBN: 978-1-956792-05-8

Sponsored by
Published by

Copyright © 2024 International Joint Conferences on Artificial Intelligence Organization

LLASP: Fine-tuning Large Language Models for Answer Set Programming

  1. Erica Coppolillo(University of Calabria, Rende, Italy, ICAR-CNR, Rende, Italy)
  2. Francesco Calimeri(University of Calabria, Rende, Italy, DLVSystem Srl, Rende, Italy)
  3. Giuseppe Manco(ICAR-CNR, Rende, Italy)
  4. Simona Perri(University of Calabria, Rende, Italy)
  5. Francesco Ricca(University of Calabria, Rende, Italy)

Keywords

  1. KR and Language Models-General
  2. ML for Reasoning-General
  3. Neuro-Symbolic AI-General

Abstract

Recently, Large Language Models (LLMs) have showcased their potential in various natural language processing tasks, including code generation. However, while significant progress has been made in adapting LLMs to generate code for several imperative programming languages and tasks, there remains a notable gap in their application to declarative formalisms, such as Answer Set Programming (ASP). In this paper, we move a step towards exploring the capabilities of LLMs for ASP code generation. First, we perform a systematic evaluation of several state-of-the-art LLMs. Despite their power in terms of number of parameters, training data and computational resources, empirical results demonstrate inadequate performances in generating correct ASP programs. Therefore, we propose LLASP, a fine-tuned lightweight model specifically trained to encode fundamental ASP program patterns. To this aim, we create an ad-hoc dataset covering a wide variety of fundamental problem specifications that can be encoded in ASP. Our experiments demonstrate that the quality of ASP programs generated by LLASP is remarkable. This holds true not only when compared to the non-fine-tuned counterpart but also when compared to the majority of eager LLM candidates, particularly from a semantic perspective.

All the code and data used to perform the experiments are publicly available: https://github.com/EricaCoppolillo/LLASP.