arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2512.07407cs.CL
收藏

训练语言模型以使用Prolog作为工具

Training Language Models to Use Prolog as a Tool

University of Southern Denmark(南丹麦大学)

Niklas Mellgren, Peter Schneider-Kamp, Lukas Galke Poech

AI总结:

本文探讨通过强化学习训练语言模型使用Prolog进行符号推理,发现正确性与可审计性之间存在权衡,影响模型性能与可解释性。

摘要:

语言模型经常生成合理但错误的推理轨迹,难以验证。我们研究了通过微调使模型使用Prolog作为外部符号推理工具,训练Qwen2.5-3B-Instruct使用Group Relative Policy Optimization (GRPO)在清理后的GSM8K数据集上。我们系统地调整提示结构、奖励组成(执行、语法、语义、结构)和推理协议(单次尝试、多次尝试和两种代理模式)。我们的强化学习方法在GSM8K上优于监督微调,所得到的3B模型在MMLU-STEM和MMLU-Pro上表现与7B少量样本基线相当。最重要的是,我们发现正确性与可审计性之间的权衡:仅优化正确性的配置学习将推理委托给自然语言并仅在最后计算中使用Prolog,而优化符号结构的配置会产生完全可审计的程序,但以准确性为代价。我们将这种权衡解释为奖励黑客的一种形式,并讨论其在安全关键领域部署神经符号系统的影响。我们的实验源代码可在https://github.com/aisilab/Prolog-as-a-Tool获取。

英文摘要:

Language models frequently produce plausible yet incorrect reasoning traces that are difficult to verify. We investigate fine-tuning models to use Prolog as an external symbolic reasoning tool, training Qwen2.5-3B-Instruct with Group Relative Policy Optimization (GRPO) on a cleaned version of GSM8K (which we release as gsm8k-prolog-prover). We systematically vary prompt structure, reward composition (execution, syntax, semantics, structure), and inference protocol (single-try, multiple-try, and two agentic modes). Our reinforcement learning approach outperforms supervised fine-tuning on GSM8K, and the resulting 3B model achieves zero-shot performance on MMLU-STEM and MMLU-Pro competitive with 7B few-shot baselines. Most importantly, we identify an accuracy--auditability trade-off: configurations tuned for correctness alone learn to delegate reasoning to natural language and use Prolog only for the final computation, while configurations rewarded for symbolic structure produce fully auditable programs at a cost in accuracy. We interpret this trade-off as a form of reward hacking and discuss its implications for deploying neurosymbolic systems in safety-critical domains. The source code for our experiments is available under https://github.com/aisilab/Prolog-as-a-Tool

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑