Program Induction by Rationale Generation: Learning to Solve and Explain Algebraic Word Problems
Paper · 2017 · Wang Ling, Dani Yogatama, Chris Dyer et al.
Summary
A correct multiple-choice answer tells you where a solution ended. It gives you very little evidence about how to get there. This paper asks whether a written solution can help a system learn the arithmetic behind an algebra word problem. The authors call that solution a rationale. It can introduce a quantity in words, show an intermediate calculation, and explain how the result answers the question. The authors build AQuA to study this task, starting with 34,202 seed problems of the kind found in GMAT and GRE practice materials and collecting 70,318 additional questions through crowdsourcing. After filtering for close replicas of held-out problems, they report 100,949 training problems, with 250 problems each for development and testing.
The system reads the question and all its answer options and generates a program. Each instruction specifies an operation, its arguments, and whether the result should go into the written solution or into memory for later use. Arguments can come from a vocabulary, the input, or the results of earlier instructions. The interpreter supplies 22 operations, including arithmetic, conversions between numbers and text, and a check that turns a uniquely matching value into an answer letter. This lets the same program write an introductory phrase, calculate a new quantity, and reuse that quantity later in the explanation.
AQuA supplies written rationales and correct answer labels. The programs remain hidden during training. The authors recover candidate programs by asking what instructions could produce the next observed token. Their search allows at most one intervening arithmetic result in memory for that token, with string and number conversions treated separately. A calculation can therefore extend across many lines of a rationale as long as the written solution exposes enough intermediate results. At test time the system has to write the rationale for itself. It executes candidate instructions during decoding, drops those that fail, and restricts the answer after the rationale to the available option letters.
On the AQuA test split, the program-driven system has the lowest rationale perplexity, the highest BLEU score, and the highest answer accuracy among the systems compared. Copying from the question greatly improves the text predicted by a conventional sequence generator, but all the text-only baselines select answers at rates close to the 20% chance level. The executable approach does better on answer selection as well as on text prediction. Its successful solutions are concentrated among problems that take one or two operations. The results show how intermediate written steps can make learning arithmetic programs feasible in this setting, while leaving the reliable generation of longer solutions unresolved.
Deep dive: Program Induction by Rationale Generation: Learning to Solve and Explain Algebraic Word Problems
How written explanations help a program learn to solve algebra word problems, carry out the arithmetic, and select a multiple-choice answer. · about 38 minutes to read
The problem and its context
From a situation to a calculation
An algebra word problem gives the solver a situation described in ordinary language and asks for a quantity. Some of the work happens before any arithmetic. The solver has to decide what the quantities refer to, which of them enter the calculation, and what relationship connects them. Some of the work happens after the arithmetic, when the solver has to decide what a computed value means in the terms of the question. A number can be a count, a rate, a probability, or a ratio. Its role determines whether it answers the question and how the answer should be expressed.
The paper uses word problems as a manageable setting in which to study that movement between language and calculation. The target is a written derivation together with an answer. Someone reading the derivation should be able to follow what the quantities represent and why each displayed calculation appears. An equation solver could return a requested ratio directly once the equation had been prepared for it. A written solution might also have to show how the denominator was cleared, how like terms were gathered, and how the ratio was isolated. Producing those lines is part of the task given to the system.
The authors give examples with different shapes. An algebra example asks for a ratio and calls for rearranging an equation with two unknowns. A probability example can be handled by counting combinations and using the counts in a subsequent calculation. Another example proceeds by testing the supplied choices. The presence of that last kind of problem matters because it changes what counts as input. In a multiple-choice task, the options can supply candidates to investigate as well as a destination for a result already computed from the question.
A rationale is a useful target because it can represent these different solution styles in a common form. It can bind a symbol to a quantity in a short phrase, write an equation, or record that a candidate meets a requirement. The order of those statements also matters. A statement that introduces a count can make the count intelligible when it reappears inside a later expression. The paper asks whether that same progression can constrain the search for a program during learning.
What earlier approaches asked the learner to recover
In the paper's account of prior work on algebraic word problems, one approach learns to fill in equation templates and then passes the resulting equations to a solver. The template gives the learner a structure to complete. The solver handles the mathematical work once the relevant values have been placed into it. Another line of work learns sequences of operations that lead to a final answer. The paper also mentions work on mapping mathematical language into formal expressions. These approaches establish ways to connect a question to a calculation, with the requirements for a worked explanation depending on how the task is defined.
Learning a program from a question and its answer is difficult because the final value admits many possible derivations. An operation can take a quantity from the question, a constant, or a value calculated earlier. Its result can become an operand for further operations. A correct final answer gives the learner a criterion for recognizing a successful program after execution. Until it finds a candidate worth executing, however, it has little guidance about which of the possible operands and operations to try.
The authors connect this problem to semantic parsing, where a system maps language to a formal representation. Work on weakly supervised question answering offers a parallel. A question and its answer can be known while the query that would retrieve that answer remains hidden. Execution tests a candidate query once it has been proposed. Finding promising queries is itself a learning and search problem. A rationale adds observations along an arithmetic derivation that play a role similar to additional known results along the way.
Earlier work on sequence generation contributes the encoder and decoder framework. An encoder turns the input into internal representations, and a decoder uses those representations and its own history to predict what comes next. The authors draw on Sequence to Sequence Learning with Neural Networks and on the alignment approach of Neural Machine Translation by Jointly Learning to Align and Translate. The paper also credits earlier work on program generation and semantic parsing for ideas such as storing values outside the recurrent state, applying operators to them, and copying stored results into an output.
Where the explanation enters the decision
The question of interpretability enters through the order of computation. The paper discusses earlier work that produces a textual justification after a classification decision. It also cites Rationalizing Neural Predictions, which learns to select a relevant part of a document alongside a classification decision. For arithmetic problems, the authors place the written solution and the answer inside the execution of a common program. That makes it possible for a number computed along the way to appear both in the explanation and in the operation that selects the answer.
During training, the explanation has a different role. A human has already written it, so its tokens can serve as intermediate targets. During testing, the explanation is something the system has to produce. Thus the same object gives the search extra constraints in training and gives the reader a worked solution at test time. The design depends on the idea that the useful computations are frequently close to the places where their results appear in the text. A rationale that names the important intermediate values gives the learner more chances to link a short executable fragment to an observed result.
The method, step by step
What the system reads and writes
The input consists of the problem followed by its options. Special separators distinguish the options in the input sequence. The output contains the rationale, a marker for its end, a designated answer letter, and a marker that closes the sequence. The answer letter inside the rationale, if the rationale happens to include one, is part of the explanation text. The letter after the rationale boundary is the selected answer used for evaluation.
This distinction accommodates different writing styles. A rationale can end by stating a numerical result or by identifying the matching choice in a sentence. Both styles fit the same task because the formal answer occupies a fixed place. Putting the options into the input also gives the program access to the quantities or strings they contain. A program may use those values in computations, or it may compute a result first and then look for it among the choices.
An encoder reads the input sequence. A recurrent decoder proposes instructions using the input and the previous instructions. Each instruction is carried out as it is generated, so its result can change the state available for the next instruction. If a result belongs in the written explanation, it is appended there. If it is needed only for further calculation, it goes into memory.
From an algebra question to a worked answer
The steps in order.
How execution produces words and numbers
The identity operation, Id, returns whatever argument it receives. Paired with a vocabulary argument and an output destination, it can emit an ordinary word. Paired with an argument copied from the question, it can repeat a word or a numerical string. A single instruction format can therefore handle routine writing as well as arithmetic. The difference lies in the operation selected, where its arguments came from, and what happens to its result.
The probability example in the paper makes the distinction concrete. The number of cards in the deck, 52, first exists as a string in the input. A conversion instruction reads it and stores the corresponding floating-point value. A second conversion can take an operand from text that the system has already written. The combination operation Choose can then read the numeric operands from memory and store the number of possible selections. It is the interpreter that evaluates the combination. The system learns to ask for that evaluation with the operands in the appropriate order.
The intermediate value can be reused without going through the wording of the explanation again. A floating-point value in memory is ready for another operation. A visible value in the rationale can also become an operand, after conversion if it was written as a string. These paths account for a common feature of worked solutions. They can state a computed number for the reader, then use that number later, even while other sentences and calculations occur in between.
The paper's algebra example illustrates a complementary difficulty. Its starting equation is the following.
(27x + 17y) / (x + y) = 23
Here x and y stand for the two unknown quantities. The coefficients 27 and 17 multiply the corresponding unknowns, and 23 is the stated value of the quotient. The plus sign adds terms, the slash divides the grouped numerator by the grouped denominator, and the equals sign states the relationship the quantities must satisfy. In this example, the letters denote algebraic unknowns. The sequence notation below uses bold versions of the same letters for the input and output.
The paper uses the following displayed step to show what the rationale has to express after removing the denominator.
27x + 17y = 23x + 23y
The original unknowns and coefficients retain their meanings. On the right, 23x and 23y are the products obtained when 23 multiplies the terms in the denominator. The equality records the transformed relation.
A later displayed step gathers the terms as follows.
4x = 6y
Here 4 and 6 are the coefficients after terms involving the same unknown have been brought together. The juxtaposition of a coefficient with x or y denotes multiplication. The equals sign links the resulting expressions.
The target ratio in the example is then expressed as follows.
x/y = 3/2
The ratio on the left has x as its numerator and y as its denominator. The right-hand fraction gives the value of that ratio. The example illustrates the requirements on a rationale. It asks the system to express intermediate identities that a solver returning only the ratio could leave implicit.
What the interpreter knows in advance
The authors specify 22 operations. The group of 13 general operations consists of identity, the basic arithmetic operations, exponentiation, logarithm, square root, the trigonometric functions named in the paper, factorial, and combinations. The interpreter also supplies 2 conversions between radians and degrees and 6 conversions between textual and floating-point forms. These include reading and printing ordinary numbers, handling fractions, and dealing with thousands grouping. Such conversions matter because a quantity can be numerically useful in one form and recognizable to a reader or an answer matcher in another.
The remaining operation, Check, searches the options for a value given as text. It succeeds when exactly one option contains the matching value and returns the corresponding letter from A through E. A missing or ambiguous match prevents the operation from being applied. For the card problem, the paper shows that the computed probability can select the option using this mechanism.
Check("1/221") → C
Here Check is the pre-defined matching operation, "1/221" is the string representation of the probability, and C is the label of the uniquely matching option in that problem. The arrow indicates the value returned to the program. The quotes mark the argument as a string. The operation checks the relationship between that string and the available options. The mathematical case for the probability comes from the earlier steps that produced it.
The interpreter thus supplies a clear division of responsibility. Arithmetic and conversions follow fixed rules. The learned part chooses the instruction, the arguments, and the destination of the result. Exact execution of an operation means that it follows the interpreter's semantics for the operands supplied. The operation can still be inappropriate for the question if the learned part chose the wrong operands, treated the wrong quantity as a rate, or applied a conversion in an unsuitable place.
How the instruction probabilities are organized
The paper starts from a conventional sequence generator. Let bold 𝐱 be the input sequence and bold 𝐲 the target output sequence. A decoder can score the output by predicting each successive token from the input and the output prefix. In the paper's notation, the log probability is the sum of the individual log probabilities.
log p(𝐲 | 𝐱) = Σᵢ log p(yᵢ | 𝐲<ᵢ, 𝐱)
Here p denotes a probability and log its logarithm. The vertical bar means conditioning on the quantities to its right. The sum Σᵢ runs over token positions in the output. The symbol yᵢ is the token at position i, and 𝐲<ᵢ is the ordered prefix before that position. The equation scores a complete output by accumulating the scores of its next-token decisions.
A vocabulary softmax is the ordinary way to give those decisions a probability distribution.
p(yᵢ | 𝐲<ᵢ, 𝐱) = softmax over 𝒴 of scores from 𝐡ᵢ, evaluated at yᵢ
The set 𝒴 is the vocabulary and 𝐡ᵢ is the decoder's hidden state at position i. A softmax turns competing scores into probabilities across the set being considered. Evaluating it at yᵢ takes the probability assigned to that token. The other symbols retain their meanings from the sequence probability.
The paper describes the recurrent update for the ordinary decoder as follows.
𝐡ᵢ = g(yᵢ₋₁, 𝐡ᵢ₋₁)
The function g updates the hidden state. Its arguments are the preceding token yᵢ₋₁ and the preceding hidden state 𝐡ᵢ₋₁. The authors use a long short-term memory network, or LSTM, to implement recurrence. The encoder also uses an LSTM over the input, producing a state at each input position. Its task state initializes the decoder. In the executable system, the recurrent history proceeds in instruction time, so the number of instruction steps can exceed the number of output tokens.
Write 𝐳 for the ordered program and zᵢ for its instruction at position i. The paper represents an instruction as a tuple.
zᵢ = (oᵢ, rᵢ, 𝐚ᵢ, vᵢ)
The symbol oᵢ is the operation, rᵢ is the destination decision, 𝐚ᵢ is the ordered sequence of arguments, and vᵢ is the value returned by execution. The parentheses group the fields that describe a single instruction. The destination can be the visible output 𝐲 or the memory buffer 𝐦. At execution time, those buffers contain what the program has produced so far.
The chosen operation determines how many arguments are needed.
𝐚ᵢ = (aᵢ,₁, …, aᵢ,argc(oᵢ))
Here aᵢ,ⱼ is the argument in slot j of instruction i. The function argc returns the number of slots required by oᵢ. The ellipsis stands for all the intervening slots in order. For example, addition takes 2 arguments and logarithm takes 1 in the paper's operation set. Argument order matters for operations such as division, where exchanging the values generally changes the computation.
The instruction probability separates the operation choice, the destination, and the arguments. A final indicator enforces the value returned by the interpreter.
p(oᵢ, 𝐚ᵢ, rᵢ, vᵢ | 𝐳<ᵢ, 𝐱, 𝐲, 𝐦)
= p(oᵢ | 𝐳<ᵢ, 𝐱)
× p(rᵢ | 𝐳<ᵢ, 𝐱, oᵢ)
× ∏ⱼ₌₁…argc(oᵢ) p(aᵢ,ⱼ | 𝐳<ᵢ, 𝐱, oᵢ, 𝐦, 𝐲)
× [vᵢ = apply(oᵢ, 𝐚ᵢ)]
The prefix 𝐳<ᵢ contains all instructions before position i. The first factor scores oᵢ from this prefix and the input. The second scores the destination rᵢ given the operation as well. The product ∏ multiplies the probabilities of the arguments, with j ranging from 1 through argc(oᵢ). The buffers 𝐦 and 𝐲 supply previously produced values. The multiplication sign combines the factors. The square brackets denote an indicator which is 1 for a true equality and 0 otherwise. The function apply evaluates the specified operation with the ordered arguments. It gives the final factor its deterministic character.
In the implemented decoder, the operation probabilities come from a softmax over the available operations.
p(oᵢ | 𝐳<ᵢ, 𝐱) = softmax over 𝒪 of scores from 𝐡ᵢ, evaluated at oᵢ
The set 𝒪 contains the interpreter's operations. The state 𝐡ᵢ now represents the context for instruction i, including the program history. The softmax distributes probability over operations, and evaluation at oᵢ selects the score for that operation. The input 𝐱 and earlier instructions 𝐳<ᵢ are the conditioning information in the paper's expression.
For the destination, the decoder combines the instruction context with an embedding, or learned vector representation, of the chosen operation. This yields a state used in a binary decision.
p(rᵢ = OUTPUT | 𝐳<ᵢ, 𝐱, oᵢ) = σ(𝐫ᵢ · 𝐰ᵣ + bᵣ)
Here OUTPUT means append the result to the visible output. The bold 𝐫ᵢ is the hidden state for predicting the destination and the ordinary rᵢ is the decision itself. The vector 𝐰ᵣ contains learned weights, · denotes an inner product, and bᵣ is a learned offset. The logistic sigmoid σ converts the resulting score to a probability. The complementary destination appends the return value to memory.
How arguments are generated and copied
The argument mechanism can supply a vocabulary entry, point to an input position, or point to an earlier instruction. The choice of route is itself hidden during learning. The authors base the design on Latent Predictor Networks for Code Generation, and use the idea of Pointer Networks to score positions. A pointer can recover an unusual value from its occurrence in the current problem even when the value is rare in the training data.
The decoder prepares a hidden state for each argument slot. It initializes this argument process from the destination state and the chosen destination, then updates it with the preceding argument as it advances through the slots. The paper's compact instruction factorization shows the argument terms as a product. The slot-by-slot procedure explains how the decoder uses argument history within that product.
For a vocabulary argument, the probability comes from the slot state.
p(aᵢ,ⱼ | qᵢ,ⱼ = SOFTMAX) = softmax over 𝒴 of scores from 𝐪ᵢ,ⱼ, evaluated at aᵢ,ⱼ
The variable qᵢ,ⱼ identifies the route for slot j in instruction i. The label SOFTMAX selects vocabulary generation, and 𝐪ᵢ,ⱼ is the hidden state for that slot. The set 𝒴 is the vocabulary and aᵢ,ⱼ is the argument being scored. A conventional word can enter an instruction by this route and appear in the rationale after an identity operation.
For an input copy, the decoder scores positions using their encoder states. The following writes the pointer choice using k as the candidate position.
p(aᵢ,ⱼ = xₖ | qᵢ,ⱼ = COPY_INPUT) = softmax over input positions of f(𝐮ₖ, 𝐪ᵢ,ⱼ), evaluated at k
The label COPY_INPUT selects the input pointer. The index k is a position in the question-and-options sequence, xₖ is its token, and 𝐮ₖ is its encoder state. The function f scores compatibility between that encoder state and the current argument state 𝐪ᵢ,ⱼ. The softmax normalizes the scores over input positions. The expression describes the probability for copying from the particular position k.
The remaining route retrieves a value produced by an earlier instruction. Its pointer can therefore reach either a result appended to the explanation or a value held in memory.
p(aᵢ,ⱼ = vₖ | qᵢ,ⱼ = COPY_OUTPUT) = softmax over earlier instruction positions of f(𝐡ₖ, 𝐪ᵢ,ⱼ), evaluated at k
Here COPY_OUTPUT is the route that points into the program history, including results that were stored in memory. The index k denotes an instruction position before i, 𝐡ₖ is the decoder state at that position, and vₖ is the return value retrieved if the pointer selects it. The compatibility score uses the earlier instruction state in place of the input encoder state. The rest of the notation has the same role as in the input pointer.
The affinity calculation joins the candidate representation with the argument-slot representation, projects them into a shared vector, applies the hyperbolic tangent, and projects the result down to a scalar score. Thus different occurrences of the same text can receive different pointer scores because their internal representations reflect different contexts. This matters when identical numbers refer to different quantities in a problem.
The paper represents arguments and return values with lookup embeddings and indicators for string and floating-point types. A floating-point value also contributes its numeric value as a feature. After the last argument has been supplied, execution returns a typed value. The decoder uses the value's representation, the final argument state, and the existing instruction state to build the state for the next instruction. Later decisions can consequently respond to what the program actually computed.
How a written rationale guides the search
The training data never specifies 𝐳. It provides an input 𝐱 and an observed output 𝐲, including the answer label. In principle, the probability of the observed output includes the probability of every program that executes to exactly that output. The paper writes this as a marginal over programs.
p(𝐲 | 𝐱) = Σ[𝐳 ∈ 𝒵] p(𝐲 | 𝐳) p(𝐳 | 𝐱) = Σ[𝐳 ∈ 𝒵(𝐲)] p(𝐳 | 𝐱)
The set 𝒵 is the space of programs, and ∈ means membership in a set. The term p(𝐳 | 𝐱) is the decoder's probability for a program given the input. The term p(𝐲 | 𝐳) describes whether execution realizes the observed output. The restricted set 𝒵(𝐲) consists of programs that do realize it. The two sums express the same marginal because all programs outside that set have zero weight under the execution term.
That execution term is a Kronecker delta, an indicator of equality between two discrete objects.
p(𝐲 | 𝐳) = δₑ₍𝐳₎,𝐲
The notation e(𝐳) denotes the output of executing 𝐳 for the input under consideration. The symbol δ is 1 when this output is exactly 𝐲 and 0 otherwise. Exact equality is about the entire output sequence, including the form and order of the written tokens. A different valid derivation can therefore fall outside the set of programs that explain the particular reference rationale.
Summing over every compatible program is intractable, so training uses a sampled subset.
Σ[𝐳 ∈ 𝒵̂(𝐲)] p(𝐳 | 𝐱)
The hat in 𝒵̂(𝐲) marks the collection of compatible programs found by sampling. The summation adds their probabilities under the program decoder. Training maximizes this restricted quantity as an approximation to the full marginal. The candidates present in the subset determine which executable derivations contribute to the update.
Unconstrained sampling is unlikely to produce the reference rationale. The authors instead use its next token as a target, checking which local routes can get there. A step can write the token directly, as when a common word is selected from the vocabulary, or it can prepare a value needed to produce the token. The heuristic allows one level of arithmetic indirection between observed tokens, excluding conversions between strings and floating-point values from that bound. Given a derivation that exposes one intermediate quantity at a time, the next-token target keeps each search local even when the overall problem has a longer solution.
The paper describes the candidate search as a graph of values and instructions. A set called C tracks currently accessible nodes. The input supplies its initial values, and newly executed instructions make further values accessible. The procedure also tracks in a set B the nodes selected in preparing the next token whose results still have to participate in producing it. An admissible next node has arguments available in C, and it must leave a route to the target that incorporates the pending nodes. The first condition asks whether the instruction is executable now. The second asks whether its result can still contribute to the observed token.
The illustrated search first considers multiple ways of producing the string 63. It can choose a conversion that reads the corresponding input value, after which the surviving routes must make use of that conversion. When the target changes to 42, a route involving subtraction from 63 becomes relevant. The example also allows separately sourced values with identical numerical content. That preserves distinctions between quantities that happen to share a number and lets the program record which occurrence it used.
Graph construction can generate millions of nodes, according to the authors. They describe it as work that can be parallelized and carried out once for a training item, since the filtered graph can be saved. The experiment sets the graph expansion depth D to 5. This setting is reported for expanding the search graph. The local rule about indirection describes how much hidden arithmetic can be used in producing the next observed token, with conversions handled separately.
How training fits long programs into memory
An instruction sequence can grow longer than the visible rationale because it contains conversions and calculations that only write to memory. The authors report that rationales longer than 200 tokens are common enough to matter and that a program can readily exceed 400 instructions. Copying and attention make such sequences expensive to train on. A decoder that points to the input must score candidate input positions, and a decoder that points into its own history can face a growing set of candidate instructions. Retaining the intermediate computations for back-propagation can exhaust the available memory.
The authors use staged back-propagation. They build recurrent states for the entire instruction sequence, then handle the expensive attention and copying computations in slices. The slice length is K, measured in instruction positions. In their illustrative case, a sequence of length 300 and a slice length of 100 yield 3 training batches for successive parts of the program. Each batch places the expensive part of the computation on a limited span of instruction steps.
The full recurrent state sequence preserves context across slices. State propagation and attention have different roles in this arrangement. The recurrent chain carries information across the program. Attention is computed for the active slice and joined with the recurrent state in predicting instructions. The authors describe this arrangement as late fusion. The slice boundary limits which prediction computations are unrolled together while the decoder can still use representations connected to the wider input and program history.
How the system answers a new problem
A test question arrives with its options and without the reference rationale. The training graph's next observed token is therefore unavailable. The decoder searches for a high-scoring instruction sequence using its learned probabilities. The reported experiment keeps a beam of 200 candidates, so alternative partial programs can compete as decoding advances.
Every proposed instruction is executed to obtain the value needed for the next step. If execution fails, the hypothesis is dropped. The paper gives the logarithm of zero as an example of a failing instruction. This check removes a candidate on computational grounds while it is still a partial program. An executable program can remain in the beam even if its operands or goal are inappropriate for the question.
Once the end-of-rationale marker appears, a further restriction allows only instructions that emit an answer letter from A through E. The restriction gives a well-formed answer and makes the outcome directly scorable against AQuA's label. The Check operation offers one way to obtain the letter from a computed value. The decoding constraint itself concerns the form of the answer and permits the letter to be produced through other instructions.
Experiments and results
How AQuA was assembled and split
AQuA pairs each question and its choices with a written rationale and the correct option. The authors made the dataset available under the name AQuA. Their seed collection contains 34,202 problems, drawing on the kind of questions found in GMAT and GRE practice resources. The choice of source matters because worked solutions are already a familiar way to present such problems. The examples also cover different topics and levels of difficulty.
For the crowdsourced portion, each worker saw 5 seed questions and selected one as a starting point. The worker was asked to construct a similar problem with a changed answer and rationale. The authors manually inspected a subset of each worker's submissions. Some workers changed values and rewrote the corresponding calculations while keeping much of the original language. The authors describe these as replicas. Other submissions stayed within the same topic while departing more substantially from the seed problem.
The construction rules prohibited copying a new problem verbatim from the web. When several workers found the same online item, unusually close neighbors in the growing dataset could help identify the repeated submissions. The authors report 70,318 additional questions obtained through crowdsourcing. The protocol yielded both genuinely different problems and families of problems with very similar wording and solution structure, which made the placement of held-out examples important.
The authors reserved 500 problems for held-out use, with 250 in development and 250 in the test split. For each held-out question, they listed its closest candidates in the training collection using character-level Levenshtein distance. This distance measures similarity through the edits needed to turn one string into another. The authors manually removed replicas found this way. They report 100,949 training problems after the filtering. The procedure targets cases where a held-out problem could be solved by reusing an nearly identical training example with changed quantities.
In the paper's length analysis, most examples span 30 to 500 tokens when the question, options, and rationale are counted together. Some examples exceed 1000 tokens by that measure. The authors also describe statistics that separate numeric from other tokens. These distinctions matter to the experiment because many numbers are sparsely distributed across the vocabulary, while the length of the written solution and the need to store intermediate results both affect the cost of training and decoding.
What was compared
The starting baseline is an attention-based sequence-to-sequence generator. Attention supplies a way of focusing on different parts of the encoded input as the output is produced. This baseline emits tokens as text. One extension can copy an input token, which lets the decoder reuse a number or a word already written in the question or options. A further variant can copy from its own earlier output, which can help when the rationale refers again to a value it has already stated.
The authors' system can also obtain values by applying operations. Its ability to write a computed result depends on finding an executable instruction sequence, including any conversion needed to present the result as text. All the comparisons concern the task of producing a rationale and choosing an option. The program system adds a learned search over instructions, a fixed interpreter, and memory for their intermediate results.
The experiment uses a two-layer LSTM, with hidden size 200 and word embedding size 200. The vocabulary retains the 20,000 most frequent word types. The unknown token represents words outside that fixed vocabulary when the system has no other way to produce them. During training, the authors use the unknown token as a target only after the alternative generation routes have been exhausted. This allows copying or execution to preserve an observed value whenever the architecture can reach it.
The reported decoding beam of 200 is a search setting, distinct from the hidden size and embedding size. A larger state describes each decision using more internal features. A beam keeps competing partial outputs or programs available during inference. The graph expansion depth of 5 concerns training-time sampling. These settings operate at different points in the system.
What each score measures
The authors evaluate rationale prediction with average sentence-level perplexity. Perplexity expresses how surprising the reference text is under the system's predictions. Lower values mean that the system assigned more probability to the observed tokens. When a system cannot produce a reference token, the evaluation lets it predict the unknown token there. The authors note that this convention helps the less expressive baselines because it gives them credit through a substitute prediction.
For the executable system, the probability of the reference depends on the hidden instructions chosen to produce it. The authors use forced decoding for this evaluation. At each step they use the observed rationale to constrain the choices, in the spirit of the training search, and pick the highest-probability instructions under that procedure. This provides a score for reconstructing the reference under a compatible program. The procedure differs from ordinary decoding, where a system must decide for itself which rationale token to write next.
BLEU-4 compares the generated rationale with the written reference through matching short sequences of tokens. It rewards overlap in both wording and displayed mathematical content when they appear in the expected order. A correct solution can express the same calculation with different words or in a different arrangement, so overlap and mathematical correctness are separate properties. Conversely, a plausible closing phrase can resemble the reference while the reasoning that should precede it is missing.
Answer accuracy is the percentage of test questions for which the predicted label matches the designated option. The comparison has a 20% chance level. Accuracy is measured on the 250 questions in the test split. It scores the decision that follows the rationale boundary. A question contributes to the correct-answer percentage when that letter is correct, irrespective of how much of the written derivation is valid.
How rationale prediction and answer selection changed
The conventional sequence generator has the highest perplexity on the test rationales. The authors connect this to the many uncommon values that have to be written. A number anchored in the current question can have a clear role in its solution while being very infrequent as an isolated token in the whole training collection. The input-copy extension improves perplexity markedly because it can assign probability to the token through its position in the current question.
Copying from earlier output provides a further small improvement in perplexity compared with copying from the input alone. The card problem illustrates why. The value 1326 appears more than once in the explanation. Once it has been produced, the later occurrence can be handled by a pointer. This makes the repeat easier to predict, while the difficulty of generating the first occurrence is still present. The program-driven system has the lowest perplexity in the reported comparison, extending the available routes to values that can be computed from previous quantities.
The authors illustrate that extension with an inferred program for a held-out question and rationale. The depicted computation connects values from the input, memory, and output. It includes 0.025, 0.023, and 0.002 as values for which arithmetic supplies a route when direct copying cannot. The explanation of the figure also identifies the final answer E. The program was selected to reproduce a known rationale, so the figure shows that the approach can recover a compatible computation in this setting. The example is distinct from the evidence supplied by unconstrained generation on the test split.
On BLEU-4, the conventional system tends to produce short pieces of text resembling how rationales finish. The authors suggest that copying helps it introduce the actual quantities or variables of the problem, which produces a more substantial match to the reference. Adding output copying fails to produce a further BLEU improvement. The complete approach achieves the highest BLEU score of the compared systems. A calculation that introduces a new intermediate value gives the system a way to reproduce a part of the written solution that vocabulary prediction and copying alone may handle poorly.
For answer accuracy, the baseline scores cluster around the 20% chance level, including the variants with copying. The program-driven system achieves higher accuracy on the same split. The authors give a cake problem as an example of a successful free prediction. Each cake contributes 10 slices, and the total is 120 slices. Dividing the total by the per-cake count gives 12 cakes, which corresponds to option C. The generated rationale states that calculation and identifies the matching answer. The example joins the desired behaviors in a setting where the main computation takes a single operation.
The scope of the advantage
The results describe different aspects of the same task. Copying helps a system speak about the quantities in the question, and its perplexity gains show that these quantities become easier to predict in the reference explanation. The accuracy results show that the easier text prediction leaves a substantial gap between mentioning the quantities and correctly relating them. The full system improves both, which is consistent with the proposed role of execution.
The correct examples are mainly problems that require one or two operations. The authors use the cake example to show that a short, readable calculation can emerge during generation. Their harder dataset examples still pose the problem of sustaining a valid derivation as more dependent steps are required. An early error in the program can produce a perfectly executable value that becomes an unsuitable input to everything after it.
The measurements also answer different questions about the usefulness of the explanatory text. Perplexity asks how well the reference can be scored under the evaluation procedure. BLEU asks how much generated language and notation resemble the reference. Answer accuracy asks whether the final choice is correct. Agreement across the measures favors the complete system in this experiment, while the separate definitions matter for understanding what a successful example establishes.
What the ablations show
What changes when copying is added
The clearest controlled comparisons are the additions to the attention-based baseline. Input copying gives the generator another route to textual values that appear in a particular question. Its large effect on perplexity and the improvement in BLEU support the explanation that fixed-vocabulary prediction is poorly suited to a task full of question-specific quantities. A useful rationale should be able to repeat an unusual numeral just as readily as a familiar one when the numeral is already given in the problem.
The similarly weak answer accuracy of the baselines shows the limit of that addition. Input copying makes quantities available in their original form. The solver still needs a way to determine what those quantities mean, relate them mathematically, and produce a result. Better access to an operand can improve the written explanation even if the underlying choice of operation remains unreliable. This is why the change in text scores deserves a different interpretation from the change in answer accuracy.
The output-copy comparison isolates another useful distinction. Given an already produced token, copying can make later mentions easier. During free generation, however, the set of tokens available to the output pointer depends on what the generator has managed to write. With a vocabulary and input pointer as the original sources, adding access to earlier output extends reuse of those sources. Arithmetic adds a separate source, a value constructed by an operation. That helps explain why output copying gives a slight improvement in perplexity while adding little to the BLEU result.
These are comparisons between text generators and their extensions. The comparison between those generators and the full system changes several parts of the design together. It adds the instruction representation, the execution of operations, access to hidden intermediate values, and a training search guided by the reference rationale. The experiment establishes an advantage for the combined approach. It has limited leverage for estimating how much each of those additions contributes in isolation.
What the inferred program illustrates
The paper's program visualization is an analysis of one held-out question and its known rationale. It traces the dependencies of selected values and includes computed quantities missing from the directly copyable text at the point where they are needed. Copying and conversion edges are omitted in the drawing for readability, while visual groupings identify related representations of the same value. Read this way, the diagram shows how an explanation written as a linear sequence can arise from computations with dependencies that reach further back.
This is a useful check on the mechanism because a low perplexity score alone cannot reveal how a value was obtained. A program trace can distinguish a number emitted from the vocabulary, a number recovered from an existing position, and a number calculated from other values. The diagram provides an instance in which the added computation supplies the written result. Its scope is that instance and the reference-constrained setting used to produce the trace.
The authors also say that their search fails when it has to learn from the final answer without the rationale. That observation fits the search design. With the rationale, the sampler has a concrete next token on which to test proposals. With only the answer, it would frequently have to consider much longer chains between observed results. The paper gives this as a reason for using rationales to guide induction. It does not present a scored, matched comparison that estimates the size of the rationale's effect separately from other changes to the architecture and search.
What slicing changes in the illustrative training setup
The staged back-propagation example compares the expensive unrolling span in a full pass with the smaller span in each slice. It is a comparison of computation spans in the authors' illustration. The paper describes the advantage in terms of fitting the graph into memory and gives no timing or memory-reduction measurement for this example.
Instruction positions unrolled together in the staged training example
Staging reduces the span of expensive computations handled together while retaining recurrent states for the whole example.
The numbers
| System or setting | instruction positions per unroll |
|---|---|
| Full sequence unrolling | 300 |
| Staged back-propagation (this paper) | 100 |
The reduced span applies to the expensive prediction computations. The recurrent chain still covers the entire example. This matters when interpreting what the staging procedure changes. It adjusts how the training calculation is partitioned while the intended prediction still depends on context across the sequence. The illustration explains the memory-saving mechanism. The rationale scores and answer accuracy come from the end-to-end experimental comparison.
Limitations
Limits the authors identify
The authors identify complex rationale generation as unresolved. Each successive step creates more opportunities for selecting an inappropriate operation, a wrong operand, or a value from the wrong place in memory. Search during program induction and search during test-time decoding both face this difficulty, under different conditions. Training has reference tokens to guide the search. At test time, each partial program has to carry enough information and score well enough to remain among the candidates as the explanation grows.
The prevalence of short computations among the correct solutions gives that observation a concrete scope. The paper shows that the system can write an intelligible rationale and pick a correct answer on simple cases such as the cake problem. More elaborate examples demonstrate what the dataset asks for, including derivations with several dependencies and strategies involving option testing. Their presence in AQuA establishes the breadth of the task. Demonstrated success is narrower.
The authors also characterize heuristic program search as a necessity for their learner. Exact marginalization would require considering the full collection of compatible programs. The approximate objective can use only those programs that the search discovers. The restriction is especially consequential when an important intermediate step is absent from the rationale. The closest observed milestones may then be separated by more hidden computation than the heuristic is designed to explore.
Limits visible in the setup
Execution guarantees a relationship between operands and return values under the interpreter's rules. The relationship between those operands and the situation described in the problem depends on learned decisions. A program may subtract two perfectly valid numbers even when one refers to the wrong quantity. A legitimate mathematical operation can be applied to a value with an unsuitable unit or to a number drawn from a distractor option. Dropping hypotheses that throw an execution error addresses a narrower failure than detecting such mistakes.
The same distinction applies to the authors' argument about faithful explanations. An emitted arithmetic result has a trace in the executing program. That is a stronger connection than one available when prose is generated after a separate answer decision. Natural-language text in the rationale, however, can be produced by identity instructions with vocabulary or copied arguments. The interpreter supplies numeric operations and returns their results. It does not verify each prose assertion about what a quantity stands for or why an operation is mathematically appropriate.
The final label also needs separate interpretation. Check can tie it directly to a computed string through a unique option match. The decoding rule after the rationale enforces only that the result be an option letter. The described architecture leaves room for a correct letter alongside an unsound derivation, and for a sound intermediate calculation followed by the wrong choice. The three reported metrics do not provide a per-step audit that would distinguish these cases across the test set.
The reference rationale treats a particular presentation as the training target. Written solutions have latitude in how much arithmetic they spell out, where they introduce names for intermediate quantities, and which equivalent route they take. Multiple programs can reproduce the same rationale, and a valid program can also yield another sensible explanation of the same answer. The hidden-program objective handles some ambiguity by assigning credit to several compatible programs. Its selection criterion still centers on reproducing the observed sequence, so mathematically equivalent explanations can receive different treatment.
The fixed operation inventory creates a related boundary. The system can apply the supplied operations to available values and combine them. An algebra example involving rearranged equations illustrates the kind of exposition the dataset wants, while the method's inventory specifies numeric operations, conversions, copying, and option matching. The results therefore support a claim about executable arithmetic within this design. They leave open how well the system can perform the richer symbolic manipulations suggested by some problem statements.
Finally, the held-out evaluation is an exercise in multiple-choice problem solving on AQuA. The authors' filtering deals directly with close character-level replicas of held-out questions. A reader can still ask how the approach would fare on unfamiliar problem families, on problems without supplied options, or on examples whose rationales omit most of the intermediate arithmetic. Those questions require different comparisons. The paper's setup allows options to contribute to the solution, so transferring the result to open-ended algebra would change both the information available to the system and the way its answer is evaluated.
What came after
Formal operations and mathematical benchmarks
The citing work with the closest match in problem formulation is MathQA, which puts operation-based formalisms at the center of interpretable word-problem solving. The shared question is how to represent the route from a problem statement to a result in terms that expose the computation. AQuA supplies written rationales that guide the recovery of hidden operations. MathQA's stated focus on an operation-based formalism puts more emphasis on the representation of the computation itself. That connection matters when the object a researcher wants to examine is the order and composition of operations instead of the wording of the explanation.
DROP takes discrete reasoning into reading comprehension over paragraphs. In AQuA, the input is an explicitly posed mathematical problem and its options. DROP's benchmark framing asks what happens when the evidence for a discrete operation is embedded in a passage. The earlier paper's distinction between finding a quantity and computing with it carries over naturally. A system first has to identify what information in the text could serve as an operand, then determine how it bears on the question.
Measuring Mathematical Problem Solving With the MATH Dataset carries the evaluation question into another mathematical problem-solving benchmark. AQuA's experiment makes the answer and the accompanying rationale distinct targets, which is a useful distinction when reading later benchmark work. A rate of correct answers can track overall success on a defined collection of problems. Evidence about how those answers were reached depends on what the benchmark records and what the evaluation inspects.
e-SNLI brings natural-language explanations to natural-language inference. The outcome there is a language inference decision, instead of the result of an arithmetic program. The relevant connection is the decision to pair an outcome with a written explanation as an object of study. The arithmetic paper uses the content of those explanations to constrain executable steps. The inference task shows the broader reach of the idea that a task can ask for both a decision and an account of the evidence for it.
Generating, selecting, and evaluating intermediate reasoning
Chain-of-Thought Prompting studies prompting as a way to elicit intermediate reasoning. Its stated method shifts attention from using reference rationales to search for a latent program during training to eliciting intermediate reasoning in the generated response. The conceptual link is the value assigned to work before the final answer. In the earlier paper, that work gives the interpreter a sequence of instructions and gives the learner intermediate text targets. In chain-of-thought prompting, the named intervention is how the generation task is posed.
Self-Consistency treats consistency as a way to improve chain-of-thought reasoning. This takes up a selection problem that is also visible in latent-program induction. Several paths may be possible before an answer is committed to. AQuA's training procedure looks for paths compatible with the observed explanation and adds their probabilities. The later work places the emphasis on what agreement among reasoning paths can contribute. The comparison clarifies that proposing a path and deciding how much to trust its outcome are separate parts of solving a problem.
Least-to-most prompting centers the order in which intermediate work is tackled. This connects to the earlier paper's assumption that a difficult solution can become more tractable when approached through smaller, ordered steps. AQuA's reference rationale offers the arithmetic learner a sequence of milestones already expressed by a human. The later work puts ordering into the prompting method itself. In both cases, an intermediate result can narrow what has to be worked out next.
Training Verifiers to Solve Math Word Problems puts trained verification at the center of arithmetic problem solving. The link is particularly clear once execution and mathematical validity are distinguished. A fixed interpreter can decide whether an operation executes, and AQuA's Check can decide whether a value matches an option uniquely. Evaluating a candidate solution as a whole is a broader judgment. The later work's focus on verifiers makes that judgment an explicit component of the solving method.
Solving math word problems with process- and outcome-based feedback foregrounds where feedback is applied. The distinction helps situate the earlier use of rationales. The final answer supplies a target at the end of a derivation, while the rationale gives the training search observations at points along the way. Feedback on the process and feedback on the outcome can therefore constrain different parts of a solution, even when both are derived from the same word problem.
Faithful Chain-of-Thought Reasoning makes faithfulness itself the subject. The earlier paper offers a concrete case of what can be checked. A reader can follow an executed calculation from selected operands to a written value and, when option matching is used, from that value to an answer letter. The prose surrounding those calculations and the appropriateness of the chosen operands raise further questions. The connection across these works is the demand to identify which parts of a presented derivation played a role in arriving at the answer.
Cite
Cite as Wang Ling, Dani Yogatama, Chris Dyer and Phil Blunsom. 2017. Program Induction by Rationale Generation: Learning to Solve and Explain Algebraic Word Problems. Proceedings of the 55th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers).
@inproceedings{ling2017program,
title = {{Program Induction by Rationale Generation: Learning to Solve and Explain Algebraic Word Problems}},
author = {Wang Ling, Dani Yogatama, Chris Dyer and Phil Blunsom},
booktitle = {Proceedings of the 55th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers)},
year = {2017},
doi = {10.18653/v1/p17-1015},
eprint = {1705.04146},
archivePrefix = {arXiv},
url = {https://doi.org/10.18653/v1/p17-1015}
}This page in Markdown https://md.research.elamur.ai/free/en/papers/ling-2017-program-induction-rationale-generation-learning/
References
- Jacob Andreas, Andreas Vlachos, and Stephen Clark. 2013. Semantic parsing as machine translation. In Proc. of ACL. our card
- Dzmitry Bahdanau, Kyunghyun Cho, and Yoshua Bengio. 2014. Neural machine translation by jointly learning to align and translate. arXiv 1409.0473. our card
- Jonathan Berant, Andrew Chou, Roy Frostig, and Percy Liang. 2013. Semantic parsing on freebase from question-answer pairs. In Proc. of EMNLP. our card
- Alex Graves, Greg Wayne, Malcolm Reynolds, Tim Harley, Ivo Danihelka, Agnieszka Grabska-Barwińska, Sergio Gómez Colmenarejo, Edward Grefenstette, Tiago Ramalho, John Agapiou, Adrià Puigdomènech Badia, Karl Moritz Hermann, Yori Zwols, Georg Ostrovski, Adam Cain, Helen King, Christopher Summerfield, Phil Blunsom, Koray Kavukcuoglu, and Demis Hassabis. 2016. Hybrid computing using a neural network with dynamic external memory. Nature 538(7626):471–476. OpenAlex ↗ · Scholar ↗
- Brent Harrison, Upol Ehsan, and Mark O. Riedl. 2017. Rationalization: A neural machine translation approach to generating natural language explanations (http://arxiv.org/abs/1702.07826). CoRR abs/1702.07826. http://arxiv.org/abs/1702.07826 (http://arxiv.org/abs/1702.07826). OpenAlex ↗ · Scholar ↗
- Lisa Anne Hendricks, Zeynep Akata, Marcus Rohrbach, Jeff Donahue, Bernt Schiele, and Trevor Darrell. 2016. Generating visual explanations. In Proc. ECCV. OpenAlex ↗ · Scholar ↗
- Mohammad Javad Hosseini, Hannaneh Hajishirzi, Oren Etzioni, and Nate Kushman. 2014. Learning to solve arithmetic word problems with verb categorization. In Proc. of EMNLP. our card
- Bevan Keeley Jones, Mark Johnson, and Sharon Goldwater. 2012. Semantic parsing with bayesian tree transducers. In Proc. of ACL. our card
- Nal Kalchbrenner and Phil Blunsom. 2013. Recurrent continuous translation models. In Proc. of EMNLP. our card
- Nate Kushman, Yoav Artzi, Luke Zettlemoyer, and Regina Barzilay. 2014. Learning to automatically solve algebra word problems. In Proc. of ACL. OpenAlex ↗ · Scholar ↗
- Tao Lei, Regina Barzilay, and Tommi Jaakkola. 2016. Rationalizing neural predictions. In Proc. of EMNLP. OpenAlex ↗ · Scholar ↗
- Chen Liang, Jonathan Berant, Quoc Le, Kenneth D. Forbus, and Ni Lao. 2016. Neural symbolic machines: Learning semantic parsers on freebase with weak supervision. arXiv 1611.00020. our card
- Wang Ling, Edward Grefenstette, Karl Moritz Hermann, Tomás Kociský, Andrew Senior, Fumin Wang, and Phil Blunsom. 2016. Latent predictor networks for code generation. In Proc. of ACL. our card
- Stephen Merity, Caiming Xiong, James Bradbury, and Richard Socher. 2016. Pointer sentinel mixture models. arXiv 1609.07843. our card
- Arvind Neelakantan, Quoc V. Le, and Ilya Sutskever. 2016. Neural programmer: Inducing latent programs with gradient descent. In Proc. ICLR. OpenAlex ↗ · Scholar ↗
- Kishore Papineni, Salim Roukos, Todd Ward, and Wei-Jing Zhu. 2002. Bleu: A method for automatic evaluation of machine translation. In Proc. of ACL. our card
- Chris Quirk, Raymond Mooney, and Michel Galley. 2015. Language to code: Learning semantic parsers for if-this-then-that recipes. In Proc. of ACL. our card
- Scott E. Reed and Nando de Freitas. 2016. Neural programmer-interpreters. In Proc. of ICLR. OpenAlex ↗ · Scholar ↗
- Subhro Roy and Dan Roth. 2015. Solving general arithmetic word problems. In Proc. of EMNLP. our card
- Subhro Roy, Shyam Upadhyay, and Dan Roth. 2016. Equation parsing: Mapping sentences to grounded equations. In Proc. of EMNLP. OpenAlex ↗ · Scholar ↗
- Ilya Sutskever, Oriol Vinyals, and Quoc V. Le. 2014. Sequence to sequence learning with neural networks. arXiv 1409.3215. our card
- Oriol Vinyals, Meire Fortunato, and Navdeep Jaitly. 2015. Pointer networks. In Proc. of NIPS. OpenAlex ↗ · Scholar ↗