OccamLLM: Fast and Exact Language Model Arithmetic in a Single Step
Authors: Owen M Dugan
Donato M. Jiménez Benetó
Charlotte Loh
Zhuo Chen
Rumen Dangovski
Marin Soljacic
Venue: NeurIPS 2024 poster (2024)
Keywords: LLM
Language Model
Arithmetic
OccamNet
Llama
Primary area: natural_language_processing
TL;DR: 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.

Abstract: 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,\div,\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. Code is available at https://github.com/druidowm/OccamLLM.

OccamLLM: Fast and Exact Language Model Arithmetic in a Single Step
Owen Dugan" Department of Physics
Donato M. Jiméénz-Benetoö Department of Physics Massachusetts Institute of Technology
Massachusetts Institute of Technology
Cambridge, MA odugan@mit...
Cambridge, MA donatojb@mit.
Charlotte Loh Department of EECS Massachusetts Institute of Technology Cambridge, MA cloh@mit.
Zhuo Chen
Department of Physics Massachusetts Institute of Technology
Cambridge, MA chenzhuoGmit.ed
Rumen Dangovski Department of EECS Massachusetts Institute of Technology Cambridge, MA rumenrd@mit.cmm edu
Marin Soljačíć Department of Physics Massachusetts Institute of Technology
Cambridge, MA solj soljacic@mit.edd
Abstract
Despite significant advancements in text generation and reasoning, Large Language Models (LLMMs) still face challenges in accurately performing complex arithmetic operations. Language model systems often enable L.MMs to generate code for arithmetic operations achieve accurate calculations. However, this approach compromises speed and security, and fine-tuning risks the language model losing prior capabilities. We propose framework that enables exact arithmetic in single autoregressive step. providing faster, more secure, and more interpretable LLM systems with arithmetic capabilities. We use the hidden states of LLM control symbolic architecture that performs arithmetic. Our implementation using Llama 3 with OccamNet symbolic model (OccamI.lama) achieves 100% accuracy on single arithmetic operations (+,- x, + sin cos log, exp, / outperforming GPT 4o with and without a code interpreter. Furthermore, OccamLlama outper- forms GPT 4o with and without a code interpreter on average across range of mathematical problem solving benchmarks, demonstrating that OccamLLMs can excel arithmetic tasks, even surpassing much larger models. Code available https: htt///gtttt.t...///////tt wtt.nuu..ommduuuuuuuiuuee droidowwwwww///// wwwp:iiddww//ccccmL... MCcamLLLM
Introduction
Since the release of GPT 3, Large Language Models (LLMs) have dramatically improved in their text generation and reasoning capabilities. This has enabled success in downstream applications including machine translation [1, sentiment analysis [ 4 5), and interactive dialogue generation
"Equal contribution
1 Corresponding author
38th Conference on Neural Information Processing Systems (NcurIPS 2024).

---

Table I: OccamLLM is the only approach to improving the arithmetic capabilities of pretrained LLM which 1) enables single-pass arithmetic, 2) does not risk catastrophic forgetting from finetuning. 3) does not require arbitrary code execution, and 4) provides an interpretable process.
No Catastrophic Forgetting
No Arbitrary
Single Pass
Code Execution
Interpretable
Fine Tuning
Tool Use
X
X
X
OccamLLM
6). with language models even surpassing human experts on some academic benchmarks that require reading comprehension, reasoning and coding [7]. However even industry-leading LLMs such as GPT 4 cannot reach 100% accuracy on simple arithmetic [8] limiting their ability to perform basic mathematical tasks. This hinders potential applications of LLMs ranging from chat-bot physics tutors to LLL--LPoe -powered automated research that could accelerate scientific discovery and technological innovation. The poor arithmetic performance of LLMs is particularly acute for small LLM agents, limiting their usage in smartphone or in multi-agent applications.
To enable accurate calculations, language model systems often resort to running code written by LLM. However, this comes at the cost of speed; the model must perform multiple autoregressive steps to generate code that performs the appropriate arithmetic operations. This increased decoding time may negatively impact applications such as multi-agent workflows IO] where speed is essential. At the same time, code-based LLM arithmetic mechanisms may increase system vulnerability by providing mechanism for arbitrary LLM- generated code exccution.
We propose an alternative, a framework which enables exact and interpretable LLM arithmetic in single autoregressive step, providing faster and more secure arithmetic capabilities in LLM systems. Our framework uses the hidden states of LLM to control symbolic architecture that performs arithmetic. Although our method can in principle work with any symbolic architecture, in this paper we use an interpretable neurosymbolic architecture known as OccamNet [[] 12] because of its interpretability and scalability. Therefore, we term our method OccamLLM, or OccamLlama when using a Llama model as the LLM.
Our core contributions are as follows:
1. We develop framework for exact and interpretable LLM arithmetic in a single autoregres- sive step without catastrophic forgetting [13) vulnerability from code generation. We explore how to train Daca, including data generation, decoder architecture, and loss function.
2. We benchmark Occam laaa on arithmetic tasks, demonstrating that OccamLlama achieves 100% accuracy on arbitrary single arithmetic operations (+; -, x, + sin, cos, log, exp, ; /), more than double the accuracy of GPT 4o. OccamL performs slightly better than GPT 4o with Code Interpreter while answering in on average more than 50x fewer generation tokens.
3. We benchmark mathematical problem solving tasks, showing that OccamLlama can sustain long generations. OccamLlama outperforms both GPT 4o and GPT 4o with code interpreter on average across the benchmarks we tested.
2 Related Work
Arithmetic Performance in LLMs. Prior research has trained models on synthetic data, finding that
such models can achieve near-perfect accuracy on addition 14 [5], subtraction [15], multiplication [3]. division [1), and raising to powers [15]. These prior models have been tested only on arithmetic datasets, so their generality has not been assessed. Other work focuses on finetuning data on math datasets. Both full-parameter [16] [1] and parameter-efffiient (PEFT) [18] finetuning strategies have been applied. However, finetuning on single dataset carries the risk of catastrophic forgetting of LLM's previously acquired linguistic skills [19]. While PEFT techniques have been shown to partially
LLMs which are already trained on large amounts of general-
mitigate this effect, this area is still one of active research 220 21).

---

13
OccamNet or LLM?
Switch
OccamNet Output
Transformer Block
OccamNet
W22
Transformer Block
Decoder
Transformer Block
Alice has 6 @apples and oranges. In total she has
Figure 1:
The OcCamLLM system. For each autoregressive step, the language model hidden states for that token are fed into a decoder block which assigns weights to OccamNet. The system feeds the most recent numbers from the text into OccamNet, which then evaluates the sparse function specified by its weights. The decoder then determines whether to use the LLM output or the OccamNet output.
LLMs with Tool Use. Another thrust of prior research has focused on LLM tool use, which we believe is most directly related to our methods. Calc-X [22] introduces technique to offload arithmetic computations to an external tool like a calculator: The authors curated a large dataset of arithmetic problems and trained language model that learns interact with a calculator through the
use of tags to signify the calling of the external tool. Several other works 23 24 25
follow a similar
idea, using crowd workers to annotate tool calls and using this data to train language models to interact with external tools such as web searching tool, calculator, or a translation system. These approaches can be prohibitively expensive in annotation costs; Toolformer (26) overcomes this cost by using in-context learning and language model to generate datasets containing the necessary 'API' tool calls via a self-supervised loss. Further, the above methods all require finetuning of the LLM, placing the LLM at risk of losing generality and its original language modelling abilities through contrast, our approach does not involve training the language model. Our 'external tool' is symbolic model which can be trained to correctly use the hidden states of the language model to perform the required arithmetic computations. The language model is kept frozen throughout this process. Unlike other tool-calling approaches, where the cost of data annotation to train for tool-calling interaction can be prohibitively expensive, in our method, each task only requires manually annotating tens of prompts, high annotation efficiency. Other prior methods leverage prompt engineering to improve arithmetic performance of LLMs; this is done either through chain-of-thought [27], or to encourage LLMs to use code interpreter [28 29 30). Contrary to these methods, our approach does not use code kernels; this provides several advantages: 1) it enables tool without expending compute on autoregressive steps for token generation, and 2) it avoids running potentially incorrect or malicious code generated by language models.
catastrophic forgetting.
3 Methods
3.1 OccamLLM: Combining
Language Model with a Symbolic Model
In short, the OccamLLM system combines a language model with symbolic model, namely OccamNet, that can perform arithmetic operations like addition and subtraction. For each token, the corresponding internal hidden states of the language model are fed into decoder module which initializes the symbolic model such that it executes the operation required by the task described the input text. A string parser feeds the necessary numbers from the text into OccamNet, which evaluates the desired expression. Finally, a decoder determines whether to use the language model output or the OccamNet output for generating the next token.
3

---

b]
Figure 2: a) A schematic of the OccamNet accanNetarchiitettusr with softmax layers in grey and their outputs in red. b) A Directed Acyclic Graph (DAG) (with edges not connected to the output removed for clarity) formed by sampling from OccamNet. This DAG corresponds to the function sin(sin(x1) cxp(xx))) Modified from
In the example shown Figure decoder determines how to initialize OccamNet from the language model hidden states, choosing to have OccamNet perform addition. The text parser then feeds the numbers and 7 into OccamNet, which adds numbers, returning 13. Finally, a decoder decides to use the OccamNet output instead of the language model output, so the system outputs 13. The new sentence, including the 13, is tokenized and fed back to the LLM to continue autoregressive generation. The language model might later generate "Since she ate two apples, she now has," at which point the switch will again trigger OccamNet, this time implementing 13 2 and returning 11.
In the subsections below, we describe the OccamLLM system which from our experiments we find to be most performant, even oupterforming GPT 4o in several benchmarks. For an analysis of alternate architectures and losses, see Appendix D
3.1.1 OccamNet
OccamNet is symbolic architecture that provides an interpretable way of parametrizing probability distributions over space of functions [II]. We leave more thorough explanation of OccamNet to and Appendix E describing only the relevant components here.
An I-layer OccamNet with primitives P and n inputs is an architecture that defines a probability distribution the space of functions representable as compositions of the primitives in up to depth I. For example, a two-layer OccamNet with primitives p {sin, cos} and one input represents probability distribution over the set
F {æ, sin()). (z), (2), sin (sin(s)))) (x)), sin(cos(()) (x)), cos(sin(zz) sin(sin(z)))
OccamNet has the structure of an n-input, 1- aatiraallaiiiiiii-naaaaaaa multilayer perceptron with the biases removed and the activations each layer replaced by the primitives P, as shown in Figure 2 Activation functions may have multiple inputs. We rename the linear layers softmax layers, denote the weights of the ith softmax layer as ( and denote the combined weights of OccamNet as W.
We define the probability distribution which OccamNet parametrizes by specifying how to sample from it. For each softmax layer output node (shown in red in Figure 2 we select a single connection to that node from a softmax layer input node by sampling from the distribution given by the softmax of the weights of the connections to the different inputs. This process produces a directed acyclic graph (DAG) defining computational path through the OccamNet activations, such the one shown in Figure Db. In this way, each DAG represents a function on the inputs of OccamNet.
To ensure that OccamNet can represent all possible compositions of functions in P to depth 7, we include the following modifications to the OccamNet architecture: 1) for each softmax layer, concatenate its inputs with the previous softmax layer's inputs enable the representation of functions with fewer than compositions, and 2) we repeat primitives the ith activation layer A times, where A is the maximum number of inputs of any of the primitives, ensure that a sufficient number of each primitive is available at each layer. We refer to this modified architecture as complete OccamNet it can represent the complete set of desired functions. The resulting architecture is shown in Figure 7 in the appendix.
In principle, OccamLLM can work with any symbolic model, i.e., any model that can parameterize set of symbolic functions or a distribution over such functions. We choose OccamNet as opposed to, for example, transformer [31] recurrent neural network [32], for two reasons: 1) OccamNet

---

is interpretable, which we hypothesize makes controlling OccamNet an easier task for decoder to learn and 2) OccamNet is parallelizable over multiple samples, allowing for scalable training.
3.1.2 OccamLLM Decoder
The MccamLLM decoder takes the hidden states of language model and outputs an initialization for OccamNet. This gives the LLM control over which function to apply on the imputs. The decoder acts on each input token separately, producing different OccamNet initialization for each. Therefore, the arithmetic operations predicted may change along an input sequence, allowing OccamNet's use for different computations in a single multi-token generation. This is crucial in multi-step reasoning scenarios where OccamNet employed several times for different purposes.
Many decoder architectures are possible. We choose to parameterize the weights of each softmax layer of OccamNet independently, as (W(1.... ) (Decoderjhh).. Decoder (h))) where h are the hidden states of the language model. We choose
Decoder; (h) = MLP;
Wig + W
where hy the hidden states of the jth layer of the language model, wa, are trainable weights, MLP; two-layer multilayer perceptrons (MLPs), and (+) are untrained weights which initialize all functions to have approximately equal probabilities according to the initialization scheme described in [TT] and explained in Appendix E.4
3.1.3 OccamLLM Switch
We similarly train a decoder for a switch that, for each input token, is fed the hidden states of the language model and selects whether use the output of OccamNet the output the language model. The decoder outputs single number from 0 to I, where all numbers less than or equal to 0.5 correspond using the output of the language model and all numbers greater than 0.5 correspond to using the output of OccamNet. We choose the following architecture for the switch decoder:
Uswitch. by ))
Σ
Decoder (h) sigmoid
MLP switch
(2)
3.2
Data Generation
We create synthetic datasets to train the OccamLLM decoders, which contain instruction prompts for diverse arithmetic tasks. To generate datasets of arbitrary size, create prompts with placeholders for numbers. Each prompt includes a question with number placeholders, the sampling value range for each number, and function that computes the answer the query given the sampled input numbers. The prompts fall into two main categories: purely arithmetic tasks and reasoning problems.
Purely arithmetic prompts formed by expressions including only symbols, without any natural language added, such as "3 + 85 =." We create prompts using the following operations: +(.,), -(,-), ((:-). +(; sqrt(-), power(., log. (-), exp(-). sin(.), and cos(-).
We also include word problems that require one or two reasoning steps. We generated 150 single step word problems and 40 multi-step reasoning problems which we modified from examples in the MultiArith training dataset [33
3.2.1 OccamNet Decoder Training Data
For training the decoder that controls the weights of OccamNet, we created two types of examples, single queries and concatenated queries. For single queries, we select single prompt from the problems generated as discussed in Section[.22) We use the Llama 3 Instruct chat template and fill in the query as the user input and the result as the assistant response, prepending "Answer = to later in randomly selected samples (see Appendix A. for further details). For the concatenated queries of examples, we select a random number of prompts and concatenate the query-response pairs without using the Llama Instruct chat template. The OccamNet decoder is trained to predict only
5

---

the results of the last query in the sequence. This strategy helps OcCamLLM to learn which operation to perform without becoming confused by earlier text, which is useful for continuous generation. To create the training dataset, each example is sampled by first randomly selecting whether to create a single or concatenated query, then randomly selecting the type(s) of prompt(s) used, and finally randomly sampling the input values from the range corresponding to each selected prompt.
3.2.2 OccamLLM Switch Training Data
To train the switch, we generate examples of possible LLM outputs for given input expressions and label the outputs with sequences of Os or Is corresponding to whether the language model or the OccamNet output should be used for the next token. Some examples correspond to the prompts described in Section 3.2 For such examples, the LLM output is set to "The answer is" or "Answer and the label sequence is all Os with I at the last token indicate the system should use OccamNet only to compute the answer. We also manually created and labeled several other examples for diverse scenarios to explicitly teach the system in which cases should or should not use OccamNet (see Appendix A..1.2 for further details).
To create the training dataset, we concatenate random number of the above user input assistant output pairs in conversational fashion, using the Llama 3 Instruct chat template.
3.3 OccamLLM Training
We train the OccamLLM decoder and the switch separately, as they do not share weights. In all cases, the weights of the L.M are kept frozen. In the first step, we train the system to predict the answer to examples generated by the method explained in Section 3.2.T] The OccamNet decoder processes the hidden states corresponding to the last token of the response and sets the weights of OccamNet such that the correct arithmetic expression is sampled. In this step, we use rescaled REINFORCE [34] loss, which can also be interpreted as a Monte-Care estimate of the cross-entropy loss (see Appendix D.2
C(x, y; W) Es-pw R(f(x), y) lo Pw [f]
Ej-pw R(f(z),))
where pw [f] = ON( Decoderw (h(z))) is the probability distribution represented by the decoder- initialized OccamNet.
Minimizing this loss steers the decoder towards assigning higher probabilities to the functions that maximize the reward Rxf()), y). which measures the similarity between the correct answer y and the prediction of OccamNet f(x). We find setting R(f (xf(z), 8) = 1 f(z) = y. and otherwise.
most effective. We discuss the OccamNet loss in more detail in Appendix D
The second step involves training the decoder to route the outputs to OccamNet when needed. We train the switch decoder alone, freezing the weights of the OccamNet decoder of the previous step and min- imizing the binary cross-entropy loss between the switch output and the desired output for each token. The OccamLLM switch decoder learns when to route the output to OccamNet in diverse contexts.
4 Experiments
For all OccamLLM results, we use Llama 8B Instruct and Llama 3 70B Instruct 35 as the underlying language models. As such, we call our models OccamLlama 8B and OccamLlama 70B, respectively. We use a layer Complete OccamNet with primitives
P= -+(+).)) -(, x(, :), +(,-),, sqri(-), power(-, -), (0, exp())) sin(-), cin()))co((())
This single layer OccamNet can be invoked by the LLM several times during generation to perform complex arithmetic operations accurately. To use the trained OccamLlama for inference, we sample the highest probability function from OccamNet as described in Appendix E.3
We benchmark our methods against unmodified Llama 2 7B Chat (Llama 2 7B) 36). unmodified Llama 8B Instruct (Llama 3 8B)
35), unmodified Llama 70B Instruct (Llama 3708B) (35), gpt-3.5-turbo-012 25 (GPT 3.5 Turbo) 37 pot-40-202405-11 13 (GPT 40) [38, and gp1-40-2024-05-13
with Code Interpreter (GPT 40 Code) [39]. To reduce costs, for GPT 4o with Code Interpreter, we test random subset of 200 datapoints for each dataset.

---

Table 2: Accuracy on arithmetic tasks, in percentages. The OccamLlama column corresponds to the results of both OccamLlama 8B and Oaca 70B. Higher better. Bold indicates best performance for each row.
OccamLlama 8B 70B
Llama 2 7B Chat
Llama 3 8b Instruct
GPT 3.5 Turbo
GPT 4o
GPT 4o Code
Addition
100.0
19.2=12
44, 1.6
65.2
95.7=00.
100.0:00.0
Subtraction
100.0=0.0
8.7
14,4
19.8#1.6
85.6
99.5+:05
Multiplication
100.0
0.0
0,0+
0.0=0.0
0.0+0.0
99.0+t0.
Division
100.0
2.8
35.3
10.7
38.6
100.0:00.0
Square Root
100.0=0.0
0.0=0.0
0.0+0000
0.9
18.6:11.2
100.0::0.0
Exponential
100.0
0.3
3.1
12.5
23.2
100.0.10.
Logarithm
100.0...0
0.1
0.0.
17.1
21.3
100.0
Sine
100.0
7.6
7.0.108
13,4
39.3
100.0.10.
Cosine
100.0
0.8 10.3
1.5.10.
6.7.1.8
32.8
100.0:10.
AVERAGE
100.0
4.4
14.0
20.7
39.5
99.8
To determine if a model output is correct, we parse all numbers in the model output and if one of them "matches" the correct answer, we determine that the result is correct. We mark each correct result as 100% accuracy and each incorrect result as 0% accuracy. For each model on each dataset, report the mean accuracy and the standard error of the mean. To determine if number matches the result, we first determine how many places after the decimal the number should be accurate to. If the number is integer, we set d to 2. Otherwise, decimal in the model output, clipped between and 5. Finally we state that number "matches" the result if the number and the result differ by less than 10-4, We present further experiment details, including additional experiments, hyperparameters, and prompts in Appendix A
set to the number of places after the
4.1 Simple Arithmetic Problems
To evaluate OccamL and the baselines on purely arithmetic expressions, we create several synthetic datasets. For each of the operations in (+, x, + the inputs are random 7-digit positive or negative integers. For / the inputs are random 7-digit positive integers. For the logarithms, the examples are log-uniformly sampled in the interval (10- 11 101%); for the exponentials, they are uniformly sampled the interval (-10, 10), and for sines and cosines they are uniformly sampled in the interval (-2rr, 2T)).
The results of these evaluations are shown in Table More detailed results, including relative error and results for 3- and 5-digit arithmetic, are shown in Appendix A.5
Both OccamLlama 8B and 70B have 100.0 + 0.0% accuracy on all tasks, missing 0 out of 9000 problems. On the other hand, we tested GPT 4o with Code Interpreter on fewer problems to save cost, and it missed 3 out of the 1800 problems faced, achieving accuracy of 99.8 + 0.1%.
Furthermore, GPT 4o with Code Interpreter generates on average more than 54 tokens to answer these problems, whereas our model uses OccamNet on the first forward pass. This means that, barring advanced decoding techniques such speculative decoding [40), GPT 4o would need be more than 50x faster than OccamLlama per forward pass to be comparable in answer generation speed on these tasks.
Table 2 demonstrates that arithmetic with LLMs is still challenging; state-of-the-art proprietary language models like GPT 4o achieve less than 40% accuracy on 7-digit division and fail to perform any 7diigt multiplications correctly. Open source LLMs fall farther behind, with Llama 8B achieving below 50% on relatively simple tasks such 7-digit addition.
4.2 Mathematical Problem Solving
To test the performance of Occaml Llam more general mathematical problem solving tasks, we evaluate our method and baselines on the following six benchmarks: AddSub 4T), GSM8K [42).
MultiArith (33), MATH401 (8), Single Eq [43). and SVAMP 44). All but MATH401 are word

---

Occamt lama 8B
Liama 3 8B
GPT 3.5 Turbo
GPT 4a +Code
OccamLiama
Liama 3
100
80
Accuracy (%)
60
40
20
AddSub
GSMaK
MultiArith
MultiArith Float
MATH401
Single Eq
SVAMP
Average
Figure 3: Accuracy of Occam and baselines on mathematical problem solving tasks. Higher is better. OccamLlama 8B achieves accuracy comparable to Llama 3 8B on benchmarks with simple arithmetic, higher accuracy than GPT 4o and GPT 4o + Code on on tasks with challenging arithmetic, and accuracy above Llama 8B and similar to GPT 3.5 Turbo on average. OccamLlama 70B outperforms GPT 4o and GPT 4o + Code on average.
problems requiring longer generation and a mix of reasoning and arithmetic capabilities. MATH401 also includes multistep arithmetic problems which require more than one call to OccamLlama. We selected these datasets (including the MultiArith Float dataset described below) before testing any methods on them to ensure unbiased selection of benchmarks.
Because many of the arithmetic operations required in these datasets are relatively simple, we also create MultiArith Float, a modification of MultiArith in which we select problems which are arithmetically more challenging, while requiring similar levels of reasoning. To this end, select prompts having input numbers that can be replaced with floats. For instance, 3.5 feet or $39.95 are reasonable but 3.5 people not. Furthermore, we sample input values from ranges larger than those appearing in the MultiArith dataset, in cases where it is reasonable. Float operations and larger additions and multiplications are more difficult for the baseline LLMs but do not make a difference for OccamLLMM so this dataset is particularly useful to show the advantages of the system we propose. Figure 3 shows the results of these evaluations. More detailed results are shown in Appendix [A.5]
OccamLlama 70B outperforms both GPT 4o and GPT 4o + Code on average across the benchmarks, demonstrating OccamLland Llam''s strong mathematical problem solving capability. We also note that GPT 4o + Code does not outperform GPT 4o on average, suggesting that existing implementations of LLMs with code generation may not help with mathematical problem solving.
We now consider the performance of OccamLlama 8B, the smaller OccamLlama model. On Mul- tiArith Float and MATH401, two datasets requiring challenging arithmetic, OccamLiama 8B out- performs not only Llama 3 8B but also GPT 4o and GPT 4o + Code. At the same time, most other datasets in this benchmark do not involve challenging arithmetic, meaning that Llama 8B is well suited to solve these tasks without assistance; most of the difficulty of these tasks lies the reasoning rather than in the arithmetic computations. This is further supported by the fact that GPT 4o with Code Interpreter never substantially outperforms and sometimes underperforms GPT 4o on these tasks. As such, it remarkable that Occami lama 8B can achieve comparable accuracy to Llama 3 8B even when it is trained on very different data and evaluated on tasks without challenging arithmetic.
The only datasets for which OccamLlama 8B performs noticeably worse than Llama 3 8B are GSMSK and Single Eq. but we believe this results from an imperfect OccamLlama switch, likely stemming from text which is outside of the switch training distribution (see Section 4.3). Fortunately, in Appendix C we find that the OccamNet decoder is quite robust to out of distribution data and that both the OccamNet and switch decoders generalize well to unseen languages. This suggests that, with relatively little data, it should be possible to teach the switch to handle these unseen cases, something leave for future work.
In Figure 4 we show example generations from Occa 8B for both arithmetic and reasoning tasks. These generations demonstrate how the OccamLlama switch learns to balance OccamNet
8

---

Llama 8B Instruct
OccamLlama 8B
Q:4536895 234217
Q: 4536895 234217
A: The result of the is
A: Let me calculate that for you!
4536895 234217 4771112
X
4536895 234217 4772112
Q: Mike had 29 video games but 8 of them weren't working. If he wanted to sell the working games for 73.57 each, how much money could he earn?
Q: Mike had 29 video games but of them weren't working. If he wanted to sell the working games for 73.57 each, how much money could he ear??
A: Let's break it down step by step:
A: Let's break it down step by step!
1. Mike had 29 video games initially. them weren't working, he needs subtract those from the total:
First, let's find how many working video games Mike has:
29 (total games) - -Bl (non-working games) =21
21
So, Mike 21 working video games.
3. Mike has 21 working video games.
He wants sell each warking game for $73.57.
Next, let's calculate the total amount of money Mike can earn selling these games:
S. To find out how much money he can eam, multiply
the number working games by the price per game:
21 (working games) x $73.57 (price per game) = $1549.17
(working games) x 73.57 (price per game) = 1544.97
Input to OccamNet
Output by OccamNet
Figure 4: Examples from Llama 3 8B Instruct and Occaml lama 8B on (top) an arithmetic problem and (bottom) mathematical reasoning problem from the MultiArith Float dataset. OccamLlama, the LLM performs reasoning, the switch predicts when to use OccamNet, and OccamNet performs arithmetic operations. OccamNet's inputs and outputs are highlighted in purple and green, respec- tively.
outputs with LLM outputs, effectively distributing the work between a reasoner (Llama) and a calculator (OecamNet). Because the language model is unaware of the OccamLlama system, its generations behave as it possesses an interior calculator even though it is actually using a tool. In this way, combine the benefits of language model finetuned arithmetic with the benefits of language model finetuned to use code for arithmetic, all without any finetuning.
4.3 Limitations
In our experiments, we use a single-layer OccamNet as the symbolic network, enabling evaluation of single-operation arithmetic problems. This sometimes poses a challenge reasoning problems when the base language model generates compound expressions requiring more than one operation to evaluate, such as 3 + 5 + 7 =. A single-layer OccamNet cannot evaluate these expressions. We attempted to overcome this by prompting Llama to break down compound expressions into multiple steps, but we find it difficult to coerce Llama to follow these instructions. Another challenge is that Llama often generates expressions in fractions or percentages, which also constitute compound expressions that not properly handled by the OccamLLM system. Fortunately, these compound expressions were typically simple enough for the LLM to evaluate without OccamNet. Therefore, in our experiments, trained the OccamL.LM switch to avoid using OccamNet for compound operations, largely mitigating this issue. Future work could explore other solutions such as integrating two-layer OccamNet the symbolic network. We found that these issues are particularly acute in the GSM8K and Single Eq datasets, where the expressions generated by Llama are not prevalent in the switch training data, causing it to sometimes incorrectly trigger OccamNet and degrade performance, as discussed more in Appendix A.5
observed that
Furthermore, found that the language model sometimes appends further digits to OccamLlama outputs, defeating the purpose of OacamLlama generations. To address this issue, we append "Annn." every number computed with OccamNet, emulating the usual behavior of Llama.
These techniques demonstrate a design paradigm Oceaml lama: by tuning the behaviors of OccamNet and the switch, we can often avoid finetuning the LLM.

---

Discussion
We presented Lcc,mLLM, a system enabling exact and interpretable language model arithmetic in single autoregressive step. Our method does not require modifying the weights of the underlying language model, thereby avoiding risks of catastrophic forgetting. Furthermore, our method avoids security risks arising from running code generated by language model while outperforming top LLM code generation methods (GPT 4o + Code) on average across our benchmarks.
We benchmarked method challenging arithmetic tasks, achieving 100% accuracy where GPT 4o achieves only 40% performance on average. We also benchmarked our method on mathematical problem solving tasks, demonstrating that the OccamLlama switch can accurately balance the LLM for reasoning and OccamNet for arithmetic, outperforming even GPT 4o and GPT 4o with Code Interpreter on average.
Our work could enable smaller LLMs to be as performant as much larger LLMs in arithmetic. Moreover, integrating OccamLLM with larger LLMs like GPT 4o could further improve their arithmetic abilities without requiring a code interpreter. Furthermore, at present, OccamLLM may not integrate with more advanced decoding techniques such speculative decoding [40 45). We hope to explore these avenues in future work.
Broader Impact
We believe that, in addition to enabling fast, safe, and interpretable arithmetic, OccamLLM demon- strates new paradigm for tool use. As a proof of concept for more complex tool use, we further train Occaml lama 8B with a two layer Complete OccamNet with the primitives
P = [Addition(; -), Subtraction Multiplication((>> Division (...ionn:::)))
which enables OccamLlama to perform up to three arithmetic operations (e.g.. 2 2- 3/2) single autoregressive step. We find that this two-layer OccamLlama can reach near 100% accuracy, even when performing three arithmetic operations in single autoregressive step. as shown in Table 3 This demonstrates that DecamL..M can be used to perform more complex operations, including composing multiple different tools.
For future work, we plan to explore integrating other tools beyond calculators through similar technique. This is facilitated by the fact that there are no restrictions on OccamNet's activations; in principle, tools could be placed inside activations of OccamNet, enabling OccamNet to serve
Table 3: Accuracy on multistep arithmetic.
OccamI
Llama 3 8b Instruct
sort of mixture of experts for tools. While some tools. like querying search engine, may still be most effective when integrated into language model systems through language, we believe this work demonstrates that some tools are more effective when they can be more tightly integrated into the language model.
One-Step Two-Step Three-Step
99.9 0.1
78. 18.1
98.2 0.4
57.8
96.1
40.2
AVERAGE
98.1=003
58.7+009
Acknowledgements
We would like to thank Andrew Ma and Di Luo for their thoughtful discussions.
The authors acknowledge the MIT SuperCloud and Lincoln Laboratory Supercomputing Center for providing HPC resources that have contributed to the research results reported within this paper.
Research was sponsored by the Department of the Air Force Artificial Intelligence Accelerator and was accomplished under Cooperative Agreement Number 1148750-1-2210000 The views and conclusions contained in this document are those of the authors and should not be interpreted as representing the official policies, either expressed implied, of the Department of the Air Force or the U.S. Government. The U.S. Government is authorized to reproduce and distribute reprints for Government purposes notwithstanding any copyright notation herein.
10

---

This work is also supported in part by the National Science Foundation under Cooperative Agreement PHY-2019786 (The NSF AI Institute for Artificial Intelligence and Fundamental Interactions, http //iaifi.org/
References
[1] Biao Zhang, Barry Haddow, and Alexandra Birch. Prompting large language model for machine translation: A case study, 2023.
[2] Wenhao Zhu, Hongyi Liu, Qingxiu Dong, Jingjing Xu, Shujian Huang, Lingpeng Kong, Jiajun Chen, and Lei Li. Multilingual machine translation with large language models: Empirical results and analysis, 2023.
[3] Xiang Deng, Vasilisa Bashlovkina, Feng Han, Simon Baumgartner, and Michael Bendersky. Lims to the moon? reddit market sentiment analysis with large language models. In Companion Proceedings of the ACM Web Conference 2023, WWW '23 Companion, page 1014-1019, New York, NY, USA, 2023. Association for Computing Machinery.
[4] Zengzhi Wang, Qiming Xie, Yi Feng, Zixiang Ding, Zinong Yang, and Rui Xia. Is ChatGPT a Good Sentiment Analyzer? A Preliminary Study. arXiv e-prints; page arXiv:2304.0433, April 2023.
[5] Wenxuan Zhang, Yue Deng, Bing Liu, Sinno Jialin Pan, and Lidong Bing. Sentiment analysis in the era of large language models: A reality check, 2023.
[6] OpenAI, Josh Achiam, Steven Adler, Sandhini Agarwal, Lama Ahmad, Ilge Akkaya, Flo- rencia Leoni Aleman, Diogo Almeida, Janko Altenschmidt, Sam Altman, Shyamal Anadkat, Red Avila, Igor Babuschkin, Suchir Balaji, Valerie Balcom, Paul Balteseu, Haiming Bao, Mohammad Bavarian, Jeff Belgum, Irwan Bello, and Barret Zoph. Gpt-4 technical report, 2024.
[7] Gemini Team, Rohan Anil, Sebastian Borgeaud, Jean- -aptistt Alayrac, Jiahui Yu, Radu Soricut, Johan Schalkwyk, Andrew M. Dai, Anja Hauth, Katie Millican, David Silver, Melvin Johnson, Toannis Antonoglou, Julian Schrittwieser, Amelia Glaese, Jilin Chen, Emily Pitler, Timothy Lillicrap, Angeliki Lazaridou, Orhan Firat, and Oriol Vinyals. Gemini: A family of highly capable multimodal models, 2024.
[8] Zheng Yuan, Hongyi Yuan, Chuanqi Tan, Wei Wang, and Songfang Huang. How well do large language models perform in arithmetic tasks?, 2023.
[9] Joon Sung Park, Joseph C. O'Brien, Carrie J. Cai, Meredith Ringel Morris, Percy Liang, and Michael S. Bernstein. Generative agents: Interactive simulacra of human behavior, 2023.
[10] Taicheng Guo, Xiuying Chen, Yaqi Wang, Ruidi Chang, Shichao Pei, Nitesh V. Chawla, Olaf Wiest, and Xiangliang Zhang. Large language model based multi-agents: A survey of progress and challenges, 2024.
[11] Owen Dugan, Rumen Dangovski, Allan Costa, Samuel Kim, Pawan Goyal, Joseph Jacobson, and Marin Soljačić. OccamNet: A Fast Neural Model for Symbolic Regression at Scale. arXiv e-prints, page arXiv:2007.10784, July 2020.
[12] Julia Balla, Sihao Huang, Owen Dugan, Rumen Dangovski, and Marin Soljacic. Al-Assisted Discovery of Quantitative and Formal Models in Social Science. arXiv e-prints, page arXiv:2210.0056: October 2022.
[13] Michael McCloskey and Neal J. Cohen. Catastrophic interference in connectionist networks: The sequential learning problem. volume 24 of Psychology of Learning and Motivation, pages 109-165 165. Academic Press, 1989.
[14] Davide Maltoni and Matteo Ferrara. Arithmetic with Language Models: from Memorization to Computation. arXiv e-prints, page arXiv:2308.01 154, August 2023.
[15] Zhen Yang, Ming Ding, Qingsong Lv, Zhihuan Jiang, Zehai He, Yuyi Guo, Jinfeng Bai, and Jie Tang. GPT Can Solve Mathematical Problems Without Calculator. arXiv e-prints, page arXiv:2309.03244 September 2023.
[16) Yixin Liu, Avi Singh, C. Daniel Freeman, John D. Co-Reyes, and Peter Liu, Improving large language model fine-tuning for solving math problems, 2023,
11

---

[17] Ke Wang, Houxing Ren, Aojun Zhou, Zimu Lu, Sichun Luo, Weikang Shi, Renrui Zhang, Linqi Song, Mingjie Zhan, and Hongsheng Li. Mathcoder: Seamless code integration in llms for enhanced mathematical reasoning, 2023.
[18] Zhiqiang Hu, Lei Wang. Yihuai Lan, Wanyu Xu, Ee-Peng Lim, Lidong Bing, Xing Xu, Soujanya Poria, and Roy La-Wei Lee. Llm-adapters: An adapter family for parameter-efffiient fine-tuning of large language models, 2023.
[19] Robert M French. Catastrophic forgetting in connectionist networks. Trends in cognitive sciences, 3(4): 128-135, 1999.
[20] Haolin Chen and Philip N. Garner. Bayesian parameter-efficient fine-tuning for overcoming
catastrophic forgetting, 2024.
[21] Shuo Liu, Jacky Keung, Zhen Yang, Fang Liu, Qilin Zhou, and Yihan Liao. Delving into parameter-efficient fine-tuning in code change learning: An empirical study, 2024.
[22] Marek Kadlčík, Michal Štefánik, Ondřej Sotoláł, and Vlastimil Martinek. Cale-x and caleform- ers: Empowering arithmetical chain-of-thought through interaction with symbolic systems, 2023.
[23] Mojtaba Komeili, Kurt Shuster, and Jason Weston.
dialogue generation. In Smaranda Muresan, Preslav Nakov, and Aline Villavicencio, editors, Proceedings of the 60th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pages 1460-8478, Dublin, Ireland, May 2022. Association for Computational Linguistics.
[24] Reiichiro Nakano, Jacob Hilton, Suchir Balaji, Jeff Wu, Long Ouyang, Christina Kim, Christo- pher Hesse, Shantanu Jain, Vineet Kosaraju, William Saunders, Xu Jiang, Karl Cobbe, Tyna Eloundou, Gretchen Krueger, Kevin Button, Matthew Knight, Benjamin Chess, and John Schulman. Webgpt: Browser-assisted question-answering with human feedback, 2022.
[25] Romal Thoppilan, Daniel De Freitas, Jamie Hall, Noam Shazeer, Apoorv Kulshreshtha, Heng-Tze Cheng, Alicia Jin, Taylor Bos, Leslie Baker, Yu Du YaGuang Li, Hongrae Lee, Huaixiu Steven Zheng, Amin Ghafouri. Marcelo Menegali. Yanping Huang, Maxim Krikun, Dmitry Lepikhin, James Qin, Dehao Chen, Yuanzhong Xu, Zhifeng Chen, Adam Roberts, Maarten Bosma, Vincent Zhao, Yangi Zhou, Chung-Ching Chang, Igor Krivokon, Will Rusch, Mare Pickett, Pranesh Srinivasan, Laichee Man, Kathleen Mellstm,, Meredith Ringel Morris, Tulsee Doshi, Renelito Delos Santos, Toju Duke, Johnny Soraker, Ben Zevenbergen, Vinodkumar Prabhakaran, Mark Diaz, Ben Hutchinson, Kristen Olson, Alejandra Molina, Erin Hoffman-John, Josh Lee, Lora Aroyo, Ravi Rajakumar, Alena Butryna, Matthew I Lamm, Viktoriya Kuzmina, Joe Fenton, Aaron Cohen, Rachel Bernstein, Ray Kurzweil, Blaise Aguera- Arcas, Claire Cui, Marian Croak, Ed Chi, and Quoc Le. Lamda: Language models for dialog applications, 2022.
[26] Timo Schick, Jane Dwivedi-Yre Yu, Roberto Dessi, Roberta Raileanu, Maria Lomeli, Luke Zettle- moyer, Nicola Cancedda, and Thomas Scialom. Toolformer: Language models can teach themselves to use tools, 2023.
[27] Jason Wei, Xuezhi Wang. Dale Schuurmans. Maarten Bosma, Brian Ichter, Fei Xia, Ed Chi, Quoe Le, and Denny Zhou. Chain-of-thoughh prompting elicits reasoning in large language models, 2023.
[28] Luyu Gao, Aman Madaan, Shuyan Zhou, Uri Alon, Pengfei Liu, Yiming Yang, Jamie Callan, and Graham Neubig. Pal: Program-aided language models, 2023.
[29] Wenhu Chen, Xueguang Ma. Xinyi Wang, and William W. Cohen. Program of thoughts prompting:
Disentangling computation from reasoning for numerical reasoning tasks, 2023.
[30] Aojun Zhou, Ke Wang, Zimu Lu, Weikang Shi, Sichun Luo, Zipeng Qin, Shaoging Lu, Anya Jia, Linqi Song, Mingjie Zhan, and Hongsheng Li. Solving challenging math word problems using gpt-4 code interpreter with bode- self-veriffcation, 2023.
[31] Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N. Gomez, Lukasz Kaiser, and Illia Polosukhin. Attention Is All You Need. arXiv e-prints, page
urXiv:1706.0376.1 June 2017.
[32] Robin M. Schmidt. Recurrent Neural Networks (RNNs): A gentle Introduction and Overview. arXiv e-prints, page arXiv:1912.0591 I, November 2019.
[33] Subhro Roy and Dan Roth. Solving general arithmetic word problems, 2016.
12

---

[34]
Ronald J. Williams. Simple statistical crudient-following algorithms for connectionist reinforce- ment learning, Mach. Learn., 8(3-4):229-255 May 1992.
[35]
AI@Meta Llama 3 model card. 2024.
[36]
Hugo Touvron, Louis Martin, Kevin Stone, Peter Albert, Amjad Almahairi, Yasmine Babaei, Nikolay Bashlykov, Soumya Batra, Prajjwal Bhargava, Shruti Bhosale, Dan Bikel, Lukas Blecher, Cristian Canton Ferrer, Moya Chen, Guillem Cucurull, David Esiobu, Jude Fernandes, Jeremy Fu, Wenyin Fu, Brian Fuller. Cymthia Gao, Vedanuj Goswami, Naman Goyal, Anthony Hartshorn, Saghar Hosseini, Rui Hou, Hakan Inan, Marcin Kardas, Viktor Kerkez, Madian Khabsa, Isabel Kloumann, Artem Korenev, Punit Singh Koura, Marie-Anne Lachaux, Thibaut Lavril, Jenya Lee, Diana Liskovich, Yinghai Lu, Yuning Mao, Xavier Martinet, Todor Mihaylov, Pushkar Mishra, Igor Molybog, Yixin Nie, Andrew Poulton, Jeremy Reizenstein, Rashi Rungta, Kalyan Saladi, Alan Schelten, Ruan Silva, Eric Michael Smith, Ranjan Subramanian, Xiao- qing Ellen Tan, Binh Tang, Ross Taylor, Adina Williams, Jian Xiang Kuan, Puxin Xu, Zheng Yan, Ilyaan Zarov, Yuchen Zhang, Angela Fan, Melanie Kambadur, Sharan Narang. Aurelien Rodriguez, Robert Stojnic. Sergey Edunov, and Thomas Scialom. Llama 2: Open Foundation and Fine- Chat Models. arXiv e-prints. page arXiv:2307.092 July 2023.
[37] OpenAL. Gpt-3.5 turbo, 2024. OpenAl API Documentation.
[38] OpenAl. Hello gpt-4o. 2024.
[39] OpenAl. Code interpreter, 2024. OpenAl Assistants API Documentation.
[40] Yaniv Leviathan, Matan Kalman, and Yossi Matias. Fast Inference from Transformers via Speculative Decoding. arXiv e-prints, page arXiv:2211.17192 November 2022.
[41] Mohammad Javad Hosseini, Hannaneh Hajishirzi, Oren Etzioni, and Nate Kushman. Learn- ing to solve arithmetic word problems with verb categorization. In Alessandro Moschitti, Bo Pang, and Walter Daelemans, editors, Proceedings of the 2014 Conference Empirical Methods in Natural Language Processing (EMNLP), pages 523-533, Doha, Qatar, October 2014. Association for Computational Linguistics.
[42] Karl Cobbe, Vineet Kosaraju, Mohammad Bavarian, Mark Chen, Heewoo Jun, Lukasz Kaiser, Matthias Plappert, Jenyy Tworek, Jacob Hilton, Reiichiro Nakano, Christopher Hesse, and John Schulman. Training verifiers to solve math word problems. ArXiv, abs/2 1416111 2021.
[43] Rik Koncel-Kedziorse Hannaneh Hajishirzi, Ashish Sabharwal, Oren Etzioni, and Siena Du- mas Ang. Parsing algebraic word problems into equations. Transactions of the Association for Computational Linguistics, 3:585-597, 2015.
[44] Arkil Patel, Satwik Bhattamishra, and Navin Goyal. Are NLP models really able to solve simple math word problems? In Kristina Toutanova, Anna Rumshisky, Luke Zettlemoyer, Dilck Hakkani-Turt Iz Beltagy, Steven Bethard, Ryan Cotterell, Tanmoy Chakraborty, and Yichao Zhou, editors, Proceedings the 2021 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, pages 2080-2094, Online, June 2021. Association for Computational Linguistics.
[45] Benjamin Spector and Chris Re. Accelerating LLM Inference with Staged Speculative Decoding. arXiv e-prints, page arXiv:2308 04623,, August 2023,
[46] Freda Shi, Mirac Suzgun, Markus Freitag, Xuezhi Wang, Suraj Srivats, Soroush Vosoughi, Hyung Won Chung, Yi Tay, Sebastian Ruder, Denny Zhou, Dipanjan Das, and Jason Wei. Language models are multilingual chain-of-thougee reasoners, 2022.
[47] Georg Martius and Christoph H. Lampert. Extrapolation and learning equations. arXiv e-prints, page arXiv: 1610.0299. October 2016.
[48] Subham Sahoo, Christoph Lampert, and Georg Martius. Learning equations for extrapolation and control. In Jennifer Dy and Andreas Krause, editors, Proceedings of the 35th International Conference on Machine Learning, volume 80 of Proceedings of Machine Learning Research, pages 4442 4450. Stockholmsmässan, Stockholm Sweden, 10-15 Jul 2018. PMLR.
[49] John Schulman, Filip Wolski, Prafulla Dhariwal, Alec Radford, and Oleg Klimov. Proximal Policy Optimization Algorithms. arXiv e-prints, page
July 2017.
13

---

Appendix
A
Further Experiment Details and Results
For training and evaluation OccamLlama 8B, we used a single 32 GB NVIDIA Tesla V100 GPU. For OccamLlama 70B, we used two 80 GB NVIDIA A100 GPU. Each training takes less than 48 hours.
In the experiments presented in Section for each of the weight decoders and the switch, we used two-layer MLPs of input size 4096/8 (Llama 8B/70B Instruct hidden size), intermediate size 64 and final size equal to the number of weights in the corresponding OccamNet layer switch.
In the two-layer experiments presented in Section 6 for each of the weight decoders, we used two-layer MLPs of input size 4096 (Llama 3 8B Instruct hidden size). intermediate size 512, and final size equal to the number of weights in the corresponding OccamNet layer. We did not train switch for this experiment as we did not test long-form generations.
A.1 Training Dataset
A.1.1 OccamNet Decoder
To train the OccamNet decoder, we created training dataset consisting of a 80,000 examples split in 40,000 single queries and 40,000 sequences of concatenated queries. In the first case, we sampled a single prompt of those described in 3.2 and formatted it using the Llama 3 Instruct chat template. In the second case, we concatenated multiple prompts described in 3.2 without the chat template.
40% of the sampled prompts correspond to simple arithmetic, concretely +, x, and +. We sampled from various input value ranges, chosen random: integers in 10, 10), integers in [-100 100),
integers in [-1000, 1000]. integers in [-20000, 20000), floating numbers in [-1, 1], and floating point numbers in [ 1000, 1000].
Another 40% corresponds to complex arithmetic involving square roots, logarithms, exponentials, trigonometric functions and computing one number the power of another. For the square root and the logarithm, we sampled integers uniformly in either [1, 100] or [1, 20000] and floats uniformly in either [0.01, 100] or [0.01, 20000). For the exponential, For the powers, we sampled the base as either an integer in [1, 25] or a float in [0.1, 25] and the exponent an integer in [-6,6].
sampled integers and floats in [- 10, 10).
The remaining 20% corresponds to single or multi step problems reasoning prompts. The inputs were sampled with various ranges, sometimes floats and sometimes integers, depending on the context of the problem. Because a Linlle-cccanNet-e reasoning problem in single step, we never end the multiple-query examples with multi-step reasoning problem.
OccamLlama cannot solve a multi-step
We first iterated the 80,000 examples, prepending "Answer = to the assistant response, thus training OccamNet to predict the result after the "=". Next, we validated the model on -iittr-diittibution examples where "Answer = was not appended. We noticed that the accuracy this task was improving during training, but after the full dataset was iterated it still didn't 't perform as well as when evaluated in in-distribution. Therefore, we continued to train the model using examples of the same dataset but with no "Answer = " at the beginning of the assistant response. The model rapidly learned the new task. We stopped at 28,000 iterations of this second stage.
For the two-layer OccamNet run, we generated large set of programmatically generated prompts of the form 3 + 97 -4 =, with the Llama 3 Instruct chat template applied.
A.1.2 Switch Decoder
To train the switch decoder, we created a dataset of 50,000 examples (80,000 for OccamLlama 80B). For each example, the tokens previous to the numbers that should be computed using OccamNet, which are the ones that the switch should not route to the I.MM, are labeled with a 1, and all the rest are labeled with O.
14

---

Half of the examples consist of single prompt corresponding to simple arithmetic expression as the ones described in Section 3.2] The token immediately at the beginning of the assistant response is labeled with 1. Therefore, the trained system will answer directly to simple arithmetic queries that OceamNet can compute.
The remaining 25,000 examples consist each of a series of prompts which are formatted in the Llama 3 Instruct chat template in a conversational style. The input-output pairs used to create each sequence of prompts are distributed in the following way:
25% of these pairs are created by taking one of the simple arithmetic expressions as input. The output selected randomly between answering directly the beginning of the assistant response, adding "Answer= = before the answer, or repeating the input expression before the answer. These examples train the switch trigger OccamNet in different scenarios where the LLM needs to compute an answer.
70% of the pairs come from a collection of 43 manually created and labeled examples, which illustrate in which cases the switch should route to OccamNet and, importantly in which cases it shouldn't 't. This collection was designed to cover wide variety of situations where the LLM might need to OccamNet for computations. Furthermore, it includes cases where the LLM should avoid calling OccamNet because doing so would produce a bad prediction. This is the case, for example, of instances where the LLM attempts add three numbers simultaneously. If it were to use the I-layer OccamNet, which can take inputs at most, the result would be incorrect.
The remaining 5% of the prompts come from multi-step reasoning problems. We set the output for these not to a full response, but only "The answer ". In such cases, a single-layer OccamNet cannot compute the answer, the output tokens are labeled with a O. This trains the system to avoid routing to OccamNet when the later cannot compute the answer.
Below, we present some manually created examples and explain what case they cover. The tokens of the numbers in bold were marked with a to signal that the switch should route to OccamNet, and the rest of the numbers and all of the text tokens were marked with a to signal that OccamNet should not be called in these cases.
The cases we cover with these prompts are:
1. Single-layer OccamNet should be called to perform two-input arithmetic operations.
2. OccamNet should not be called to write numbers that already appeared and do not require further arithmetic.
3. OccamNet should not be called round numbers.
4. OccamNet should not be called to perform inline operations nested within larger expression because it might contradict the assumption that the last two numbers are involved in the operation.
5. OccamNet should not be used to convert magnitudes when the LLM does not explicitly write the conversion factor and relies on its internal knowledge; without the numeric value of the factor present in the text, OccamNet can't an't give the correct result.
6. OccamNet can't 't compute percentages, as this operation was not included in the training set of operations. It could be done two steps.
7. Single-layer OccamNet can't compute fraction of number, as this would require two operations.
8. Single-layer OccamNet can't perform operations with more than arguments.
User Query
Assistant Response
Cases
An author writes 7.6 pages per ses- sion. After sessions, the total pages written are
The author writes 7.6 pages per session. After 9 sessions, the author will have written 7.6 x9 68.4 pages. The answer is 68.
1. 3
15

---

User Query
Assistant Response
Cases
I have 10 oranges and apple trees, each of them with 3 apples. How much fruit do have?
The total number of pieces of fruit is 10 oranges +
1,
6 trees times 3 apples 10 + (6 x3) 10 18
28. The answer is 28.
Sally has 7 pennies and 8 nickels. How many pennies does she have in total?
Convert the number of nickels to pennies: nickels is 40 pennies.
1, 2,
2. Add total number of pennies 40 7 47.
The answer is 47.
What 84 percent of 230.77?
84% 230.77 = 193.85
2,
Explanation: 84 100 0.84
0.84 x230.77 193.85
There were 39 cats on rock. 3 boats came and carried away cats each. How many cats were left?
There were originally 39 cats. 3 boats came and each took away 5 cats. So 3 15.
1, 7
39 15 24.
Then 3/7 of them ran away. 3/7 of is is 9. - 15. So there were cats left.
11 people have apples, 2 oranges, and 2 peaches each. How many pieces of fruit do they have?
Each person has 2 2 6 pieces of fruit. In total, they have 6 x1 | 66.
1, 2,
The answer is 66.
A.2 Training Hyperparameters
For all 1-layer OccamNet training runs, used batch size of 1, learning rate of 6e and weight decay parameter 0.01. We use gradient accumulation to achieve an effective batch size We used constant learning rate scheduler. We take 1000 samples from OccamNet per token.
For the 2-layer OccamNet run, we used batch size of 1, learning rate of le and weight decay parameter of 0.01. We use the gradient accumulation technique to achieve an effective batch size of We used a constant learning rate scheduler. take 50,000 samples from OccamNet per token.
A.3 Prompting
For the division arithmetic tasks, we found that the language models often did not return decimals. As such, we appended "Give the answer in decimals." to these prompts. Similarly, for the trigonometric functions evaluations, we explicitly ask the language models to take the input radians, by formatting the prompts as "cos(X rad) =".
For some models, we provide system prompting to guide the model toward the correct behavior. We break down prompting by model helow:
Llama 2/3: We did not provide a system prompt for the arithmetic tasks. For the reasoning tasks, we used the system prompt "Solve step by step."
GPT 3.5 Turbo:
We do not use a system prompt for GPT 3.5 Turbo.
GPT 4o: We did not use a system prompt, except for the MATH401 dataset, where we noticed that GPT 4o returning fractions instead of decimals. As such, MATH401 used the system prompt "Give your answer in decimals."
GPT + Code: We used the system prompt "Write and run code to answer math questions. Do not format numbers. Give all answers in decimals."
16

---

OccamLlama: We experimented with OccamLlama prompts, but discovered that not including system prompt was most effective.
A.4 Generation parameters
For OccamLlama, Llama 7B and Llama 8B, we use the default values T 0.6 and Top-P 0.9. For GPT 3.5 Turbo, GPT 4o, and GPT 4o with Code Interpreter, the default values of = 1.0 and Top-P = 1.0.
A.5 Experimental Results
Tables 5 and 6 show in more detail the accuracy of OccamLlama and other baselines on arithmetic and mathematical problem solving tasks. We measure accuracy as described in the main text.
We note here that on datasets with challenging arithmetic, in particular Multiarith Float and MATH401, OccamLIama 8B outperforms even GPT 4o and GPT 4o Code. In fact, MultiArith Float, Occam- Llama 8B is nearly 10 percentage points more accurate than GPT 4o + Code and and more than 40 percentage points more accurate than Llama 3 8B. Similarly,
MATH401, Occaml Jama 8B 7 percentage points more accurate than GPT 4o + Code and nearly 25 percentage points more accurate than Llama 3 8B. Although MATH401 does not include word problems, it does include some arithmetic expressions that require multiple calls to OccamNet to solve, meaning it requires both reasoning (to determine how to break up the arithmetic expression) and arithmetic capabilities.
The only datasets on which OccamLlama 8B performs substantially worse than Llama 8B are GSM8K [42] and Single Eq [43]. We believe contributor to this is that these datasets include many problems that involve either fractions and percentages, which Llama does not convert to decimal format, equations with unknown variables. As such, Llama often calls OccamNet with expressions such as "multiplying by 3/4 gives," "5% of this gives," or "adding to both sides of x-5 = 11 gives." Because the switch is trained many examples like these in which the number is not in decimal format, it does not realize that OccamNet should not be used in these cases. Therefore, the switch triggers OccamNet, which is not capable of performing the correct operation (these types of operations are not acheivable with a l-layer OccamNet). Future work could address this issue by training the switch with more data on this type of situation by training an OccamL with a two layer NecamNet.
Finally, noted in the main text, OccamL 70B achieves significant performance improvement over OccamLlama 8B across a number of benchmarks and outperforms GPT 4o and GPT 4o + Code on average. This demonstrates that OccamI.IM improves with the base language model and suggests that combining OccamLLLM with more capable models such as GPT 4o could be a promising avenue for future research.
Relative error is another important metric that complements accuracy. It measures by how much the answer differs from the true result. For two models with a similar accuracy metric, the relative error they achieve can be very different. Table 7hooes the relative error for the arithmetic experiments. An answer marked correct can have nonzero relative error because of machine precision limits and because the answer does not report an infinite number of digits.
Interestingly, Llama 2 performs exceptionally poorly on division. By examining outputs, we see that this is because Llama 2 produces an approximately correct output but with the decimal place in the wrong position, leading to result that is off by many orders of magnitude.
B Example OccamLlama Generations
In this section, we include example OccamL.amm 8B generations from the MATH401 and MultiArith- Float datasets. We randomly selected three examples for each dataset. OccamNet outputs are included in green. We omit prompt formatting to save space. Similarly, although outputs from OccamNet are always followed by "unn,"" " omit these newlines after each OccamNet generation.
space, instead adding a period and space
By chance, all six responses happen to be correct.
17

---

Table 5: Percent accuracy on arithmetic tasks. Higher is Better. Bold indicates best performance.
OccamLlama
Llama 2
Llama 3
GPT 3.5
GPT 4o
GPT 4o
7B Chat
8b Instruct
Turbo
Code
Addition (3)
100.0
70.9=144
97.1
98.8+0.
100.0=0.0
Addition (5)
100.0
11.9=1.6
77. 17.
92.5+
99.2=0.3
Addition (7)
100.0
19.2
44.9
65.2
95.7100
100.0
Subtraction (3)
100.0
49.7=14
95.2+07
94.0+0.8
98.7=0.4
Subtraction (5)
100.0::0.0
22.9=13 1.3
18.8
86.3
92.6=08
Subtraction (7)
100.0
8.7+009
34.4
59.8
85.6
99.5+00
Multiplication (3)
100.0
4.6::0.7
16.8
49.2
76.9
Multiplication (5)
100.0
0.0+0.0
0.1
0.4
4.6+07
Multiplication (7)
100.0
0.0
0.0
0.0=0.0
0.0+000
99.0+0.7
Division (3)
100.0
20.8
71.7114
50.5
78.2
Division (5)
100.0
7.4
48. 1116
15.7:112
51.0
Division (7)
100.0
2.8
35.3+15
10.7
38.6
100.0=0.0
Square Root (3)
100.0:0.0
1.2
14.8
47.11:1
69.3
Square Root (5)
100.0::.00
0.2
1.3:04
11.9
23.6
Square Root (7)
100.0:0.00
0.0
0.0
0.9403
18.6
100.0
Exponential
100.0
0.3
3.1
12.5
23.2
100.0
Logarithm
100.0
0. 10.1
0.0.:0.0
17.1
21.3
100.0
Sine
100.0:0.0
7.6
7.0
13,4
39.
100.0
Cosine
100.0
0.8
1.5
6.7=08
32.8
100.0
AVERAGE
100.0
14.4
32.0
38.6
55.2
99.8
We also include three miscellaneous prompts and OceamIlama 8B generations to demonstrate OccamLlama's 's ability to handle more challenging prompts.
18

---

Table 6: Percent accuracy on reasoning tasks. Higher is Better. Bold indicates best performance.
Occami
OccamLLIama
Llama
Llama
GPT 3.5
GPT 4o
GPT 4o
8B
70B
8b Instruct
708 Instruct
Turbo
Code
AddSab
91.6:11.4
0..5:1:099
93.4:11.2
97.2
95.4
97.0:1099
97.5:1:11
GSM8K
73.5 1.2
90.1::0.8
19.8:
94.8
84.8
96.1:2:0.5
94.0=t117
MultiArith
99.2.10.4
98.5.10.5
99.8 1.0.
98.2.10.55
97.2.10.7
99.7.10.2
99.5.10.5
MultiArith Float
98.2:::05
97.7=t0.6
57.3+t2.0
7..3+11.7
77.3=
96.2+::.88
89.3#22.22
MATI1401
85.0.1
89.5 1.5
60.3.12.4
71.61:2.3
63.1 2.24
76.6.12.1
78.0
Single Eq
92.9 92.9.11.1
96.9.10.8
96.3.1008
97.6.10.7
97.8.10.6
98.0.10.6
99.0 99.0
SVAMP
88.6+11.0
93.2:
86.3:t:.1
94.5
1.0
96.2:t:0.6
1.3
89.9
94.6:10.9
81.9::1.5
90.0:t:.2
86.2
94.2:1:1.0
93,4=1177
B.1
MATH401
Example 1
Prompt:
7A4=
Response:
Example 2
Prompt:
6:
Response:
216. 6 216.6996x6xx==21
Example 3
Prompt:
63.0+0.074=
Response:
63.074. 63.0 + 0.074 = 63.074. So the answer is 63.074.
B.2
MultiArith-Float
Example
1
Prompt:
Mike had 30 video games but 6 of them weren't 't working. If he wanted to sell the working games for 85.53 each, how much money could he earn?
Response:
Mike had 30 video games. 6 weren't 'tt working, so he had 30 6 = 24. He can sell 24 games for 85.53 each. 24 x 85.53 2052.720. Mike could earn 2052.72 dollars.
19

---

Table 7: Relative error (%) on arithmetic tasks. Lower is Better. Bold indicates best performance.
Occami.Iama
Llama
Llama
GPT 3.5
GPT 4o
GPT 4o
7B Chat
8b Instruct
Turbo
Code
Addition (3)
0.0:::00
10.5:1:0.9
3.2:::1
0.3::0.11
0.0:10.0
Addition (5)
0.0::0.0
113.0=21.1
23.7::4.0
4.6d:
0.0:00.0
Addition (7)
0.0.10.0
310.3197.00
78.1
1.0
1.0.0.99
0.0.10.0
Subtraction (3)
0.0.10.0
66.2.118.7
4.1.:088
3.8.10.7
0.4.0.11
Subtraction (5)
0.0.10.0
173.6.167.1
29.4.14.3
38.3116.5
3.5.1..66
Subtraction (7)
0.0::0000
222.3=55444
63.6=12.9
44.6#1313
5.4:00.7
0.3:50.3
Multiplication (3)
0.0::000
7.6
1.9:0.5
18:00.4
0.1::0.1
Multiplicaation (5)
0.0:10.0
84.9109
46.7.1177
1922337
1.8:00.4
Multiplication
0.0:::000
98.9:20.2
74.9::
90.11:24.2
4.4::0.6
10::0.7
Division
0.1::000
1346.2
13:209
1.1::03
0.0::0.0
Division (5)
0.2:1:.11
174156.6#31687.6
9.5
0.7:00.2
0.1::0.0
Division (7)
0.1:1:0.0
2203299209913364255999
225.3:::4211
0.3::0.1
0.0::0.0
0.0:10.0
Square Root (3)
0.0.1..0
8.9.1.11
1.1103
0.2.1..0
0.0.1..0
Square Root (5)
0.0::0.0
72.8:2888
12.6#17
0.1+00.0
0.0::0.0
Square Root (7)
0.0.1..0
207.81218
15.4
8.8.1.99
4.8.1.00
0.0.1.0
Expomential
0.3:10.0
422.618266
11.7.0077
2.310.99
0.1:10.0
0.0.1.00
Logarithm
0.0:10.0
138.3111199
1.
6.4.400
0.1:10.0
0.0.1.0.
Sine
0.1::0.0
515.5=68.1
279.2#21.99
125,4=12.3
3.2+:0.7
0.1:1:000
Cosine
0.1:10.00
581.9
346.1 188004
188.5
2.8:::.5
0.0:10.0
0.1::000
1169210.8
194953.4
66.9
28.4
1.5.0.11
0.2:0..1
Example 2
Prompt:
While playing a trivia game, Adam answered 6 questions correct in the first half and questions correct the second half. If each question was worth 59.08 points, what was his final score?
Response:
Adam got questions correct the first half, and 3 questions correct the second half. So he got 6 3 = 9, Each question was worth 59.08 points. So his score # 59.08 531.720. The answer 531.72.
Example 3
Prompt:
20

---

Lana's 's favorite band was holding concert where tickets were 181.92 dollars each. Lana bought 5 tickets for herself and her friends and 4 extra tickets in case anyone else wanted to go. How much did she spend?
Response:
Lana bought 5 fickets for herself and her friends. Then 4 extra lickets. So in total she bought 9. Each ticket was 181.92 dollars. So 9 tickets will be 9 x 181.92 1637.280. The answer is 1637.280.
B.3 Miscellaneous prompts
These miscellaneous prompts demonstrate OccamLlama's ability to handle more challenging prompts. Examples and show that OccamLlama can handle prompts where the numbers are provided words and not as decimals. This works because and "four" as and 4, respectively, when parsing inputs to OccamNet. Example 3 shows that Occami Jama handle prompts in which many irrelevant numbers included. This works because Occamllamm uses Ilama to reason and select the correct numbers to use before feeding these numbers into OccamNet.
choose parse strings such as "three"
Example
Prompt:
Six minus seven =?
Response:
1. Six minus seven is equal -1.
Example
Prompt:
Three + four ?
Response:
7.3 7. Let me know if you have any other questions!
Example 3
Prompt:
In 1932, 100 planets were discovered and in 1933, another 200 were found. What is the total number of planets discovered between 1932 and 1933?
Response:
The number of planets discovered in 1932 was 100. The number of planets discovered in 1933 200. So the total number of planets discovered is 100 + 200 = 300, 300.
C OccamLLM Robustness Experiments
We find that OccamLlama displays remarkable generalization capabilities out-of-distribution problems. To demonstrate this, we show below two out-of-distributton tasks on which OccamLlama performs remarkably well.
C.1 Non-textual Training
First, we train the OccamNet decoder from scratch, using only numeric expressions and absolutely no text at all. This means that any problem with text, such word problem, is far nut-of-distributin
21

---

Table 8: Accuracy on reasoning tasks. Higher is Better.
OccamLlama
OccamL.amaa
Llama
Llama
GPT 3.5
GPT 4o
GPT 4o
8B
8B Arith
7B Chat
8b Instruct
Turho
Code
AddSub
91.6+114
92.7=t1
78.0=2.1
93
95.4
97.0+09
97.5
GSM8K
73.5+112
71.6:11.2
36.0=1.3
7..8=1.1
84.8=110
96.1:005
94.0+t1.7
MultiArith
99.2+
98.5.10.5
7..0
99.8 20.2
97.2.
99.7.10.2
99.5.10
MultiArith Float
98,2
95.3+00.9
23.3
57.3=2.0
77.3=
96.2++0.8
89.5+22.
MATH401
8..
85.8 L1.7
43.9 12.5
60.3 1224
63.1 1:24
76.6
78.0.129
Single Eq
92.9
92.1
7..1
96.3
97.8
98.0+0..6
99.0:10.7
SVAMP
88.6
88.8
61.5
86.3
87.8
96.2.10.6
96.5
AVERAGE
89.9
1..
56.8
81.9
86.2
94.2
93.4
of the OccamNet decoder's training data. We test this model (using the standard router), which denote Olca 8B Arith, on the mathematical reasoning benchmarks and obtain remarkably good results, shown in Table g
The OlcamLlama 8B Arith performs on par with the model trained with both numbers and text, even achieving higher accuracy some benchmarks. This shows that the OccamLLM framework is robust, and points towards the fact that the representations arithmetic that are built in the transformer body of the LLM and extracted by the OccamLLM Decoder very general.
In contrast, we expect that finetuning Llama to perform arithmetic using only numeric examples and no text whatsoever would lead to extreme catastrophic forgetting and poor arithmetic performance on word problems. As such, we believe this data shows remarkable generalization and robustness of O.c
C.2 Multilingual Reasoning
To further demonstrate OccamLlama's generalization capabilities and also show that OccamLlama can handle non-English generation, we tested OccamLlama on the Multilingual Grade School Math Benchmark (MGSM) [46), dataset consisting of GSM8K translated into 10 languages (Bengali, Chinese, French, German, Japanese, Russian, Spanish, Swahili, Telugu, and Thai). For these experiments, prompted the LLMs to write their answers in the same language the problem statement, Otherwise, the LLM would typically respond always in English, defeating the purpose of the experiment. We compute the drop in accuracy when switching from Englishh to another language, given by the accuracy of a model on the English dataset minus the accuracy of the model on the dataset in given language. The results are shown in Figure 5
The table above shows that OccamLlama and Llama have similar performance drops between the English dataset and each non-English language dataset. On most languages and on average, OccamLlama has a smaller performance drop than Llama. The fact that OccamLlama (the decoders for which have never been trained other languages) has smaller average out-of-distribution performance drop than Llama (a model trained on over 750 billion tokens non- -on-Ennlish text) is in opinion quite remarkable.
We believe that this test demonstrates Occaml Jama's ability to handle many languages and its robustness against out-of out-of-distribution data.
22

---

60
Accuracy Drop (%)
40
10
Bengall
Chinese
French
Geman
Japanese
Russian
Spanish
Swedish
Tetugu
Thal
Average
Figure 5: Model performance degradation for each language relative to English in the MGSM dataset. OccamLlama 8B's performance degradation is considerably less than Llama 3 8B's performance degradation, demonstrating strong multilingual and generalization capabilities.
D Alternative Architectures and Losses
D.1 Alternative Architectures
As discussed in the main text, although OccamLLM works most naturally with OccamNet, can also work with other symbolic architectures such as the EQL network [47 48). or architectures that can represent probability distributions over symbolic expressions, such as transformers [31] or recurrent neural networks (RNNs) 32
However, in practice we believe OccamNet is the most effective architecture for this use case. We find that because EQL does not represent a probability distribution over functions, it easily gets stuck in local minima.
Regarding transformers and RNNs, we believe that OccamNet possesses key advantage of being interpretable; simply by looking the weights, it possible for human to determine which functions OccamNet assigns high probability. We believe that this interpretability will make OccamNet easy for decoder to initialize with the desired distribution. On the other hand, an RNN or transformer have substantially more complex relations between the weights and corresponding probability distribution, which we hypothesize would make learning a decoder for such models difficult.
This leads us to key point: transformers and RNNs are effective for modeling complex multimodal distributions, but for this problem, we want select single function for each token, so the extra expressivity of these models is unneeded and likely detrimental to performance. We believe that OccamNet, much simpler architecture, enables better parameter efficiency and performance.
D.2 Alternative Losses
In this section we discuss alternative possible losses and how arrived at the loss in Equation 3
We considered two loss functions which are natural when optimizing probability distribution: 1) cross-entropy loss, and 2) REINFORCE [34 loss. Each of these requires only a slight modification reach Equation 3 This discussion thus illustrates how our loss combines benefits from both the cross-entropy and the reinforcement-leammig losses.
Cross-Entropy Loss The cross-entropy loss effective modeling probability distributions. Given ground truth distribution [f] conditioned on the input text the cross-entropp loss is given by
C(x,y:
Σ log
(4)
23

---

Unfortunately, for OccamLLM, the ground-truit distribution qu [n] is not uniquely specified. In particular the only constraints on 9: [x are that it normalized and satisfies I.] if is not the desired function (i.e. (xx & y). Since the same function can be represented in many ways in the OccamNet network (a property true of many function representations), multiple f may satisfy f())) = y, so du is underparametrizzd.
The most natural choice for qu to weight each valid function equally:
CC if f())=y/
L= 0
(5)
otherwise
where Cs is a constant chosen such that is normalized, given by the inverse of the number of functions f satisfying (x) = y. However, determining C2 requires testing every possible function which may be infeasible for large OccamNet networks. Further, this y. requires OccamNet to learn a superposition of functions, which may be challenging given its relatively low parameter count.
Another option is to choose a canonical form f for each function and to set qu to be a 1-hot distribution that is nonzero only at f Although this removes the challenge of learning superposition, still requires sampling nearly all functions in OccamNet due to the sparsity of gr.
Ideally, we would like to find Oz with the following conditions:
It enables the cross-entropy loss to be calculated by sampling from OccamNet. This allows us to avoid needing to iterate through and evaluate every f(x each time we compute the loss, since we can instead obtain Monte-Carlo estimate.
It is minimized when Pw is a 1-hot probability distribution. This ensures that OccamNet can represent the optimal distribution.
It has [= + for all f satisfying f(x) y. This improves sample-efficiency by increasing the probability of sampling f with (=(f] > 0.
A solution is to set
L (f] f CcPWWLf if f())
(6)
otherwise
where is chosen such that 9z is normalized. This gives a loss
[(x, W) = Σ [xl log [f]
Σ C.pw [5] -(f(x)) y) log pw [
Co
Σ 6(f(x) - v)) log pw [f]
N
S~Pw
Eymoy 8(f(x) -) llggpw |5]
2
Σ Σnro 6(f(x) y)
where
if f(x)=
8ff(z) - = 0 otherwise
and in the last step we used the fact that og be approximated
N
Cs Pw [f](((()) v)
Ex~pw 8(f(x) - 4)
This loss easily computed by sampling from pw. satisfies qw > for all f satisfying f(x) = y, and it is minimized when pw is delta function centered at any f satisfying f(x) y, desired.
Note that
C(x, y: W) = Erooy 8(f(x) - v) log po [f]
(8)
Ejrpw 8(f(x) v)
exactly the loss given in Equation 3 with R(f(x),)) y) = 8(ʃ(z) - -y) Thus, we have shown
how Equation 3 can be interpreted as cross-entropy loss. Equation 3 with general R(f(x),)) v) can be seen as a cross-entropy loss with "smoothed" ground truth distribution de given by dz x Pw [f] R(f(z). 9)
24

---

Figure 6: a) An example OccamNet, with image layers boxed in green and arguments layers boxed in blue. We denote the inputs as the Oth image layer and the outputs as the (L+ 1)th arguments layer. Nodes in the arguments layers are represented with P because of their probabilistic nature. b) A demonstration of the dropped connections from sampled paths in OccamNet. All light grey paths are dropped from the final symbolic form of the sampled function because they are directly connected to the outputs.
REINFORCE Loss Reinforcement-lcaniie losses are effective for exploring large search spaces. We use modification of the REINFORCE (34) loss because it is relatively simple to implement. Future work could explore more sophisticated variants of this algorithm, such as Proximal Policy Optimization [4)].
The standard REINFORCE loss applied to OccamLLM gives
C(x, y; W) = N
R(S(x), v) 1~pW
Σ
log (W
Note that for sparse R, there will be very few nonzero R(f(z),) y) sampled, so, since we are dividing by N, the gradient signal will be small. We modify REINFORCE by dividing by the the sum of the rewards for all samples instead of by N ensure that correct functions sampled only a few times still receive large training step update. This once again produces Equation 3
We find that using delta function for reward is most effective because it most accurately represents the sparse reward of the problem. Further, as shown above, this loss provides Monte- Carlo estimate of the the entropy loss. Due to the sparse reward, many samples may initially be required to obtain an accurate estimate of the loss. However, as OccamNet approaches the desired distribution, the loss's sample efficiency will improve.
E
Background on OccamNet
This section is heavily modified from
We divide this section into the following subsections:
1. In Section E we describe OccamNet's architecture in more detail.
2. In Section
we describe OccamNet's sampling process.
3. In Section
we describe OccamNet's probability distribution.
4. Section
we describe OccamNet's initialization process.
E.1 OccamNet Architecture
As described in the main text, we start from a predefined collection of N primitive functions P. OccamNet represents a distribution over compositions functions P. From now on, we denote the ith primitive function the ith layer as (1) We begin indexing the primitives from 0 and the layers from because treat the inputs as the Oth layer. So, for example, in Figure 64. sin.
Each OccamNet layer consists of two sublayers, which we denote the arguments and image sublayers, shown in Figure For an T-llayer OccamNet, each these sublayers is reproduced L. times. The Ith softmax layer connects the (I 1)th image layer with the /th arguments layer. For L L,
25

---

denote the ith arguments sublayer hidden state as h and the /th image sublayer hidden state as h So, (2) would represent the middle layer of nodes labeled 1 in Figure 6a. We further write
h = 100
h = (m
( NO)
(9)
where
M
Σ
k
OSkENO
N( is the number of primitives layer and a[Ø) the arity of function ø. We also define h()) to be the input layer (an image sublayer) and (L++1) to be the output layer (an arguments sublayer).
In standard OccamNet layer, each primitive is repeated exactly once in each layer. However, in Complete OccamNet, each primitive in the /th layer is repeated A A times, where is the maximum arity of the primitives. This is shown in Figure 7 in the transition from 7 to 7p. Complete OccamNet also concatenates each image layer to the next image layer, as shown in Figure 7
E.2 Sampling from OccamNet
In this section, more carefully describe OccamNet's sampling process. We sample connection to each arguments layer node from the distribution given by the softmax the softmax- -lyerr weights leading to that node. In particular, if w are the weights of the /th softmax layer leading to the ith node of the argument's layer, when we sample we produce a sparse matrix
softmax (wi (
SAMPLE
(10)
softmax (w MO)
where the SAMPLE function samples one-hot row vector for each row based on the categorical probability distribution defined by softmax w). To evaluate this sample, we simply evaluate forward pass through the network, treating the sampled sparse matrices from the softmax layers as the weights of linear layers:
7
softmax w ())
:
= SAMPLE
(1I)
h
(1
softmax
! M
To complete the picture the forward pass, we formalize how we deal with activations accepting multiple inputs. We define the action of the activation functions follows:
h i
(T() (
T
Σ O5R<i
(12)
E.3 OccamNet's Probability Distribution
OccamNet parametrizes a probability distribution over all functions which it can sample. In particular, when OccamNet samples function, it is really sampling directed acyclic graph (DAG) which defines a computational path to compute a function. The probability of sampling a computational graph is equal the product of the probabilities of the connections in the DAG which connected to the output node.
Note that multiple computational graphs can correspond to the same function. In this paper, when we refer function sampled from OccamNet or the probability of function according to OccamNet, use function as shorthand for particular computational graph corresponding to that function.
26

---

a)
b)
Figure The progression of enhancements leading to a Complete OccamNet from standard OccamNet. a) A standard OccamNet without repeated activations or skip connections, b) The same OccamNet in a) with activations repeated in earlier layers. c) The same OccamNet in b) with added skip connections. This is Complete OccamNet.
Although this underspecifies the computational graph in question, this is never an issue because we always refer to functions in abstract.
When using OccamLlama for inference, we select the maximum probability function by sampling 100 functions from OccamNet, evaluating their probabilities as described above and selecting the maximum one.
E.4 Initialization
This section describes how caleulate W from the main text. We wish to initialize W such that Pw [fi] = Pw [fz] for all fi and f2. Below, we assume that skip connections do not exist. However, the algorithm also works for skip connections, requiring only small modification Equation [4]
Unfortunately, such an initialization impossible for any OccamNet with two or more layers containing primitives with more than one argument. However, it is possible to initialize OccamNet such that lower bound qw- of the true probability pw- is independent of f-
Define the probability of function f up to a given node as the product of the probabilities of the edges that lead that node in the DAG of f. Intuitively, qw [f] approximates pw [f] by maintaining a lower bound on the probability of f up to each node of an OccamNet and propagating that lower bound through the computational graph given by f.
To define qw more precisely, let q; [f] and 9: [.]] be the probability bounds corresponding to the ith node of the Ith image arguments sublayer. We have suppressed the dependence W for notational convenience. We compute these probabilities starting with the inputs, for which we set Z 1. We then propagate probabilities to the arguments layers according to
[1+1) softmax (w, (+1))))
((((()())))))))))))))) (1)
(13)
where j the node in the ith image layer which f connects the ith node of (1+ 1)th arguments layer. Similarly, we propagate probabilities to the image layers according to
n-a ia
Σ
La
[0]]
(14)
R=n
Finally, define qw [f]] 90 (1+1)
In practice qw [ʃ] < pw where equality holds for many functions. fact, qw(S] < Pw only when part of the DAG of / is used as input to two different arguments nodes. In cases such as these, the portion of the DAG that is used twice multiplicatively contributes the probability of edges to qw twice, artificially suppressing its value. However, because qw [f] is lower bound, initializing
27

---

W' to equalize qw- still has the desired effect of ensuring adequate coverage for each f in the initial probability distribution of OccamNet.
With this primer, we can now define the algorithm to initialize W such that qw- [/] is uniform.
The algorithm traverses through OccamNet layer by layer and establishes
invariant that, after assigning the weights up the ith layer. [f] are equal for all and f. This implies that, after assigning the weights up the /th layer, 43
(1) [s] are equal for all f. but not necessarily for all i. We
denote the common value of
(1)) 0; [f] as q( and the common value of q; (
[f] as q."
The algorithm starts with input layer, where for given I, the algorithm sets
automatically. Once the invariant above is true
(!) 9k
ming
(w (1,](+1))
log
(15)
for all i, j. where (w;" ((+1)
denotes the weight connecting the jth node in the /th image layer to the ith node in the (1 + 1 th arguments layer. This establishes the invariant for + because
c exp
(w:(l-1))
softmaxx ww (111))
(w(((+t1)
k exp
qj
(1)
mine
96
(1)
/q/
Σn minm
9m
(1)
/
(1)
1
>x 1/9
(1)
which a constant over both and j. so q repeats the above procedure until it has traversed the entire network.
(((+)))
[f] a constant over both i and f. The algorithm
In summary, the algorithm involves the following steps:
1. Set l = 0 and = 1.
2. Increment by 1.
3. Set W=(l) according to Equation 15
(l+1) 4. If L + 1, Compute (((+1) and g;
5. Return to step until 1.
28

---

NeurIPS Paper Checklist
1. Claims
Question: Do the main claims made in the abstract and introduction accurately reflect the paper's contributions and scope?
Answer: [Yes]
Justification: Claims made in the abstract and introduction are supported by experiments in the results section.
Guidelines:
The answer NA means that the abstract and introduction do not include the claims made in the paper.
The abstract and/or introduction should clearly state the claims made, including the contributions made the paper and important assumptions and limitations. A No or NA answer to this question will not be perceived well by the reviewers.
The claims made should match theoretical and experimental results, and reflect how much the results can be expected to generalize to other settings.
It is fine to include aspirational goals as motivation long is clear that these goals are not attained by the paper.
2. Limitations
Question: Does the paper discuss the limitations of the work performed by the authors?
Answer: [Yes]
Justification: We address the limitations of our method in the limitations section. We also provide some discussion on room for improvement in the discussion section.
Guidelines:
The answer NA means that the paper has limitation while the answer No means that the paper has limitations, but those are not discussed in the paper.
The authors are encouraged to create a separate "Limitations" section in their paper.
The paper should point out any strong assumptions and how robust the results are to violations of these assumptions (c.g.. independence assumptions, noiseless settings, model sell-speciiiatiinn asymptotic approximations only holding locally). The authors should reflect on how these assumptions might be violated in practice and what the implications would be.
The authors should reflect the scope of the claims made, e.g., if the approach was only tested on few datasets or with few runs. In general, empirical results often depend on implicit assumptions, which should be articulated.
The authors should reflect on the factors that influence the performance of the approach. For example, facial recognition algorithm may perform poorly when image resolution low or images are taken in low lighting. Or speech-to-tex, system might not be used reliably to provide closed captions for online lectures because it fails handle technical jargon.
The authors should discuss the computational efficiency of the proposed algorithms and how they scale with dataset size.
If applicable, the authors should discuss possible limitations of their approach to address problems of privacy and faimesss.
While the authors might fear that complete honesty about limitations might be used by reviewers as grounds for rejection, a worse outcome might be that reviewers discover limitations that aren't 't acknowledged in the paper. The authors should their best judgment and recognize that individual actions in favor of transparency play an impor- tant role in developing norms that preserve the integrity of the community, Reviewers will be specifically instructed to not penalize honesty concerning limitations.
3. Theory Assumptions and Proofs
Question: For each theoretical result, does the paper provide the full set of assumptions and complete (and correct) proof?
29

---

Answer: [NA]
Justification:
The paper does not have theoretical results.
Guidelines:
The answer NA means that the paper does not include theoretical results.
All the theorems, formulas, and proofs in the paper should be numbered and cross- referenced.
All assumptions should be clearly stated or referenced in the statement of any theorems.
The proof's can either appear in the main paper or the supplemental material, but if they appear in the supplemental material, the authors are encouraged to provide a short proof sketch provide intuition.
Inversely, any informal proof provided in the core of the paper should complemented by formal proofs provided in appendix or supplemental material.
Theorems and Lemmas that the proof relies upon should be properly referenced.
4. Experimental Result Reproducibility
Does the paper fully disclose all the information needed to reproduce the main ex- perimental results the paper to the extent that affects the main claims and/or conclusions of the paper (regardless of whether the code and data are provided not)?
Question:
Answer: [Yes]
Justification: Details to the dataset generation (where neccessary) and the experiments provided the main text and appendix. We also provide code to reproduce results.
Guidelines:
The answer NA means that the paper does not include experiments.
If the paper includes experiments, a No answer to this question will not be perceived well by the reviewers: Making the paper reproducible is important, regardless of whether the code and data are provided or not.
If the contribution is dataset and/or model, the authors should describe the steps taken to make their results reproducible or verifiable.
Depending on the contribution, reproducibility can be accomplished in various ways. For example, if the contribution is a novel architecture, descríbing the architecture fully might suffice, or if the contribution is specific model and empirical evaluation, it may be necessary to either make possible for others to replicate the model with the same dataset, provide access to the model. In general. releasing code and data is often one good way to accomplish this, but reproducibility can also be provided via detailed instructions for how to replicate the results, access to a hosted model (e.g., g., in the case of a large language model), releasing of a model checkpoint, or other means that are appropriate to the research performed.
While NeurIPS does not require releasing code, the conference does require submis- sions to provide some reasonable avenue for reproducibility, which may depend on the nature of the contribution. For example
(a) the contribution is primarily a new algorithm, the paper should make clear how reproduce that algorithm. (b) If the contribution is primarily new model architecture, the paper should describe the architecture clearly and fully.
(c) the contribution is new model (e-g., a large language model), then there should either be way to access this model for reproducing the results or way to reproduce the model (e.g., with an open-source dataset or instructions for how to construct the dataset).
(d) We recognize that reproducibility may be tricky in some cases, in which case authors are welcome describe the particular way they provide for reproducibility. In the case of closed-source models, it may be that access to the model is limited in some way (e.g., to registered users), but it should possible for other researchers to have some path reproducing verifying the results. 5. Open access to data and code
30

---

reproducible, they Does the paper provide open access to the data and code, with sufficient instruc- tions faithfully reproduce the main experimental results, as described in supplemental material?
Question:
Answer: [Yes]
Justification: We include code and data at mtttts:://githiii www/druidod///eeeeeeeeeeeee as highlighted in the abstract. We also describe our experiments in detail in the appendix.
Guidelines:
The answer NA means that paper does not include experiments requiring code.
Please see the NeurIPS code and data submission guidelines (https://nips.cm cc/
public/guides/ wttalees//ooeeSmmmiaaiiiniiiieie
for more details.
While we encourage the release of code and data, we understand that this might be possible, so "No" is an acceptable answer. Papers cannot be rejected simply for not including code, unless this is central to the contribution (e.g., for new open-source benchmark).
The instructions should contain the exact command and environment needed to run to reproduce the results. See the NeurIPS code and data submission guidelines (https
/
Cotee//ddeeeSbmmmcia ssi onPolicy) for more details.
The authors should provide instructions data access and preparation, including how to access the raw data, preprocessed data, intermediate data, and generated data, etc.
The authors should provide scripts to reproduce all experimental results for the new proposed method and baselines. only subset of experiments should state which ones are omitted from the script and why.
At submission time, to preserve anonymity, the authors should release anonymized versions (if applicable).
Providing as much information as possible in supplemental material (appended to the paper) recommended, but including URLs to data and code is permitted.
6. Experimental Setting/Details
Question: Does the paper specify all the training and test details (e.g., data splits, hyper- parameters, how they were chosen, type of optimizer, etc.) necessary to understand the results?
Answer: [Yes]
Justification: All experiment hyperparameters and configuration are detailed in Appendix A and referenced in the main text.
Guidelines:
The answer NA means that the paper does include experiments.
The experimental setting should be presented in the core the paper to level of detail that is necessary to appreciate the results and make sense of them.
The full details can be provided either with the code, in appendix, as supplemental material.
7. Experiment Statistical Significance
Does the paper report error bars suitably and correctly defined or other appropriate information about the statistical significance of the experiments?
Question:
Answer: [Yes]
Justification: All results reported with error bars. They are defined in the main text.
Guidelines:
The answer NA means that the paper does not include experiments.
The authors should answer "Yes" if the results are accompanied by error bars, confi- dence intervals, or statistical significance tests, least for the experiments that support the main claims of the paper.
The factors of variability that the error bars are capturing should be clearly stated (for example, train/test split, initialization, random drawing of some parameter, or overall with given experimental conditions).
31

---

The method for calculating the error bars should be explained (closed form formula, call a library function, bootstrap, etc.)
The assumptions made should be given (e.g., Normally distributed errors).
It should be clear whether the error bar is the standard deviation the standard error of the mean.
It is OK to report 1-sigma error bars, but one should state it. The authors should preferably report a 2-sigma error bar than state that they have 96% CI, if the hypothesis of Normality of errors is not verified.
For asymmetric distributions, the authors should be careful figures symmetric error bars that would yield results that are out of range (e.g. negative rates).
show in tables or
If error bars are reported in tables or plots, The authors should explain the text how they were calculated and reference the corresponding figures tables in the text.
8. Experiments Compute Resources
For each experiment, does the paper provide sufficient information on the puter resources (type of compute workers, memory, time of execution) needed to reproduce the experiments?
Question:
Answer: [Yes]
Justification: Compute resources used (particularly, the GPUs used) are detailed in Appendix A.
Guidelines:
The answer NA means that the paper does not include experiments.
The paper should indicate the type of compute workers CPU or GPU, internal cluster, or cloud provider, including relevant memory and storage.
The paper should provide the amount of compute required for each of the individual experimental runs as well as estimate the total compute.
The paper should disclose whether the full research project required more compute than the experiments reported in the paper (e.g., preliminary or failed experiments that didn't make into the paper).
9. Code Of Ethics
Question: Does the research conducted the paper conform, in every respect, with the NeurlPS Code of Ethics
Answer: [Yes]
Justification:
Code of Ethics were reviewed and conformed to.
Guidelines:
The answer NA means that the authors have reviewed the NeurIPS Code of Ethics.
If the authors answer No, they should explain the special circumstances that require deviation from the Code of Ethics.
The authors should make sure to preserve anonymity (e.g., there a special consid- eration due to laws or regulations in their jurisdiction).
10. Broader Impacts
Question: Does the paper discuss both potential positive socictal impacts and negative societal impacts of the work performed?
Answer: [Yes]
Justification: This is discussed in the broader impacts section of the paper.
Guidelines:
The answer NA means that there is no societal impact of the work performed.
If the authors answer NA or No, they should explain why their work has no societal impact why the paper does not address societal impact.
32

---

Examples of negative societal impacts include potential malicious unintended uses (e.g., disinformation, generating fake profiles, surveillance), faireess considerations (e.g., deployment of technologies that could make decisions that unfairly impact specific groups), privacy considerations, and security considerations.
The conference expects that many papers will be foundational research and not tied partieular applications, let alone deployments. However, if there is direct path to any negative applications, the authors should point it out. For example, it is legitimate point out that an improvement in the quality of generative models could be used to generate deepfakes for disinformation. On the other hand, it is not needed to point out that a generic algorithm for optimizing neural networks could enable people to train models that generate Deepfakes faster.
The authors should consider possible harms that could arise when the technology is being used as intended and functioning correctly, harms that could arise when the technology is being used intended but gives incorrect results, and harms following from (intentional or unintentional) misuse of the technology.
If there negative societal impacts, the authors could also discuss possible mitigation strategies (c.g., gated release models, providing defenses in addition to attacks, mechanisms for monitoring misuse, mechanisms to monitor how system learns from feedback over time, improving the efficiency and accessibility of MI).
11. Safeguards
Question:
Does the paper describe safeguards that have been put in place for responsible release of data models that have high risk for misuse (e.g., pretrained language models, image generators, or scraped datasets)?
Answer: [NA]
Justification: Our work does not release pre-trained model and new datasets created in this work are purely arithmetic.
Guidelines:
The answer NA means that the paper poses no such risks.
Released models that have high risk for misuse or dual-use should be released with necessary safeguards to allow for controlled use of the model, for example by requiring that users adhere usage guidelines or restrictions to access the model or implementing safety filters.
Datasets that have been scraped from the Internet could pose safety risks. The authors should describe how they avoided releasing unsafe images.
We recognize that providing effective safeguards is challenging, and many papers do not require this, but encourage authors to take this into account and make best faith effort.
12. Licenses for existing assets
Question: Are the creators or original owners of assets (c.g., code, data, models), used in the paper, properly credited and are the license and terms of use explicitly mentioned and properly respected?
Answer: [Yes]
Justification: All data and models used are properly cited and their license terms were properly respected.
Guidelines:
The answer NA means that the paper does not use existing assets.
The authors should cite the original paper that produced the code package dataset.
The authors should state which version of the asset used and, possible, include URL.
The name of the license (e.g., CC-BY 4.0) should be included for each asset.
For scraped data from a particular source (e.g., website), the copyright and terms of service of that source should be provided.
33

---

If assets are released, the license, copyright information, and terms of use in the thcode. has curated licenses for some datasets. Their licensing guide can help determine the license of dataset.
package should be provided. For popular datasets, batasets.papersstt paperswi
For existing datasets that are re-packaged, both the original license and the license of the derived asset (if it has changed) should be provided.
If this information is available online, the authors encouraged to reach out the asset's s creators.
13. New Assets
Question: Are assets introduced in the paper well documented and is the documentation provided alongside the assets?
Answer: [Yes]
Justification: New data created in this work and trained models documented in the paper and/or in the public GitHub repository.
Guidelines:
The answer NA means that the paper does not release assets.
Researchers should communicate the details of the dataset/code/model as part of their submissions via structured templates. This includes details about training, license, limitations, etc.
The paper should discuss whether and how consent was obtained from people whose asset is used.
At submission time, remember to anonymize your assets (if applicable). You can either create an anonymized URL or include an anonymized zip file.
14. Crowdsoureing and Research with Human Subjects
Question: For crowdsourcing experiments and research with human subjects, does the paper include the full text of instructions given to participants and screenshots, if applicable, as well details about compensation (if any)?
Answer: [NA]
Justification: Our work does not involve human subjects.
Guidelines:
The answer NA means that the paper does not involve crowdsourcing nor research with human subjects.
Including this information in the supplemental material is fine, but if the main contribu- tion of the paper involves human subjects, then much detail as possible should be included the main paper.
According to the NeurlPS Code of Ethics, workers involved in data collection, curation, other labor should be paid at least the minimum wage in the country of the data collector.
15. Institutional Review Board (IRB) Approvals or Equivalent for Research with Human Subjects
Question: Does the paper describe potential risks incurred by study participants, whether such risks were disclosed to the subjects, and whether Institutional Review Board (IRB) approvals (or an equivalent approval/review based on the requirements of your country or institution) were obtained?
Answer: [NA]
Justification:
The paper does not involve crowdsourcing or research with human subjects.
Guidelines:
The answer NA means that the paper does involve crowdsourcing nor research with human subjects.
Depending the country in which research is conducted, IRB approval (or equivalent) may be required for any human subjects research. If you obtained IRB approval, you should clearly state this in the paper.
34

---

We recognize that the procedures for this may vary significantly between institutions and locations, and we expect authors adhere the NeurIPS Code of Ethics and the guidelines for their institution.
For initial submissions, do not include any information that would break anonymity (if applicable), such as the institution conducting the review.
35


Reviews:
[{"review_id": "R12egEkZUq", "reviewer": "Reviewer_bzKn", "summary": "This paper introduces OccamLLM, which is a novel framework that enables exact arithmetic in a single autoregressive step and enhances the arithmetic capabilities of LLMs. In detail, OccamLLM adds several additional decoders to the original LLM to help it conduct arithmetic tasks using a symbolic model named OccamNet. While all the decoders take the hidden states of LLM as input, one of them (“OccamLLM Switch”) will focus on predicting whether the LLM should use OccamNet to conduct arithmetic tasks at the current time step and others (“OccamLLM Decoder”) will predict the weights of OccamNet that are used during the arithmetic task. These additional decoders are trained on synthetic datasets, during which the original weights of LLM are frozen to avoid catastrophic forgetting. Evaluation shows that OccamLLM can significantly improve the arithmetic capabilities of LLM, without harming its reasoning and language modeling capabilities.", "questions": "- What would be the performance of OccamLlama on GSM8K when using a two layer Complete OccamNet?", "limitations": "- The limitation section of this paper is rather comprehensive.", "rating": 6, "confidence": 3, "soundness": 3, "presentation": 3, "contribution": 3, "strengths": "- The idea of adding OccamLLM Decoders to LLM and using it to predict the weights of OccamNet for arithmetic tasks is novel.\n- The paper is generally well-written.", "weaknesses": "- The improvements brought by OccamLLM on general reasoning tasks are limited. While OccamLlama outperforms Llama 3 8B on MultiArith Float and MATH401, it fails to bring meaningful improvements on all the other reasoning benchmarks.\n- It is unclear whether OccamLLM can consistently improve the arithmetic capabilities of larger models with 13B and 70B parameters.", "quality": null, "clarity": null, "significance": null, "originality": null, "strengths_and_weaknesses": "", "was_revised": false, "final_justification": "", "rebuttal": "> The idea of adding OccamLLM Decoders to LLM and using it to predict the weights of OccamNet for arithmetic tasks is novel.\nThe paper is generally well-written.\n\nWe appreciate your kind remarks!\n\n> The improvements brought by OccamLLM on general reasoning tasks are limited. While OccamLlama outperforms Llama 3 8B on MultiArith Float and MATH401, it fails to bring meaningful improvements on all the other reasoning benchmarks.\n\nThank you for your comment. Since submitting to NeurIPS, we identified a few minor bugs in our code and slightly reweighted the proportions of the different training datasets. These changes maintained the perfect performance on arithmetic tasks and improved performance on mathematical reasoning tasks. The updated results are shown in Figure a) of the global response PDF and the table below:\n\n**Table:** *Accuracy on reasoning tasks. Higher is Better.*\n\n| Dataset | OccamLlama | Llama 3 8B Instruct | GPT 3.5 Turbo | GPT 4o | GPT 4o Code |\n|:--|:--:|:--:|:--:|:--:|:--:|\n| AddSub | 91.6 ± 1.4 | 93.4 ± 1.2 | 95.4 ± 1.1 | 97.0 ± 0.9 | **97.5 ± 1.1** |\n| GSM8K | 73.5 ± 1.2 | 79.8 ± 1.1 | 84.8 ± 1.0 | **96.1 ± 0.5** | 94.0 ± 1.7 |\n| MultiArith | 99.2 ± 0.4 | **99.8 ± 0.2** | 97.2 ± 0.7 | 99.7 ± 0.2 | 99.5 ± 0.5 |\n| MultiArith Float | **98.2 ± 0.5** | 57.3 ± 2.0 | 77.3 ± 1.7 | 96.2 ± 0.8 | 89.5 ± 2.2 |\n| MATH401 | **85.0 ± 1.8** | 60.3 ± 2.4 | 63.1 ± 2.4 | 76.6 ± 2.1 | 78.0 ± 2.9 |\n| Single Eq | 92.9 ± 1.1 | 96.3 ± 0.8 | 97.8 ± 0.6 | 98.0 ± 0.6 | **99.0 ± 0.7** |\n| SVAMP | 88.6 ± 1.0 | 86.3 ± 1.1 | 87.8 ± 1.0 | 96.2 ± 0.6 | **96.5 ± 1.3** |\n| **Average** | 89.9 ± 1.1 | 81.9 ± 1.3 | 86.2 ± 1.2 | **94.2 ± 0.8** | 93.4 ± 1.5 |\n\nOccamLlama outperforms even GPT 4o and GPT 4o with Code on benchmarks requiring challenging arithmetic (MultiArith Float and MATH401). Additionally, the gap between OccamLlama and LLama 3 8B is substantially smaller on GSM8K. On average, OccamLlama has accuracy approximately halfway between that of GPT 3.5 and GPT 4o.\n\nThe performance of OccamLlama also improves dramatically when trained with Llama 3 70B, as discussed below.\n\n> It is unclear whether OccamLLM can consistently improve the arithmetic capabilities of larger models with 13B and 70B parameters.\n\nThank you for your comments. To demonstrate OccamLLM's ability to scale to larger models, we trained OccamLlama using Llama 3 70B Instruct as a base model (OccamLlama 70B). We evaluated the results on the mathematical reasoning benchmarks. To ensure we had results in time for the rebuttal deadline, we sampled 100 random questions from each dataset to determine OccamLlama 70B's performance, which is the cause for the relatively large error bars. We will update this response with the full results once they complete. The results are shown visually in Figure d) of the global response PDF and the table below:\n\n**Table:** *Accuracy on reasoning tasks. Higher is better.*\n\n| Dataset | OccamLlama 8B | OccamLlama 70B | Llama 3 8B Instruct | GPT 3.5 Turbo | GPT 4o | GPT 4o Code |\n|:--|:--:|:--:|:--:|:--:|:--:|:--:|\n| AddSub | 91.6 ± 1.4 | **98.0 ± 1.4** | 93.4 ± 1.2 | 95.4 ± 1.1 | 97.0 ± 0.9 | 97.5 ± 1.1 |\n| GSM8K | 73.5 ± 1.2 | 87.0 ± 3.4 | 79.8 ± 1.1 | 84.8 ± 1.0 | **96.1 ± 0.5** | 94.0 ± 1.7 |\n| MultiArith | 99.2 ± 0.4 | **100.0 ± 0.0** | 99.8 ± 0.2 | 97.2 ± 0.7 | 99.7 ± 0.2 | 99.5 ± 0.5 |\n| MultiArith Float | 98.2 ± 0.5 | **99.0 ± 1.0** | 57.3 ± 2.0 | 77.3 ± 1.7 | 96.2 ± 0.8 | 89.5 ± 2.2 |\n| MATH401 | 85.0 ± 1.8 | **91.0 ± 2.9** | 60.3 ± 2.4 | 63.1 ± 2.4 | 76.6 ± 2.1 | 78.0 ± 2.9 |\n| Single Eq | 92.9 ± 1.1 | 93.0 ± 2.6 | 96.3 ± 0.8 | 97.8 ± 0.6 | 98.0 ± 0.6 | **99.0 ± 0.7** |\n| SVAMP | 88.6 ± 1.0 | 96.0 ± 2.0 | 86.3 ± 1.1 | 87.8 ± 1.0 | 96.2 ± 0.6 | **96.5 ± 1.3** |\n| **Average** | 89.9 ± 1.1 | **94.9 ± 1.9** | 81.9 ± 1.3 | 86.2 ± 1.2 | 94.2 ± 0.8 | 93.4 ± 1.5 |\n\nThese results demonstrate that OccamLLM is capable of robust performance on large-scale models. Training the OccamLLM 70B system (in 16-bit LLM precision and unoptimized code) required approximately 1.5-2 days on a system with two A100 nodes, demonstrating the low compute requirements of our method.\n\nOccamLlama 70B shows consistent improvement over OccamLlama 8B. We believe this results from a combination of Llama 3 70B's improved reasoning capabilities and Llama 3 70B's improved representations (which enable OccamLlama to generalize more effectively). We expect that training with even larger base models would lead to further improvements. Remarkably, OccamLlama 70B outperforms GPT 4o and GPT 4o with Code on average across these benchmarks. It also outperforms GPT 3.5 Turbo on all but Single Eq.\n\n> What would be the performance of OccamLlama on GSM8K when using a two layer Complete OccamNet?\n\nThank you for your interest in OccamLLM using a multi-layer OccamNet. We are exploring this direction in future work, and we beleive we can train performant OccamLLM systems with a many-layer OccamNet. In the present paper, we simply wish to demonstrate the potential promise of using multiple-layer OccamNets.\n\nWe note that our existing methods are already capable of performing arbitrarily complex arithmetic by chaining simpler calculations. Language models are generally trained or prompted to reason step-by-step, meaning that their generation can often be supplemented by a single-layer OccamNet. This is evidenced by our reasoning benchmarks, in which OccamLlama (with a single-layer OccamNet) performs quite well across a wide range of tasks.\n\nAdditionally, we can further improve OccamLlama systems with single-layer OccamNets by finetuning and/or prompting the model to think step-by-step.\n\n---\nWe are very grateful for your comments and suggestions. We hope you will agree that the additional experiments and clarifications will strengthen our paper.", "claims_and_evidence": "", "methods_and_evaluation_criteria": "", "theoretical_claims": "", "experimental_designs_or_analyses": "", "relation_to_broader_scientific_literature": "", "essential_references_not_discussed": "", "other_strengths_and_weaknesses": "", "other_comments_or_suggestions": "", "questions_for_authors": "", "summary_of_paper": "", "summary_of_recommendation": "", "technical_quality": "", "clarity_of_presentation": "", "potential_impact": "", "robotics_focus": "", "quality_of_limitations": "", "questions_for_rebuttal": "", "reasons_to_accept": "", "reasons_to_reject": "", "questions_to_authors": "", "extra_scores": {}}, {"review_id": "GDL2pPcy1M", "reviewer": "Reviewer_GTF8", "summary": "The paper \"OccamLLM: Fast and Exact Language Model Arithmetic in a Single Step\" introduces a novel framework for enabling exact arithmetic within large language models (LLMs) by integrating a symbolic architecture called OccamNet. This framework, termed OccamLLM or OccamLlama when using the Llama model, allows for single-step arithmetic computations directly within the LLM’s autoregressive process. The key contributions include achieving 100% accuracy on various arithmetic operations, outperforming models like GPT-4 without code interpreters, and demonstrating superior performance on complex arithmetic reasoning tasks.", "questions": "Scalability: How does OccamLLM perform on more complex, multi-step arithmetic problems in real-world applications?\n\nSecurity: Could you provide a more detailed analysis of the security benefits and potential vulnerabilities of using OccamNet for arithmetic tasks?", "limitations": "No ethics concerns.", "rating": 4, "confidence": 3, "soundness": 3, "presentation": 4, "contribution": 2, "strengths": "Originality: The integration of OccamNet with LLMs for single-step arithmetic is a novel approach.\n\nQuality: The experiments are comprehensive, covering a range of arithmetic operations and reasoning tasks.\n\nClarity: The paper is well-organized, with clear descriptions of the methodology and results.\n\nSignificance: This work addresses a critical limitation in LLMs' arithmetic capabilities, potentially impacting various applications requiring precise mathematical computations.", "weaknesses": "Limited Novelty in Approach: The paper stitches two existing architectures together to solve confined arithmetic tasks. While this combination is innovative, it does not introduce entirely new methodologies or architectures. The novelty is more in the application than in the fundamental approach.\n\nInadequate Justification for Methodology: The paper does not convincingly justify why the proposed methodology is preferable over existing methods such as code execution. The evaluation is extensive, but the practical advantages in terms of performance, computational efficiency, and real-world applicability are not fully established.\n\nScalability and Generalization: The framework is tested on specific arithmetic tasks and reasoning problems, but its scalability to more complex, multi-step arithmetic problems in real-world applications remains uncertain. There is limited discussion on how the approach would handle more extensive and varied datasets.\n\nSecurity Concerns: The claim that the approach is more secure than code execution is made without detailed analysis. It's not clear why code execution is such a concern that warrents this new methodology. Moreover, there could be other vulnerabilities associated with using a symbolic architecture that are not addressed in the paper.\n\nEvaluation Metrics: The evaluation focuses heavily on accuracy, but other metrics such as computational efficiency, speed, and resource utilization are not thoroughly discussed. These factors are crucial for practical deployment and comparison with other methods.\n\nIn short, I'm not convinced OccamLLM is relevant and why code execution is not superior.", "quality": null, "clarity": null, "significance": null, "originality": null, "strengths_and_weaknesses": "", "was_revised": false, "final_justification": "", "rebuttal": "> The integration of OccamNet with LLMs for single-step arithmetic is a novel approach...\n\nWe appreciate your kind remarks!\n\n> Limited Novelty in Approach: The paper stitches two existing architectures together to solve confined arithmetic tasks. While this combination is innovative, it does not introduce entirely new methodologies or architectures. The novelty is more in the application than in the fundamental approach.\n\nThank you for your comment. We acknowledge that the two key architectures which we combine in our model are known. However, we contest that systems combining known architectures are often still novel. For example, speculative decoding uses known generative architectures but combines them in novel ways.\n\nAdditionally, we believe our method of combining the two architectures is creative and novel. To our knowledge, our work is unique in that we implement a decoder module which *initializes* the parameters of a second computational model at each autoregressive step. In our mind, this is closest to a hypernetwork, but unlike a hypernetwork we initialize OccamNet at each autoregressive step instead of just once per input.\n\nWe believe this step is quite novel. To use an analogy, if this same idea were used in the context of linear layers (i.e. using one linear layer to initialize another), one arrives at a model similar to attention. In the same way that we believe attention is sufficiently distinct from a linear layer to be considered novel, we believe that our method is sufficiently distinct from other gated computation methods to be considered novel.\n\n> Inadequate Justification for Methodology: The paper does not convincingly justify why the proposed methodology is preferable over existing methods such as code execution. The evaluation is extensive, but the practical advantages in terms of performance, computational efficiency, and real-world applicability are not fully established.\n\nThank you for your comments. We argue for the following advantages of OccamLlama over code generation or finetuning:\n\n*Fine-tuning*\n* **No catastrophic forgetting:** Fine-tuning risks catastrophic forgetting, especially since arithmetic training datasets likely contain very little text.\n* **Improved arithmetic:** As shown in our arithmetic and mathematical reasoning benchmarks, even larger models such as GPT 4o fall short of OccamLLM for arithmetic more challenging than three-digit multiplication, so we also expect finetuned models to fall short of OccamLLM.\n\n*Code generation*\n* **No catastrophic forgetting:** Code generation generally requires fine-tuning an LLM to write and run code.\n* **Improved generation speed and cost:** In the arithmetic benchmarks, we found that GPT 4o with code required on average more than 50 completion tokens, far more than the single autoregressive step required by OccamLlama to answer each question. Additionally, our total expenses for GPT 4o with code were more than double that of GPT 4o without code, even though we made almost 5 times fewer queries to GPT 4o with code. This suggests that OccamLLM would be faster and cheaper compared to code generation.\n* **Improved security:** Running LLM-generated code is potentially unsafe. For example, the LLM could ask to run the python code __ import__('os').system('rm -rf /'). It is in general extremely challenging to check general-purpose code for malicious behavior. We believe that the two best solutions are 1) to run all code in an isolated virtual machine and 2) to run a restricted language that is not Turing-complete.\n* **Reduced engineering:** Building a system that hosts an LLM and a sandbox to safely run code requires a high engineering effort.\n\nWe will make these points clearer in the paper.\n\n> Scalability and Generalization: The framework is tested on specific arithmetic tasks and reasoning problems, but its scalability to more complex, multi-step arithmetic problems in real-world applications remains uncertain. There is limited discussion on how the approach would handle more extensive and varied datasets.\n\nThank you for your comment. We believe that the mathematical reasoning benchmarks provide experimental validation that OccamLlama can effectively handle compound expressions. These are multi-step math problems requiring multiple calls to OccamNet. Given OccamLlama's strong performance on these benchmarks, we hope you will agree that OccamLlama can effectively handle compound expressions. We will make this clearer in the paper.\n\nSince submitting to NeurIPS, we identified a few minor bugs in our code and slightly reweighted the proportions of the different training datasets. These changes maintained the perfect performance on arithmetic tasks and improved performance on mathematical reasoning tasks. The updated results are shown in Figure a) of the global response PDF and the table below:\n\n**Table:** *Accuracy on reasoning tasks. Higher is Better.*\n\n| Dataset | OccamLlama 8B | OccamLlama 70B | Llama 3 8b Instruct | GPT 3.5 Turbo | GPT 4o  | GPT 4o Code |\n|:--|:--:|:--:|:--:|:--:|:--:|:--:|\n| AddSub | 91.6 ± 1.4 | **98.0 ± 1.4** | 93.4 ± 1.2 | 95.4 ± 1.1 | 97.0 ± 0.9 | 97.5 ± 1.1 |\n| GSM8K | 73.5 ± 1.2 | 87.0 ± 3.4 | 79.8 ± 1.1 | 84.8 ± 1.0 | **96.1 ± 0.5** | 94.0 ± 1.7 |\n| MultiArith | 99.2 ± 0.4 | **100.0 ± 0.0** | 99.8 ± 0.2 | 97.2 ± 0.7 | 99.7 ± 0.2 | 99.5 ± 0.5 |\n| MultiArith Float | 98.2 ± 0.5 | **99.0 ± 1.0** | 57.3 ± 2.0 | 77.3 ± 1.7 | 96.2 ± 0.8 | 89.5 ± 2.2 |\n| MATH401 | 85.0 ± 1.8 | **91.0 ± 2.9** | 60.3 ± 2.4 | 63.1 ± 2.4 | 76.6 ± 2.1 | 78.0 ± 2.9 |\n| Single Eq | 92.9 ± 1.1 | 93.0 ± 2.6 | 96.3 ± 0.8 | 97.8 ± 0.6 | 98.0 ± 0.6 | **99.0 ± 0.7** |\n| SVAMP | 88.6 ± 1.0 | 96.0 ± 2.0 | 86.3 ± 1.1 | 87.8 ± 1.0 | 96.2 ± 0.6 | **96.5 ± 1.3** |\n| **Average** | 89.9 ± 1.1 | **94.9 ± 1.9** | 81.9 ± 1.3 | 86.2 ± 1.2 | 94.2 ± 0.8 | 93.4 ± 1.5 |\n\n*Continued below*", "claims_and_evidence": "", "methods_and_evaluation_criteria": "", "theoretical_claims": "", "experimental_designs_or_analyses": "", "relation_to_broader_scientific_literature": "", "essential_references_not_discussed": "", "other_strengths_and_weaknesses": "", "other_comments_or_suggestions": "", "questions_for_authors": "", "summary_of_paper": "", "summary_of_recommendation": "", "technical_quality": "", "clarity_of_presentation": "", "potential_impact": "", "robotics_focus": "", "quality_of_limitations": "", "questions_for_rebuttal": "", "reasons_to_accept": "", "reasons_to_reject": "", "questions_to_authors": "", "extra_scores": {}}, {"review_id": "0lo6wBsgeB", "reviewer": "Reviewer_Z5Za", "summary": "The paper tackles the well known issue of performing arithmetic operations from LLMs.\nIn particular, authors showed the following\n1. Llama + OccamNet model can be trained to perform a single arithmetic task\n2. Train the OccamNet model and Occam switch using synthetic data, both pure arithmetic task and simple reasoning problems\n3. The joint model outperform strong LLMs model on single arithmetic operations.", "questions": "1. How did you generate the OccamLLM switch training data (\"we manually created and labeled several other examples for diverse scenarios, to explicitly teach the system in which cases it should or should not use OccamNet\")?\n2. How robust is the model to unseen training data?", "limitations": "Authors did some work to address the limitations, but making Llama do the multi step calculations actually defeats the purpose of the work.", "rating": 3, "confidence": 4, "soundness": 2, "presentation": 4, "contribution": 2, "strengths": "1. Adding an external OccamNet helps on avoiding finetuning the LLM model (which exposes the model to the risk of catastrophic forgetting or becoming less safe).\n2. The manual data collection is either cheap or completely non-existent, with the result that the idea can be replicated for other reasoning tasks. \n3. Introducing the MultiArith Float is a significant contribution, allowing the use for further research in the same domain.\n4. The method is clearly faster than current LLMs, although on a very small token proportions.", "weaknesses": "1. My main concern is about novelty. The idea of offloading calculation to another specialized model with a Switch is not new. \n2. The work cannot be easily expanded on multi step calculations. In particular, for a task of length $n$ you probably require a $n$ layer OccamNet, which imposes a big constrain on the calculation you can actually do. \n3. There is no comparison between the OccamNet and another baseline, i.e. a trained Transformer which makes the Python code for the calculations only. The baseline should be easy to train, with no safety risk and with no catastrophic forgetting, but also comes with multi step calculations for free. \n4. The methodology depends on a constrained set of operations and numbers only, and the paper doesn't discuss how OccamLLM, and the Switch in particular, handles ambiguous or uncertain inputs (i.e. \"compute one plus two\"), making it less relevant for real world applications.\n5. On math benchmarks, especially on GSM8K, the results are pretty weak. Authors explained the reason, but it's not clear how to fix it without adding more data. In that case I'm not clear about the benefit of training the OccamNet and Switch compared to add these data to the LLM pretraining dataset.", "quality": null, "clarity": null, "significance": null, "originality": null, "strengths_and_weaknesses": "", "was_revised": false, "final_justification": "", "rebuttal": ">Strengths:\n>\n>Adding an external OccamNet helps on avoiding finetuning the LLM model (which exposes the model to the risk of catastrophic forgetting or becoming less safe).\nThe manual data collection is either cheap or completely non-existent, with the result that the idea can be replicated for other reasoning tasks.\n>\n>Introducing the MultiArith Float is a significant contribution, allowing the use for further research in the same domain.\n>\n>The method is clearly faster than current LLMs, although on a very small token proportions.\n\nWe appreciate your kind remarks!\n\n> Weaknesses:\n>\n> My main concern is about novelty. The idea of offloading calculation to another specialized model with a Switch is not new.\n\nWe acknowledge that offloading computation with a switch is a common procedure in mixture of experts models. However, to our knowledge, our work is unique in that we implement a decoder module which *initializes* the parameters of a second computational model at each autoregressive step. In our mind, this is closest to a hypernetwork, but unlike a hypernetwork we initialize OccamNet at each autoregressive step instead of just once per input.\n\nWe believe this step is quite novel. To use an analogy, if this same idea were used in the context of linear layers (i.e. using one linear layer to initialize another), one arrives at a model similar to attention. In the same way that we believe attention is sufficiently distinct from a linear layer to be considered novel, we believe that our method is sufficiently distinct from other gated computation methods to be considered novel.\n\n> The work cannot be easily expanded on multi step calculations. In particular, for a task of length N you probably require an N layer OccamNet, which imposes a big constrain on the calculation you can actually do.\n\nThank you for your interest in OccamLLM using a multi-layer OccamNet. We are exploring this direction in future work, and we beleive we can train performant OccamLLM systems with a many-layer OccamNet. In the present paper, we simply wish to demonstrate the potential promise of using multiple-layer OccamNets.\n\nWe note that our existing methods are already capable of performing arbitrarily complex arithmetic by chaining simpler calculations. Existing language models are generally trained or prompted to reason step-by-step, meaning that their generation can often be supplemented by a single-layer OccamNet. This is evidenced by our reasoning benchmarks, in which OccamLlama (with a single-layer OccamNet) performs quite well across a wide range of tasks.\n\nAdditionally, we can further improve OccamLlama systems with single-layer OccamNets by finetuning and/or prompting the model to think step-by-step.\n\n> There is no comparison between the OccamNet and another baseline, i.e. a trained Transformer which makes the Python code for the calculations only. The baseline should be easy to train, with no safety risk and with no catastrophic forgetting, but also comes with multi step calculations for free.\n\nIn the text, we describe what we believe are compelling reasons why OccamLLM works most naturally when representing the probability distribution over functions using OccamNet.\n\nRegarding transformers and RNNs, we believe that OccamNet possesses a key advantage of being interpretable; simply by looking at the weights, it is possible for a human to determine which functions OccamNet assigns a high probability. We believe that this interpretability will make OccamNet easy for a decoder to initialize with the desired distribution. On the other hand, an RNN or transformer have substantially more complex relations between the weights and corresponding probability distribution, which we hypothesize would make learning a decoder for such models difficult.\n\nThis leads us to a key point: transformers and RNNs are effective for modeling complex multimodal distributions, but for this problem, we want to select a single function for each token, so the extra expressivity of these models is unneeded and likely detrimental to performance. We believe that OccamNet, a much simpler architecture, enables better parameter efficiency and performance.\n\nWe also tested using [Equation Learner](https://arxiv.org/pdf/1610.02995) but we found it to be unstable. The EQL model represents a single function instead of a probability distribution over functions, and therefore the RL-inspired OccamNet loss cannot be used. The Mean Square Error loss used in this case requires many adjustments and tricks to enable the model to train, and we find that EQL explores the function space much less efficiently. Thus, it gets stuck and local minima. We didn't manage to get good performance with EQL.\n\nRegarding your proposal to replace OccamNet with a transformer which produces Python code for the relevant calculation, we believe this still presents a security risk in that code such as __ import__('os').system('rm -rf /') could be generated and run. Although this is a particularly obvious example, it is in general extremely challenging to check general-purpose code for malicious behavior. We believe that one potential solution would be to train a transformer to generate a restricted language that is not Turing-complete, such as a prefix-notation formula. We are happy to run this baseline and report the result if you would like. At the same time, we are confident that, for the reasons listed above, OccamNet will perform better than this alternative.\n\n*Continued below*", "claims_and_evidence": "", "methods_and_evaluation_criteria": "", "theoretical_claims": "", "experimental_designs_or_analyses": "", "relation_to_broader_scientific_literature": "", "essential_references_not_discussed": "", "other_strengths_and_weaknesses": "", "other_comments_or_suggestions": "", "questions_for_authors": "", "summary_of_paper": "", "summary_of_recommendation": "", "technical_quality": "", "clarity_of_presentation": "", "potential_impact": "", "robotics_focus": "", "quality_of_limitations": "", "questions_for_rebuttal": "", "reasons_to_accept": "", "reasons_to_reject": "", "questions_to_authors": "", "extra_scores": {}}, {"review_id": "l84EJEU3ra", "reviewer": "Reviewer_r8sc", "summary": "This paper proposes OccamLLM, an approach to enable models to have better arithmetic abilities. Although LLMs have impressive generative abilities, these models struggle with simple arithmetic. Therefore this paper proposes OccamLLM, which integrates OccamNet, a symbolic netural architecture that can perform arithmetic operations, into the decoding process of the LLM. The approach adds two further steps to the decoding process: First a text parser extracts all numeric values from the input text, which it fed into the OccamNet which evaluates the expression. Secondly, the decoder determines whether to use the language model or the OccamNet for generating the next token. Both systems are trained, where the OccamNet is trained with synthetic examples from templates, and the selection decoder is trained with several manual annotation examples. The paper then evaluates OccamLLM on simple arithmetic tasks, and finds that OccamLLM can get 100% accuracy for these 7-digit calculations, while the base Llama3-8B model struggles with these computations. Further, the system is applied to general reasoning tasks, as well as 2-step and 3-step arithmetic tasks.", "questions": "How did you generate the training and evaluation dataset, and what templates were used? I’m aware that Appendix A.1 details split sizes and the type of questions, but are all the queries just the raw calculation, e.g. input=’1254+854’ (+ all the prompting such as putting ‘Answer:’ or requesting to give the response in decimals).", "limitations": "The authors have adequately discussed limitations", "rating": 6, "confidence": 3, "soundness": 3, "presentation": 4, "contribution": 3, "strengths": "- S1) The proposed method offers some valuable advantages over existing approaches. It does not need to update the model weights and therefore will not suffer from catastrophic forgetting (like integrating LLM tools may), while being more computationally efficient than code generation which will require 2 stages and intermediate code that can be 50x longer.\n\n- S2) For single step arithmetic with 7-digit inputs, the OccamLLM is very robust and is always able to generate the correct answer, while the baseline LLama3 8B model struggles with these calculations. \n\n- S3) The use of an OccamNet is highly interpretable, as one can look at the predicted computational DAG, which can also be useful for interpreting why a calculation goes wrong when it does.", "weaknesses": "- W1) When applied to word-based mathematical reasoning problems, the system only performs better than its baseline (Llama3-8B) when high precision is required (e.g. MultiArith Float and MATH401) but otherwise performance is quite similar.\n\n- W2) The strongest results shown are for 1-step arithmetic, however considering this is a very simple set up and is matched with the training methodology. Whether the OccamNet generalises well to similar 1 step arithmetic when embedded in more complicated text-based questions, more similar to the results in section 4.2, is less apparent.\n\n- W3) As mentioned in the limitation, many of the results focus on single 1-step arithmetic problems, and although results for 2 and 3 step are still reasonable, there is performance degradation. I’d speculate that the code-based LLMs may not suffer from such issues.", "quality": null, "clarity": null, "significance": null, "originality": null, "strengths_and_weaknesses": "", "was_revised": false, "final_justification": "", "rebuttal": ">Strengths:\n>\n>S1) The proposed method offers some valuable advantages over existing approaches. It does not need to update the model weights and therefore will not suffer from catastrophic forgetting (like integrating LLM tools may), while being more computationally efficient than code generation which will require 2 stages and intermediate code that can be 50x longer.\n>\n>S2) For single step arithmetic with 7-digit inputs, the OccamLLM is very robust and is always able to generate the correct answer, while the baseline LLama3 8B model struggles with these calculations.\n>\n>S3) The use of an OccamNet is highly interpretable, as one can look at the predicted computational DAG, which can also be useful for interpreting why a calculation goes wrong when it does.\n\nWe appreciate your kind remarks!\n\n>Weaknesses:\n>\n> W1) When applied to word-based mathematical reasoning problems, the system only performs better than its baseline (Llama3-8B) when high precision is required (e.g. MultiArith Float and MATH401) but otherwise performance is quite similar.\n\nWe acknowledge that the OccamLLM framework does not bring substantial improvements in general reasoning tasks that do not require challenging arithmetic. Indeed, the target of this system is to ensure that the arithmetic is performed correctly, as incorrect arithmetic disturbs the reasoning process of LLMs. It is expected that the improvements provided by this method are only prominent in tasks that require challenging arithmetic operations; otherwise, the LLM does require OccamNet and can sucessfully follow its natural reasoning path. The reasoning heavy-lifting is still performed by the LLM, and OccamNet assists it to ensure that the computations are accurate and the reasoning can proceed satisfactorily.\n\nSince submitting to NeurIPS, we identified a few minor bugs in our code which were limiting performance and slightly reweighted the proportions of the different training datasets. These changes maintained the perfect performance on arithmetic tasks and improved performance on mathematical reasoning tasks. The updated results are shown visually in Figure a) of the global response PDF, and we also present them in the table below:\n\n**Table:** *Accuracy on reasoning tasks. Higher is Better.*\n\n| Dataset | OccamLlama | Llama 3 8B Instruct | GPT 3.5 Turbo | GPT 4o | GPT 4o Code |\n|:--|:--:|:--:|:--:|:--:|:--:|\n| AddSub | 91.6 ± 1.4 | 93.4 ± 1.2 | 95.4 ± 1.1 | 97.0 ± 0.9 | **97.5 ± 1.1** |\n| GSM8K | 73.5 ± 1.2 | 79.8 ± 1.1 | 84.8 ± 1.0 | **96.1 ± 0.5** | 94.0 ± 1.7 |\n| MultiArith | 99.2 ± 0.4 | **99.8 ± 0.2** | 97.2 ± 0.7 | 99.7 ± 0.2 | 99.5 ± 0.5 |\n| MultiArith Float | **98.2 ± 0.5** | 57.3 ± 2.0 | 77.3 ± 1.7 | 96.2 ± 0.8 | 89.5 ± 2.2 |\n| MATH401 | **85.0 ± 1.8** | 60.3 ± 2.4 | 63.1 ± 2.4 | 76.6 ± 2.1 | 78.0 ± 2.9 |\n| Single Eq | 92.9 ± 1.1 | 96.3 ± 0.8 | 97.8 ± 0.6 | 98.0 ± 0.6 | **99.0 ± 0.7** |\n| SVAMP | 88.6 ± 1.0 | 86.3 ± 1.1 | 87.8 ± 1.0 | 96.2 ± 0.6 | **96.5 ± 1.3** |\n| **Average** | 89.9 ± 1.1 | 81.9 ± 1.3 | 86.2 ± 1.2 | **94.2 ± 0.8** | 93.4 ± 1.5 |\n\nHere, we see that OccamLlama outperforms even GPT 4o and GPT 4o with Code on benchmarks requiring challenging arithmetic (MultiArith Float and MATH401), areas where OccamLlama shines. Additionally, the gap between OccamLlama and LLama 3 8B is substantially smaller on GSM8K. On average, OccamLlama outperforms both Llama and GPT 3.5 Turbo, with accuracy approximately halfway between that of GPT 3.5 and GPT 4o.\n\nWe also find that the performance of OccamLlama on reasoning benchmarks improves dramatically as we increase the base model from Llama 3 8B to Llama 3 70B (OccamLlama 70B).\n\nTo ensure we had results in time for the rebuttal deadline, we sampled 100 random questions from each dataset to determine OccamLlama 70B's performance, which is the cause for the relatively large error bars. We will update this response with the full results once they complete. The results are shown visually in Figure d) of the global response PDF and are also presented in the table below:\n\n**Table:** *Accuracy on reasoning tasks. Higher is better.*\n\n| Dataset | OccamLlama 8B | OccamLlama 70B | Llama 3 8B Instruct | GPT 3.5 Turbo | GPT 4o | GPT 4o Code |\n|:--|:--:|:--:|:--:|:--:|:--:|:--:|\n| AddSub | 91.6 ± 1.4 | **98.0 ± 1.4** | 93.4 ± 1.2 | 95.4 ± 1.1 | 97.0 ± 0.9 | 97.5 ± 1.1 |\n| GSM8K | 73.5 ± 1.2 | 87.0 ± 3.4 | 79.8 ± 1.1 | 84.8 ± 1.0 | **96.1 ± 0.5** | 94.0 ± 1.7 |\n| MultiArith | 99.2 ± 0.4 | **100.0 ± 0.0** | 99.8 ± 0.2 | 97.2 ± 0.7 | 99.7 ± 0.2 | 99.5 ± 0.5 |\n| MultiArith Float | 98.2 ± 0.5 | **99.0 ± 1.0** | 57.3 ± 2.0 | 77.3 ± 1.7 | 96.2 ± 0.8 | 89.5 ± 2.2 |\n| MATH401 | 85.0 ± 1.8 | **91.0 ± 2.9** | 60.3 ± 2.4 | 63.1 ± 2.4 | 76.6 ± 2.1 | 78.0 ± 2.9 |\n| Single Eq | 92.9 ± 1.1 | 93.0 ± 2.6 | 96.3 ± 0.8 | 97.8 ± 0.6 | 98.0 ± 0.6 | **99.0 ± 0.7** |\n| SVAMP | 88.6 ± 1.0 | 96.0 ± 2.0 | 86.3 ± 1.1 | 87.8 ± 1.0 | 96.2 ± 0.6 | **96.5 ± 1.3** |\n| **Average** | 89.9 ± 1.1 | **94.9 ± 1.9** | 81.9 ± 1.3 | 86.2 ± 1.2 | 94.2 ± 0.8 | 93.4 ± 1.5 |\n\nThese results demonstrate that OccamLLM is capable of robust performance on large-scale models. Training the OccamLLM 70B system (in 16-bit LLM precision and unoptimized code) required approximately 1.5-2 days on a system with two A100 nodes, demonstrating the low compute requirements of our method.\n\nOccamLlama 70B shows consistent improvement over OccamLlama 8B. We believe this results from a combination of Llama 3 70B's improved reasoning capabilities and Llama 3 70B's improved representations (which enable OccamLlama to generalize more effectively). We expect that training with even larger base models would lead to further improvements. Remarkably, OccamLlama 70B outperforms GPT 4o and GPT 4o with Code on average across these benchmarks. It also outperforms GPT 3.5 Turbo on all but Single Eq.\n\n*Continued below*", "claims_and_evidence": "", "methods_and_evaluation_criteria": "", "theoretical_claims": "", "experimental_designs_or_analyses": "", "relation_to_broader_scientific_literature": "", "essential_references_not_discussed": "", "other_strengths_and_weaknesses": "", "other_comments_or_suggestions": "", "questions_for_authors": "", "summary_of_paper": "", "summary_of_recommendation": "", "technical_quality": "", "clarity_of_presentation": "", "potential_impact": "", "robotics_focus": "", "quality_of_limitations": "", "questions_for_rebuttal": "", "reasons_to_accept": "", "reasons_to_reject": "", "questions_to_authors": "", "extra_scores": {}}, {"review_id": "DJDJDUeYIM", "reviewer": "Reviewer_JtJz", "summary": "This paper introduces a framework enabling Large Language Models (LLMs) to perform exact arithmetic operations efficiently and securely. By utilizing hidden states from an LLM to control a symbolic architecture named OccamNet, the framework achieves high accuracy and interpretability without compromising speed or security.", "questions": "**Handling Unrelated Numbers**: How does the model manage sentences with numbers unrelated to the arithmetic operation, such as historical data in the question \\'In 1932, 100 planets were discovered and in 1933, another 200 were found. What is the total number of planets discovered between 1932 and 1933? \\' How does the string parser determine which numbers should be input into OccamNet?", "limitations": "**Compound Expressions**: The framework's reliance on prompting LLMs to decompose compound expressions is a significant limitation. If LLMs fail to adequately simplify these expressions, the decoder might incorrectly determine the operation to be performed or fail to revert to the LLM for complex expressions. Additionally, the paper lacks experimental validation that LLMs can effectively handle compound expressions.", "rating": 7, "confidence": 3, "soundness": 3, "presentation": 3, "contribution": 3, "strengths": "1. **Addressing a Key Weakness**: Popular LLMs struggle with simple arithmetic, limiting their understanding of physics and mathematics. This paper overcomes this limitation by integrating a symbolic model, OccamNet, which performs basic arithmetic with 100% accuracy.\n2. **Innovative Integration**: The authors propose a decoder mechanism to determine whether the next token should be generated from the LLM or OccamNet, and which operation OccamNet should execute. This approach of integrating OccamNet with other LLMs opens interesting future research directions, particularly in combining other tools with LLMs.", "weaknesses": "**Decoder's Robustness**: The effectiveness of OccamLLM heavily depends on the decoder's training across various prompts to accurately discern the required operation. There is a risk that unfamiliar prompts could lead the decoder to instruct OccamNet to perform incorrect operations.", "quality": null, "clarity": null, "significance": null, "originality": null, "strengths_and_weaknesses": "", "was_revised": false, "final_justification": "", "rebuttal": "> Strengths:\n>\n>Addressing a Key Weakness: Popular LLMs struggle with simple arithmetic, limiting their understanding of physics and mathematics. This paper overcomes this limitation by integrating a symbolic model, OccamNet, which performs basic arithmetic with 100% accuracy.\n>\n>Innovative Integration: The authors propose a decoder mechanism to determine whether the next token should be generated from the LLM or OccamNet, and which operation OccamNet should execute. This approach of integrating OccamNet with other LLMs opens interesting future research directions, particularly in combining other tools with LLMs.\n\nWe appreciate your kind remarks!\n\n> Weaknesses:\n>\n> Decoder's Robustness: The effectiveness of OccamLLM heavily depends on the decoder's training across various prompts to accurately discern the required operation. There is a risk that unfamiliar prompts could lead the decoder to instruct OccamNet to perform incorrect operations.\n\nThank you for your comment. We agree that this is a potential concern. However, we contend that out-of-distribution inputs are a problem for all machine learning models, so this issue is not specific to OccamLlama.\n\nIn fact, we find that OccamLlama displays remarkable generalization capabilities on out-of-distribution problems. To demonstrate this, we train the OccamNet decoder **from scratch**, using **only numeric expressions** and **absolutely no text at all**. This means that any problem with text, such as a word problem, is far out of distribution of the OccamNet decoder's training data. We test this model (using the standard router) on the mathematical reasoning benchmarks and obtain remarkably good results, shown visually in Figure b) of the global response PDF and presented in the table below. The OccamLlama 8B decoder trained only with numerical expressions performs on par with the model trained with both numbers and text, even achieving higher accuracy on some benchmarks. This shows that the OccamLLM framework is robust and points towards the fact that the representations of arithmetic that are built in the transformer body of the LLM and extracted by the OccamLLM Decoder are very general.\n\n**Table:** *Accuracy on reasoning tasks. Higher is Better.*\n\n| Dataset | OccamLlama | OccamLlama Arith | Llama 2 7B Chat | Llama 3 8B Instruct | GPT 3.5 Turbo | GPT 4o | GPT 4o Code |\n|:--|:--:|:--:|:--:|:--:|:--:|:--:|:--:|\n| AddSub | 91.6 ± 1.4 | 92.7 ± 1.3 | 78.0 ± 2.1 | 93.4 ± 1.2 | 95.4 ± 1.1 | 97.0 ± 0.9 | **97.5 ± 1.1** |\n| GSM8K | 73.5 ± 1.2 | 71.6 ± 1.2 | 36.0 ± 1.3 | 79.8 ± 1.1 | 84.8 ± 1.0 | **96.1 ± 0.5** | 94.0 ± 1.7 |\n| MultiArith | 99.2 ± 0.4 | 98.5 ± 0.5 | 76.0 ± 1.7 | **99.8 ± 0.2** | 97.2 ± 0.7 | 99.7 ± 0.2 | 99.5 ± 0.5 |\n| MultiArith Float | **98.2 ± 0.5** | 95.3 ± 0.9 | 23.3 ± 1.7 | 57.3 ± 2.0 | 77.3 ± 1.7 | 96.2 ± 0.8 | 89.5 ± 2.2 |\n| MATH401 | 85.0 ± 1.8 | **85.8 ± 1.7** | 43.9 ± 2.5 | 60.3 ± 2.4 | 63.1 ± 2.4 | 76.6 ± 2.1 | 78.0 ± 2.9 |\n| Single Eq | 92.9 ± 1.1 | 92.1 ± 1.2 | 79.1 ± 1.8 | 96.3 ± 0.8 | 97.8 ± 0.6 | 98.0 ± 0.6 | **99.0 ± 0.7** |\n| SVAMP | 88.6 ± 1.0 | 88.8 ± 1.0 | 61.5 ± 1.5 | 86.3 ± 1.1 | 87.8 ± 1.0 | 96.2 ± 0.6 | **96.5 ± 1.3** |\n| **Average** | 89.9 ± 1.1 | 89.3 ± 1.1 | 56.8 ± 1.8 | 81.9 ± 1.3 | 86.2 ± 1.2 | **94.2 ± 0.8** | 93.4 ± 1.5 |\n\nIn contrast, we expect that finetuning Llama to perform arithmetic using only numeric examples and no text whatsoever would lead to extreme catastrophic forgetting and poor arithmetic performance on word problems. As such, we believe this data shows a remarkable robustness of OccamLLM.\n\nAs a second example of generalization, we tested OccamLlama on the [Multilingual Grade School Math Benchmark (MGSM)](https://paperswithcode.com/dataset/mgsm), a dataset consisting of GSM8K translated into 10 languages (Bengali, Chinese, French, German, Japanese, Russian, Spanish, Swahili, Telugu, and Thai). We compute the drop in accuracy when switching from English to another language, given by the accuracy of a model on the English dataset minus the accuracy of the model on the dataset in a given language. For OccamLlama in Bengali and Telugu, due to time constraints, we evaluated on a subset of 100 and 50 randomly chosen problems, respectively. We will update the table below with the full results soon. We show the results in visually in Figure c) of the global response PDF and the table below:\n\n**Table:** *Accuracy drop on multilingual reasoning tasks. Lower is better.*\n\n| Dataset | OccamLlama | Llama 3 8B Instruct |\n|:--|:--:|:--:|\n| Bengali | **27.0 ± 5.8** | 43.2 ± 3.9 |\n| Chinese | 21.2 ± 4.3 | **17.6 ± 3.7** |\n| French | **13.6 ± 4.2** | **13.6 ± 3.7** |\n| German | 14.0 ± 4.2 | **11.6 ± 3.6** |\n| Japanese | **47.2 ± 3.9** | 63.6 ± 3.4 |\n| Russian | 15.2 ± 4.2 | **12.8 ± 3.6** |\n| Spanish | **5.6 ± 4.1** | 9.2 ± 3.5 |\n| Swedish | **32.0 ± 4.2** | 38.4 ± 3.9 |\n| Telugu | **56.0 ± 6.0** | 61.6 ± 3.5 |\n| Thai | **20.0 ± 4.3** | 21.2 ± 3.8 |\n| **Average** | 38.0 ± 4.2 | **29.3 ± 3.7** |\n\nThe table above shows that OccamLlama has on average a smaller performance drop than llama between the English dataset and the non-English language datasets. The fact that OccamLlama (the decoders for which have never been trained on other languages) has on average better out-of-distribution behavior than Llama (a model trained on over 750 billion tokens of non-English text) is in our opinion quite remarkable.\n\nWe believe that these two tests demonstrate OccamLlama's robustness against out-of-distribution data.\n\n*Continued below*", "claims_and_evidence": "", "methods_and_evaluation_criteria": "", "theoretical_claims": "", "experimental_designs_or_analyses": "", "relation_to_broader_scientific_literature": "", "essential_references_not_discussed": "", "other_strengths_and_weaknesses": "", "other_comments_or_suggestions": "", "questions_for_authors": "", "summary_of_paper": "", "summary_of_recommendation": "", "technical_quality": "", "clarity_of_presentation": "", "potential_impact": "", "robotics_focus": "", "quality_of_limitations": "", "questions_for_rebuttal": "", "reasons_to_accept": "", "reasons_to_reject": "", "questions_to_authors": "", "extra_scores": {}}]

Author rebuttal:
# Responses to general concerns
We would like to thank all reviewers for their thoughtful comments. Below we address general concerns.

> We only tried small models

To demonstrate OccamLLM's scalability, we trained OccamLlama using Llama 3 70B Instruct (OccamLlama 70B) and evaluated it in Figure d) (attached PDF).

These results demonstrate that OccamLLM is capable of efficient training and robust performance on large-scale models. OccamLlama 70B shows consistent improvement over OccamLlama 8B, outperforming GPT 4o and GPT 4o with Code on average across these benchmarks. It also outperforms GPT 3.5 Turbo on all but Single Eq.

> We might not generalize to out-of-distribution data

Some reviewers were concerned about how our approach would generalize to specific unseen situations. We address these comments by showing that our method works for these specific cases.

We also show:
1. That an OccamLlama model for which the OccamNet decoder model trained on **only numeric expressions** and **absolutely no text** performs comparably on mathematical reasoning benchmarks (which include many word problems) to an OccamLlama model trained on both numeric expressions and word problems.

2. That an OccamLlama model trained only using English expressions displays on average a smaller drop in performance when solving problems in non-English languages than Llama 3 8B, even though Llama 3 has been trained on over 750 billion non-English language tokens.

We believe that these two tests demonstrate OccamLlama's robustness against out-of-distribution data.

> Comparisons to other symbolic architectures besides OccamNet

We explain why OccamNet is most suitable as a symbolic model for OccamLLM, highlighting its interpretability advantage. We tested [Equation Learner](https://arxiv.org/pdf/1610.02995) but found it unstable and prone to poor local minima. 

Reviewer Z5Za asks that we specifically test replacing OccamNet with a transformer that generates and runs Python code as a secure alternative. We point out a security vulnerability and propose to train a transformer that generates prefix-notation expressions instead, which believe is a safer alternative.

> Questions about novelty

We appreciate that reviewers bzKn, GTF8, and JtJz recognize the novelty of combining OccamNet with an LLM.

We acknowledge that the two key architectures which we combine in our model are known. However, we contest that systems combining known architectures are often still novel. For example, speculative decoding uses known generative architectures but combines them in novel ways.

Additionally, we believe our method of combining the two architectures is creative and novel. To our knowledge, our work is unique in that we implement a decoder module which *initializes* the parameters of a second computational model at each autoregressive step. In our mind, this is closest to a hypernetwork, but unlike a hypernetwork we initialize OccamNet at each autoregressive step instead of just once per input.

We believe this step is quite novel. To use an analogy, if this same idea were used in the context of linear layers (i.e. using one linear layer to initialize another), one arrives at a model similar to attention. In the same way that we believe attention is sufficiently distinct from a linear layer to be considered novel, we believe that our method is sufficiently distinct from other gated computation methods to be considered novel.

> Questions about multi-layer OccamNets

We are exploring OccamLLM with a multi-layer OccamNet as future work. In the present paper, we simply wish to demonstrate the potential promise of using multiple-layer OccamNets.

We note that our existing methods can already perform arbitrarily complex arithmetic by chaining simpler calculations. This is how OccamLlama (with a single-layer OccamNet) performs quite well across a wide range mathematical reasoning benchmarks.

> Concerns about multi-step reasoning results

We demonstrate small training tweaks that cause OccamLlama to outperform even GPT 4o and GPT 4o with Code on MultiArith Float and MATH401 and to substantially diminish the gap with LLama 3 8B on GSM8K. On average, OccamLlama outperforms both Llama and GPT 3.5 Turbo, with accuracy approximately halfway between that of GPT 3.5 and GPT 4o.

We also find that the performance of OccamLlama on reasoning benchmarks improves dramatically as we increase the base model from Llama 3 8B to Llama 3 70B, as discussed above.

> Advantages compared to code generation or finetuning

We argue for the following advantages of OccamLlama over code generation or finetuning:

*Fine-tuning*
* **No catastrophic forgetting.**
* **Improved arithmetic.** As shown in our arithmetic and mathematical reasoning benchmarks, even larger models such as GPT 4o fall short of OccamLLM for arithmetic more challenging than three-digit multiplication, so we also expect finetuned models to fall short of OccamLLM.

*Code generation*
* **No catastrophic forgetting.**
* **Improved generation speed and cost.** In the arithmetic benchmarks, we found that GPT 4o with code required on average more than 50 completion tokens, far more than the single autoregressive step required by OccamLlama to answer each question. Additionally, our total expenses for GPT 4o with code were more than double that of GPT 4o without code, even though we made almost 5 times fewer queries to GPT 4o with code. This suggests OccamLLM would be faster and cheaper than code generation.
* **Improved security:** Running LLM-generated code is potentially unsafe. For example, the LLM could ask to run the python code __ import__('os').system('rm -rf /'). It is in general extremely challenging to check general-purpose code for malicious behavior.
* **Reduced engineering:** Building a system that hosts an LLM and a sandbox to safely run code requires a high engineering effort.

We again thank the reviewers for their comments. We will make all of these points clearer in the paper.

Meta-review: OccamLLM augments a pre-trained LLM with an auxiliary neuro-symbolic network that can perform arithmetic operations.  At each autoregressive step, a switch chooses whether to output a token from the LLM, or from the arithmetic network.  Unlike other work which combines LLMs + tools, the LLM itself has frozen weights -- it does not need any finetuning.  Instead, the decoder and switch are trained to observe the hidden states of a pre-trained LLM.  OccamLLM is also potentially faster, since it can do arithmetic "in its head" for each token, and does not have to invoke the main LLM to generate code.  

The authors demonstrate that on arithmetic-heavy math problems, OccamLLM does much better than non-augmented LLMs.

Reviewer responses were very mixed to this paper.  One accept (7), two weak accepts (6), one weak reject (4), and one reject (3).   Reviewers brought up three main complaints.  First, several reviewers questioned the novelty of the approach, since augmenting an LLM with a switch is not new.  Second, several reviewers complained that the arithmetic network was strictly less general than code generation, and did not think that the advantages (speed, simplicity) outweighed the loss of generality.  Third, while OccamLLM performed much better than comparable LLMs on tasks that required heavy arithmetic, it actually performed slightly worse on tasks that did not.  

After reading both the paper and the reviews, I think some of the reviewers were too harsh.  The paper is very well-written, and the authors very clearly spell out the benefits of having a small arithmetic network that runs on each token, vs. the cost and complexity of full code generation.  I agree that code generation is more powerful, but I do not think that alternative mechanisms should be rejected out of hand.

I also disagree with the critique that the authors' approach is not sufficiently novel.  Incorporating a dedicated arithmetic unit into an LLM does seem to be a novel combination (none of the reviewers disputed this point), even if the precise mechanism for integration borrows ideas from prior work.  

Unfortunately, I agree with the other reviewers that there is cause for concern, because OccamLLM does worse than competing models on tasks that are not arithmetic-heavy.  The authors argue that a big advantage of OccamLLM is that it does not suffer from catastrophic forgetting due to fine-tuning.  However, even without fine-tuning, the switch is still interfering with the operation of the LLM in other ways.  

In total, I personally would lean towards accepting this paper, rather than rejecting it.   Augmenting LLMs with tool use is currently an area of intensive research, and this paper shows both the advantages, and disadvantages, of one form of integration.  The paper is well-written, the experiments are well-done, and there are no technical problems, so I think that it deserves to be published.
Decision: Accept (poster)