OccamLLM: Fast and Exact Language Model Arithmetic in a Single Step

Fuente: arXiv
Gespeichert in:
Bibliographische Detailangaben
Hauptverfasser: Dugan, Owen, Beneto, Donato Manuel Jimenez, Loh, Charlotte, Chen, Zhuo, Dangovski, Rumen, Soljačić, Marin
Format: Preprint
Veröffentlicht: 2024
Schlagworte:
Online-Zugang:
Tags: Tag hinzufügen
Keine Tags, Fügen Sie den ersten Tag hinzu!
_version_ 1866909302962257920
author Dugan, Owen
Beneto, Donato Manuel Jimenez
Loh, Charlotte
Chen, Zhuo
Dangovski, Rumen
Soljačić, Marin
author_facet Dugan, Owen
Beneto, Donato Manuel Jimenez
Loh, Charlotte
Chen, Zhuo
Dangovski, Rumen
Soljačić, Marin
contents Despite significant advancements in text generation and reasoning, Large Language Models (LLMs) still face challenges in accurately performing complex arithmetic operations. Language model systems often enable LLMs to generate code for arithmetic operations to achieve accurate calculations. However, this approach compromises speed and security, and fine-tuning risks the language model losing prior capabilities. We propose a framework that enables exact arithmetic in a single autoregressive step, providing faster, more secure, and more interpretable LLM systems with arithmetic capabilities. We use the hidden states of a LLM to control a symbolic architecture that performs arithmetic. Our implementation using Llama 3 with OccamNet as a symbolic model (OccamLlama) achieves 100\% accuracy on single arithmetic operations ($+,-,\times,÷,\sin{},\cos{},\log{},\exp{},\sqrt{}$), outperforming GPT 4o with and without a code interpreter. Furthermore, OccamLlama outperforms GPT 4o with and without a code interpreter on average across a range of mathematical problem solving benchmarks, demonstrating that OccamLLMs can excel in arithmetic tasks, even surpassing much larger models. We will make our code public shortly.
format Preprint
id arxiv_https___arxiv_org_abs_2406_06576
institution arXiv
publishDate 2024
record_format arxiv
spellingShingle OccamLLM: Fast and Exact Language Model Arithmetic in a Single Step
Dugan, Owen
Beneto, Donato Manuel Jimenez
Loh, Charlotte
Chen, Zhuo
Dangovski, Rumen
Soljačić, Marin
Computation and Language
Artificial Intelligence
Machine Learning
Despite significant advancements in text generation and reasoning, Large Language Models (LLMs) still face challenges in accurately performing complex arithmetic operations. Language model systems often enable LLMs to generate code for arithmetic operations to achieve accurate calculations. However, this approach compromises speed and security, and fine-tuning risks the language model losing prior capabilities. We propose a framework that enables exact arithmetic in a single autoregressive step, providing faster, more secure, and more interpretable LLM systems with arithmetic capabilities. We use the hidden states of a LLM to control a symbolic architecture that performs arithmetic. Our implementation using Llama 3 with OccamNet as a symbolic model (OccamLlama) achieves 100\% accuracy on single arithmetic operations ($+,-,\times,÷,\sin{},\cos{},\log{},\exp{},\sqrt{}$), outperforming GPT 4o with and without a code interpreter. Furthermore, OccamLlama outperforms GPT 4o with and without a code interpreter on average across a range of mathematical problem solving benchmarks, demonstrating that OccamLLMs can excel in arithmetic tasks, even surpassing much larger models. We will make our code public shortly.
title OccamLLM: Fast and Exact Language Model Arithmetic in a Single Step
topic Computation and Language
Artificial Intelligence
Machine Learning
url https://arxiv.org/abs/2406.06576