M I U L A B Semanticall lly-Aligned Equation Generation for Solv lving and Reasoning Math Word Problems N T U Ting-Rui Chiang and Yun-Nung (Vivian) Chen https://github.com/MiuLab/E2EMathSolver
Math Word Problem Each notebook takes $ 0.5 and each pen takes $ 1 . Tom has M I U L A B $ 10 . How many notebooks can he buy after buying 5 pens? Reasoning & Solving N T U x = 10 − 1 × 5 ÷ 0.5
Prior Work Non-neural approaches Deep learning • Template-based • Seq2Seq M I U L A B (Kushman et al., Upadhyay and Chang) (Wang et al., Ling et al.) x = (? + ?) × ? - ? Problem fill generate x = (1+ 2) × 3 - 4 x = (1+ 2) × 3 - 4 N T U Rely on hand-crafted features! Does not use the structure of math expression. Our model is end-to-end and structural !
Overview of f the Proposed Model x = 10 − 1 × 5 ÷0.5 Encoder M I U L A B stack stack stack stack action action action action N T U Decoder Each notebook takes $0.5 and each pen takes $1. Tom has $10. How many notebooks can he buy after buying 5 pens?
Look Again at the Problem Each notebook takes $ 0.5 and each pen takes $ 1 . Tom has M I U L A B $ 10 . How many notebooks can he buy after buying 5 pens? $ 0.5 $ 1 ? N T U $ 10
Semantic Meaning of f the Operands Each notebook takes $ 0.5 and each pen takes $ 1 . Tom has M I U L A B $ 10 . How many notebooks can he buy after buying 5 pens? The amount of Price of a notebook money Tom has N T U x = ( 10 − 1 × 5 ) ÷0.5 Number of pens bought Price of a pen
Id Idea: Bridging Symbolic and Semantic Worlds M I U L A B N T U Symbolic World Semantic World
Preprocess Each notebook takes $ 0.5 and each pen takes $ 1 . Tom has M I U L A B $ 10 . How many notebooks can he buy after buying 5 pens? Preprocess 0.5 N T U 1 10 5 Symbolic Part
Symbol Encoding Each notebook takes $ 0.5 and each pen takes $ 1 . Tom has M I U L A B $ 10 . How many notebooks can he buy after buying 5 pens? Encode Preprocess 0.5 N T U 1 10 5 Semantic Part Symbolic Part
In Inside Encoder M I U L A B N T U Each notebook takes $ and ... 0.5
Semantic Generation for Unknown x M I U L A B N T U ... Each notebook takes $ and 0.5 * This part is actually done when decoding, but is present at this place for illustration. Check our paper for more information.
Operands & Their Semantics Each notebook takes $ 0.5 and each pen takes $ 1 . Tom has M I U L A B $ 10 . How many notebooks can he buy after buying 5 pens? 0.5 N T U 1 10 5 Symbolic Part x Semantic Part
In Intuition of f Using Semantics Each notebook takes $ 0.5 and each pen takes $ 1 . Tom has M I U L A B $ 10 . How many notebooks can he buy after buying 5 pens? Number of pens bought. N T U x = ( 10 − 1 ? 5 ) Price of a pen.
Equation Generation in Postfix Each notebook takes $ 0.5 and each pen takes $ 1 . Tom has M I U L A B $ 10 . How many notebooks can he buy after buying 5 pens? N T U x 10 1 5 × − 0.5 ÷ =
Equation Generation by Stack Actions Stack is used • x = 10 − 1 × 5 ÷0.5 M I U L A B The decoder generates • stack actions. stack stack stack stack action action action action An equation is generated • with actions on stack. N T U Decoder
Action Selection in Each Step Encoder Decoder M I U L A B stack action { +, -, × , ÷ , =, Push } classifier N T U
Equation Generation by Stack Actions Target Equation: x = 10 − 1 × 5 ÷ 0.5 Generated Actions: M I U L A B Action: push 0.5 1 N T U 10 5 x
Equation Generation by Stack Actions Target Equation: x = 10 − 1 × 5 ÷ 0.5 Target Equation: x = 10 − 1 × 5 ÷ 0.5 Target Equation: x = 10 − 1 × 5 ÷ 0.5 Target Equation: x = 10 − 1 × 5 ÷ 0.5 Target Equation: x = 10 − 1 × 5 ÷ 0.5 Generated Actions: x 10 1 5 Generated Actions: x 10 1 Generated Actions: x 10 Generated Actions: x 10 Generated Actions: x M I U L A B Action: push 0.5 5 1 N T U 1 10 5 10 x x
Equation Generation by Stack Actions Target Equation: x = 10 − 1 × 5 ÷ 0.5 Target Equation: x = 10 − 1 × 5 ÷ 0.5 Target Equation: x = 10 − 1 × 5 ÷ 0.5 Target Equation: x = 10 − 1 × 5 ÷ 0.5 Target Equation: x = 10 − 1 × 5 ÷ 0.5 Generated Actions: x 10 1 5 Generated Actions: x 10 1 Generated Actions: x 10 Generated Actions: x 10 Generated Actions: x M I U L A B Action: × 0.5 5 1 N T U 1 × 5 1 10 5 10 x x
Equation Generation by Stack Actions Target Equation: x = 10 − 1 × 5 ÷ 0.5 Target Equation: x = 10 − 1 × 5 ÷ 0.5 Target Equation: x = 10 − 1 × 5 ÷ 0.5 Target Equation: x = 10 − 1 × 5 ÷ 0.5 Target Equation: x = 10 − 1 × 5 ÷ 0.5 Generated Actions: x 10 1 5 × 0.5 ÷ = Generated Actions: x 10 1 Generated Actions: x 10 Generated Actions: x 10 Generated Actions: x M I U L A B After many steps… 0.5 1 N T U 10 5 x=(10−1 × 5) ÷ 0.5 x
Training Process Target equation is given. • M I U L A B Trained as Seq2Seq. • … x 10 1 5 N T U Encoder Decoder Each notebook takes $0.5 and each pen takes $1. Tom has $10. How many … x 10 1 5 <bos> notebooks can he buy after buying 5 pens?
Experiments Dataset: Math23k • M I U L A B In Chinese • 23000 math word problems. • Operators: +, -, ×, ÷ • N T U
Results Retrieval Template Ensemble Generation Acc. 70 M I U L A B > 1% 65 ≈ 8% 60 N T U 55 50 45 Retrieval BLSTM Self-Attention Seq2Seq w/SNI Proposed Hybrid
Ablation Test Acc. 66 M I U L A B 65 64 ≈ 3% 63 62 61 ≈ 2.5% N T U 60 59 Char-Based Word-Based Word-Based Word-Based Word-Based Word-Based -Semantic -Gate -Gate -Gate -Attention -Attention -Stack
Self-Attention for Qualitative Analysis Encoder M I U L A B N T U Each notebook takes $ and ... 0.5
Self-Attention for Qualitative Analysis Encoder M I U L A B N T U Each notebook takes $ and ... 0.5
Attention for Operand Semantics The attention focuses on: M I U L A B • Informative verbs o “ gain ”, “ get ”, “ fill ”, etc. • Quantifier-related words o “ every ”, “ how many ”, etc. N T U
Conclusion Three main contributions M I U L A B Approach: equation generation with stack • Originality: automatic extraction of operand semantics • Performance: a SOTA end-to-end neural model on Math23k • N T U
M I U L A B Code Available @ https://github.com/MiuLab/E2EMathSolver N T U
Recommend
More recommend