Hostname: page-component-76d6cb85b7-pn7tm Total loading time: 0 Render date: 2026-07-10T05:40:24.646Z Has data issue: false hasContentIssue false

From Reasoning to Code: GRPO Optimization for Underrepresented Languages

Published online by Cambridge University Press:  08 July 2026

FEDERICO PENNINO
Affiliation:
DISI, Università di Bologna, Italy (e-mail: federico.pennino2@unibo.it)
BIANCA RAIMONDI
Affiliation:
DISI, Università di Bologna, Italy (e-mail: federico.pennino2@unibo.it)
MASSIMO RONDELLI
Affiliation:
DISI, Università di Bologna, Italy (e-mail: federico.pennino2@unibo.it)
ANDREA GURIOLI
Affiliation:
DISI, Università di Bologna, Italy (e-mail: federico.pennino2@unibo.it)
MAURIZIO GABBRIELLI
Affiliation:
DISI, Università di Bologna, Italy (e-mail: federico.pennino2@unibo.it)
Rights & Permissions [Opens in a new window]

Abstract

Generating accurate and executable code using Large Language Models (LLMs) remains a significant challenge for underrepresented programming languages, such as Prolog and Lisp, due to the scarcity of public training data compared to high-resource languages like Python. This paper introduces a generalizable Reinforcement Learning (RL) approach that combines small-scale versions of the Qwen2.5-Coder model with Group Relative Policy Optimization (GRPO) to enable effective code generation through reasoning. To address the limitations of sparse datasets, we integrate execution-driven feedback directly into the RL loop, utilizing a reward system that exploits both logical correctness and structural formatting. Experimental results on GSM8K dataset demonstrate significant improvements in reasoning quality and code accuracy across underrepresented languages. These findings underscore the potential of our approach to benefit a wide range of programming languages lacking extensive training resources by leveraging symbolic reasoning and interpreter-based feedback.

Information

Type
Original Article
Creative Commons
Creative Common License - CCCreative Common License - BY
This is an Open Access article, distributed under the terms of the Creative Commons Attribution licence (https://creativecommons.org/licenses/by/4.0/), which permits unrestricted re-use, distribution and reproduction, provided the original article is properly cited.
Copyright
© The Author(s), 2026. Published by Cambridge University Press
Figure 0

Fig. 1. Schematic representation of the GRPO training pipeline. The framework utilizes Qwen2.5-Coder to generate Prolog solutions, which are then evaluated via PySwip to provide execution-based reward signals.

Figure 1

Table 1. Reward function breakdown

Figure 2

Fig. 2. pass@4 and pass∧4$^\wedge 4$ results for Qwen2.5-Coder models in zero-shot and one-shot settings.

Figure 3

Fig. 3. Fig. 3 long description.Examples of Prolog code generated by the trained models on GSM8K problems. Green dots indicate solutions that executed correctly and returned the expected answer. Red dots denote solutions that failed due to logical or syntax errors. Yellow dots highlight generations that, while syntactically plausible, were just hardcoding the final value.

Figure 4

Fig. 4. (a) Completion length for six Qwen model variants (0.5B, 1.5B, 3B, 7B with and without one-shot prompting) over training steps; (b) Comparison of different strategies applied to Qwen2.5-Coder-7B: completion length (left y-axis) and pass@k (right y-axis). Models are grouped by level of supervision (zero-shot vs. one-shot) and whether length constraints or KL-regularization are applied.

Figure 5

Table 2. pass@4 scores for Qwen2.5-Codertrained with new reward function, reporting results for both standard and length-optimized reward functions

Figure 6

Table 3. pass@4 scores for GSM-symbolic p1 and p2 datasets

Figure 7

Table 4. pass@4 scores for GSM-8K dataset for lisp