Improving Rule-based Reasoning in LLMs using Neurosymbolic Representations
Varun Dhanraj, Chris Eliasmith
TL;DR
The paper tackles the difficulty of reliable rule-based numerical reasoning in large language models by introducing a neurosymbolic framework that encodes LLM hidden states into Vector Symbolic Algebras (VSAs). By performing symbolic computations in the VSA space and decoding the results back into the LLM, the approach achieves substantial improvements in numerical reasoning tasks with minimal overhead and selective intervention to avoid harming unseen tasks. Compared to chain-of-thought prompting and LoRA fine-tuning, the Neurosymbolic LLM delivers higher accuracy and lower cross-entropy loss across trained problem types, while preserving performance on out-of-distribution tasks via a gating mechanism. The method offers interpretability through explicit symbolic representations and demonstrates scalable potential for broader reasoning tasks that require precise rule-following.
Abstract
Large language models (LLMs) continue to face challenges in reliably solving reasoning tasks, particularly those that require precise rule following, as often found in mathematical reasoning. This paper introduces a novel neurosymbolic method that improves LLM reasoning by encoding hidden states into neurosymbolic vectors, enabling problem-solving within a neurosymbolic vector space. The results are decoded and merged with the original hidden state, significantly boosting the model's performance on numerical reasoning tasks. By offloading computation through neurosymbolic representations, this method enhances efficiency, reliability, and interpretability. Experimental results demonstrate an average of 88.6% lower cross-entropy loss and 15.4 times more problems correctly solved on a suite of mathematical reasoning tasks compared to chain-of-thought prompting and supervised fine-tuning (LoRA), without degrading performance on other tasks. We make our code available at: https://github.com/vdhanraj/Neurosymbolic-LLM.
