IGC: Integrating a Gated Calculator into an LLM to Solve Arithmetic Tasks Reliably and Efficiently
Florian Dietz, Dietrich Klakow
TL;DR
This work introduces the Integrated Gated Calculator (IGC), a module that embeds a GPU-emulated, non-differentiable calculator inside a pretrained LLM to solve arithmetic tasks in a single pass without external tools or chains-of-thought. The IGC comprises an Input Mapping, a discrete calculator, and an Output Mapping with gated connections, trained with an auxiliary loss and anchor-timed execution, and it achieves near-perfect accuracy on the BigBench Arithmetic benchmark while being significantly more efficient than prompting-based or tool-use methods. The approach demonstrates strong generalization, high efficiency, and interpretability, with ablation results supporting its advantages over purely finetuned baselines and COT-like methods. The authors discuss integration into pretraining, extension to other non-differentiable operations, and the potential for broader applicability beyond arithmetic tasks.
Abstract
Solving arithmetic tasks is a simple and fundamental skill, yet modern Large Language Models (LLMs) have great difficulty with them. We introduce the Integrated Gated Calculator (IGC), a module that enables LLMs to perform arithmetic by emulating a calculator on the GPU. We finetune a Llama model with our module and test it on the BigBench Arithmetic benchmark, where it beats the State of the Art, outperforming all models on the benchmark, including models almost two orders of magnitude larger. Our approach takes only a single iteration to run and requires no external tools. It performs arithmetic operations entirely inside the LLM without the need to produce intermediate tokens. It is computationally efficient, interpretable, and avoids side-effects on tasks that do not require arithmetic operations. It reliably achieves 98\% to 99\% accuracy across multiple training runs and for all subtasks, including the substantially harder subtask of multiplication, which was previously unsolved.
