Solving General Arithmetic Word Problems - …web.engr.illinois.edu/~sroy9/pdfs/arithmetic.pdf ·...

49
Solving General Arithmetic Word Problems Subhro Roy and Dan Roth Subhro Roy and Dan Roth Solving General Arithmetic Word Problems 1 / 19

Transcript of Solving General Arithmetic Word Problems - …web.engr.illinois.edu/~sroy9/pdfs/arithmetic.pdf ·...

Page 1: Solving General Arithmetic Word Problems - …web.engr.illinois.edu/~sroy9/pdfs/arithmetic.pdf · Gwen was organizing her book case making sure each of the shelves had exactly 9 books

Solving General Arithmetic Word Problems

Subhro Roy and Dan Roth

Subhro Roy and Dan Roth Solving General Arithmetic Word Problems 1 / 19

Page 2: Solving General Arithmetic Word Problems - …web.engr.illinois.edu/~sroy9/pdfs/arithmetic.pdf · Gwen was organizing her book case making sure each of the shelves had exactly 9 books

Part I

Problem and Main Idea

Subhro Roy and Dan Roth Solving General Arithmetic Word Problems 2 / 19

Page 3: Solving General Arithmetic Word Problems - …web.engr.illinois.edu/~sroy9/pdfs/arithmetic.pdf · Gwen was organizing her book case making sure each of the shelves had exactly 9 books

2: The Problem

Arithmetic Word Problem

Gwen was organizing her book case making sure each of the shelves hadexactly 9 books on it. She has 2 types of books - mystery books andpicture books. If she had 3 shelves of mystery books and 5 shelves ofpicture books, how many books did she have in total?

Subhro Roy and Dan Roth Solving General Arithmetic Word Problems 3 / 19

Page 4: Solving General Arithmetic Word Problems - …web.engr.illinois.edu/~sroy9/pdfs/arithmetic.pdf · Gwen was organizing her book case making sure each of the shelves had exactly 9 books

2: The Problem

Arithmetic Word Problem

Gwen was organizing her book case making sure each of the shelves hadexactly 9 books on it. She has 2 types of books - mystery books andpicture books. If she had 3 shelves of mystery books and 5 shelves ofpicture books, how many books did she have in total?

2 is irrelevant

Subhro Roy and Dan Roth Solving General Arithmetic Word Problems 3 / 19

Page 5: Solving General Arithmetic Word Problems - …web.engr.illinois.edu/~sroy9/pdfs/arithmetic.pdf · Gwen was organizing her book case making sure each of the shelves had exactly 9 books

2: The Problem

Arithmetic Word Problem

Gwen was organizing her book case making sure each of the shelves hadexactly 9 books on it. She has 2 types of books - mystery books andpicture books. If she had 3 shelves of mystery books and 5 shelves ofpicture books, how many books did she have in total?

3 and 5 need to be added and then multiplied by 9

Subhro Roy and Dan Roth Solving General Arithmetic Word Problems 3 / 19

Page 6: Solving General Arithmetic Word Problems - …web.engr.illinois.edu/~sroy9/pdfs/arithmetic.pdf · Gwen was organizing her book case making sure each of the shelves had exactly 9 books

2: The Problem

Arithmetic Word Problem

Gwen was organizing her book case making sure each of the shelves hadexactly 9 books on it. She has 2 types of books - mystery books andpicture books. If she had 3 shelves of mystery books and 5 shelves ofpicture books, how many books did she have in total?

Solution Expression

(3 + 5)× 9 = 72

Subhro Roy and Dan Roth Solving General Arithmetic Word Problems 3 / 19

Page 7: Solving General Arithmetic Word Problems - …web.engr.illinois.edu/~sroy9/pdfs/arithmetic.pdf · Gwen was organizing her book case making sure each of the shelves had exactly 9 books

3: Previous Work

Restrictions on the number and type of operations used

Hosseini 2014 : Only addition, subtractionRoy 2015 (My previous work) : Exactly one operation

Relying on templates seen in training data

Kushman 2014 : Template based approach

Subhro Roy and Dan Roth Solving General Arithmetic Word Problems 4 / 19

Page 8: Solving General Arithmetic Word Problems - …web.engr.illinois.edu/~sroy9/pdfs/arithmetic.pdf · Gwen was organizing her book case making sure each of the shelves had exactly 9 books

3: Previous Work

Restrictions on the number and type of operations used

Hosseini 2014 : Only addition, subtractionRoy 2015 (My previous work) : Exactly one operation

Relying on templates seen in training data

Kushman 2014 : Template based approach

Subhro Roy and Dan Roth Solving General Arithmetic Word Problems 4 / 19

Page 9: Solving General Arithmetic Word Problems - …web.engr.illinois.edu/~sroy9/pdfs/arithmetic.pdf · Gwen was organizing her book case making sure each of the shelves had exactly 9 books

4: Contribution

Contribution

An arithmetic word problem solver with

No restriction on the number and type of operations needed.

No assumption on expression template.

Subhro Roy and Dan Roth Solving General Arithmetic Word Problems 5 / 19

Page 10: Solving General Arithmetic Word Problems - …web.engr.illinois.edu/~sroy9/pdfs/arithmetic.pdf · Gwen was organizing her book case making sure each of the shelves had exactly 9 books

4: Contribution

Contribution

An arithmetic word problem solver with

No restriction on the number and type of operations needed.

No assumption on expression template.

Before this, you could not solve ...Gwen was organizing her book case making sure each of the shelves had exactly 9 books on it.

She has 2 types of books - mystery books and picture books. If she had 3 shelves of mystery

books and 5 shelves of picture books, how many books did she have in total?

Subhro Roy and Dan Roth Solving General Arithmetic Word Problems 5 / 19

Page 11: Solving General Arithmetic Word Problems - …web.engr.illinois.edu/~sroy9/pdfs/arithmetic.pdf · Gwen was organizing her book case making sure each of the shelves had exactly 9 books

4: Contribution

Contribution

An arithmetic word problem solver with

No restriction on the number and type of operations needed.

No assumption on expression template.

Before this, you could not solve ...Gwen was organizing her book case making sure each of the shelves had exactly 9 books on it.

She has 2 types of books - mystery books and picture books. If she had 3 shelves of mystery

books and 5 shelves of picture books, how many books did she have in total?

Now you can !!

Subhro Roy and Dan Roth Solving General Arithmetic Word Problems 5 / 19

Page 12: Solving General Arithmetic Word Problems - …web.engr.illinois.edu/~sroy9/pdfs/arithmetic.pdf · Gwen was organizing her book case making sure each of the shelves had exactly 9 books

5: Main Idea

Main Idea

The prediction problem can be decomposed into simple decision problems.

Subhro Roy and Dan Roth Solving General Arithmetic Word Problems 6 / 19

Page 13: Solving General Arithmetic Word Problems - …web.engr.illinois.edu/~sroy9/pdfs/arithmetic.pdf · Gwen was organizing her book case making sure each of the shelves had exactly 9 books

5: Main Idea

Main Idea

The prediction problem can be decomposed into simple decision problems.

Decomposition based on lowest common ancestor (LCA) of monotonicexpression trees.

Subhro Roy and Dan Roth Solving General Arithmetic Word Problems 6 / 19

Page 14: Solving General Arithmetic Word Problems - …web.engr.illinois.edu/~sroy9/pdfs/arithmetic.pdf · Gwen was organizing her book case making sure each of the shelves had exactly 9 books

6: Expression Trees

Expression Trees for (3× 5) + 7− 8− 9

3

+

5

9

7

8

×

+

Subhro Roy and Dan Roth Solving General Arithmetic Word Problems 7 / 19

Page 15: Solving General Arithmetic Word Problems - …web.engr.illinois.edu/~sroy9/pdfs/arithmetic.pdf · Gwen was organizing her book case making sure each of the shelves had exactly 9 books

6: Expression Trees

Expression Trees for (3× 5) + 7− 8− 9

3

+

5

9

7

8

×

+

3

+

5

97 8×

+

Subhro Roy and Dan Roth Solving General Arithmetic Word Problems 7 / 19

Page 16: Solving General Arithmetic Word Problems - …web.engr.illinois.edu/~sroy9/pdfs/arithmetic.pdf · Gwen was organizing her book case making sure each of the shelves had exactly 9 books

6: Expression Trees

Expression Trees for (3× 5) + 7− 8− 9

3

+

5

9

7

8

×

+

3

+

5

97 8×

+

Subhro Roy and Dan Roth Solving General Arithmetic Word Problems 7 / 19

Page 17: Solving General Arithmetic Word Problems - …web.engr.illinois.edu/~sroy9/pdfs/arithmetic.pdf · Gwen was organizing her book case making sure each of the shelves had exactly 9 books

6: Expression Trees

Expression Trees for (3× 5) + 7− 8− 9

3

+

5

9

7

8

×

+

LCA

3

+

5

97 8×

+

LCA (3, 8, first tree) = +

Subhro Roy and Dan Roth Solving General Arithmetic Word Problems 7 / 19

Page 18: Solving General Arithmetic Word Problems - …web.engr.illinois.edu/~sroy9/pdfs/arithmetic.pdf · Gwen was organizing her book case making sure each of the shelves had exactly 9 books

6: Expression Trees

Expression Trees for (3× 5) + 7− 8− 9

3

+

5

9

7

8

×

+

LCA

3

+

5

97 8×

+

LCA (3, 8, first tree) = +

Subhro Roy and Dan Roth Solving General Arithmetic Word Problems 7 / 19

Page 19: Solving General Arithmetic Word Problems - …web.engr.illinois.edu/~sroy9/pdfs/arithmetic.pdf · Gwen was organizing her book case making sure each of the shelves had exactly 9 books

6: Expression Trees

Expression Trees for (3× 5) + 7− 8− 9

3

+

5

9

7

8

×

+

LCA

3

+

5

97 8×

+

LCA

LCA (3, 8, first tree) = + LCA (3, 8, second tree) = −

Subhro Roy and Dan Roth Solving General Arithmetic Word Problems 7 / 19

Page 20: Solving General Arithmetic Word Problems - …web.engr.illinois.edu/~sroy9/pdfs/arithmetic.pdf · Gwen was organizing her book case making sure each of the shelves had exactly 9 books

6: Expression Trees

Expression Trees for (3× 5) + 7− 8− 9

3

+

5

9

7

8

×

+

LCA

3

+

5

97 8×

+

LCA

LCA (3, 8, first tree) = + LCA (3, 8, second tree) = −

LCAs dependent on the tree

Subhro Roy and Dan Roth Solving General Arithmetic Word Problems 7 / 19

Page 21: Solving General Arithmetic Word Problems - …web.engr.illinois.edu/~sroy9/pdfs/arithmetic.pdf · Gwen was organizing her book case making sure each of the shelves had exactly 9 books

7: Monotonic Expression Trees

Definition

An expression tree is called monotonic if

If + node is connected to − node, then − node is the parent.

If × node is connected to ÷ node, then ÷ node is the parent.

Subhro Roy and Dan Roth Solving General Arithmetic Word Problems 8 / 19

Page 22: Solving General Arithmetic Word Problems - …web.engr.illinois.edu/~sroy9/pdfs/arithmetic.pdf · Gwen was organizing her book case making sure each of the shelves had exactly 9 books

7: Monotonic Expression Trees

Definition

An expression tree is called monotonic if

If + node is connected to − node, then − node is the parent.

If × node is connected to ÷ node, then ÷ node is the parent.

Expression Trees for (3× 5) + 7− 8− 9

3

+

5

9

7

8

×

+

3

+

5

97 8×

+

Subhro Roy and Dan Roth Solving General Arithmetic Word Problems 8 / 19

Page 23: Solving General Arithmetic Word Problems - …web.engr.illinois.edu/~sroy9/pdfs/arithmetic.pdf · Gwen was organizing her book case making sure each of the shelves had exactly 9 books

7: Monotonic Expression Trees

Definition

An expression tree is called monotonic if

If + node is connected to − node, then − node is the parent.

If × node is connected to ÷ node, then ÷ node is the parent.

Expression Trees for (3× 5) + 7− 8− 9

3

+

5

9

7

8

×

+

Non-monotonic

3

+

5

97 8×

+

Subhro Roy and Dan Roth Solving General Arithmetic Word Problems 8 / 19

Page 24: Solving General Arithmetic Word Problems - …web.engr.illinois.edu/~sroy9/pdfs/arithmetic.pdf · Gwen was organizing her book case making sure each of the shelves had exactly 9 books

7: Monotonic Expression Trees

Definition

An expression tree is called monotonic if

If + node is connected to − node, then − node is the parent.

If × node is connected to ÷ node, then ÷ node is the parent.

Expression Trees for (3× 5) + 7− 8− 9

3

+

5

9

7

8

×

+

Non-monotonic

3

+

5

97 8×

+

Monotonic

Subhro Roy and Dan Roth Solving General Arithmetic Word Problems 8 / 19

Page 25: Solving General Arithmetic Word Problems - …web.engr.illinois.edu/~sroy9/pdfs/arithmetic.pdf · Gwen was organizing her book case making sure each of the shelves had exactly 9 books

8: Theorem Time

Generality

Every expression can be expressed by a monotonic expression tree.

Uniqueness of monotonic tree LCA

For any expression E , LCA(qi , qj , T ) will be same for any monotonicexpression tree T for expression E .

⇒ Unique value of Monotonic tree LCA for any pair of quantities.

Subhro Roy and Dan Roth Solving General Arithmetic Word Problems 9 / 19

Page 26: Solving General Arithmetic Word Problems - …web.engr.illinois.edu/~sroy9/pdfs/arithmetic.pdf · Gwen was organizing her book case making sure each of the shelves had exactly 9 books

8: Theorem Time

Generality

Every expression can be expressed by a monotonic expression tree.

Uniqueness of monotonic tree LCA

For any expression E , LCA(qi , qj , T ) will be same for any monotonicexpression tree T for expression E .

⇒ Unique value of Monotonic tree LCA for any pair of quantities.

Subhro Roy and Dan Roth Solving General Arithmetic Word Problems 9 / 19

Page 27: Solving General Arithmetic Word Problems - …web.engr.illinois.edu/~sroy9/pdfs/arithmetic.pdf · Gwen was organizing her book case making sure each of the shelves had exactly 9 books

8: Theorem Time

Generality

Every expression can be expressed by a monotonic expression tree.

Uniqueness of monotonic tree LCA

For any expression E , LCA(qi , qj , T ) will be same for any monotonicexpression tree T for expression E .

⇒ Unique value of Monotonic tree LCA for any pair of quantities.

Subhro Roy and Dan Roth Solving General Arithmetic Word Problems 9 / 19

Page 28: Solving General Arithmetic Word Problems - …web.engr.illinois.edu/~sroy9/pdfs/arithmetic.pdf · Gwen was organizing her book case making sure each of the shelves had exactly 9 books

Part II

System Description

Subhro Roy and Dan Roth Solving General Arithmetic Word Problems 10 / 19

Page 29: Solving General Arithmetic Word Problems - …web.engr.illinois.edu/~sroy9/pdfs/arithmetic.pdf · Gwen was organizing her book case making sure each of the shelves had exactly 9 books

9: System Pipeline

Problem Text

Subhro Roy and Dan Roth Solving General Arithmetic Word Problems 11 / 19

Page 30: Solving General Arithmetic Word Problems - …web.engr.illinois.edu/~sroy9/pdfs/arithmetic.pdf · Gwen was organizing her book case making sure each of the shelves had exactly 9 books

9: System Pipeline

Problem Text

LCA ClassifierLCA Classifier

For each pair of quantitiesqi , qj , predicts LCA ofmonotonic expression tree ofsolution.

Multiclass classifier.

Subhro Roy and Dan Roth Solving General Arithmetic Word Problems 11 / 19

Page 31: Solving General Arithmetic Word Problems - …web.engr.illinois.edu/~sroy9/pdfs/arithmetic.pdf · Gwen was organizing her book case making sure each of the shelves had exactly 9 books

9: System Pipeline

Problem Text

LCA Classifier

IrrelevanceClassifier

Irrelevance Classifier

For each quantity q, predictswhether it is irrelevant for thesolution.

Binary classifier.

Subhro Roy and Dan Roth Solving General Arithmetic Word Problems 11 / 19

Page 32: Solving General Arithmetic Word Problems - …web.engr.illinois.edu/~sroy9/pdfs/arithmetic.pdf · Gwen was organizing her book case making sure each of the shelves had exactly 9 books

9: System Pipeline

Problem Text

LCA Classifier

IrrelevanceClassifier

Features : Quantity Schema

For each quantity, we extract

Associated Verb

Subject of Associated Verb

Unit

Related Noun Phrases

Rate

Subhro Roy and Dan Roth Solving General Arithmetic Word Problems 11 / 19

Page 33: Solving General Arithmetic Word Problems - …web.engr.illinois.edu/~sroy9/pdfs/arithmetic.pdf · Gwen was organizing her book case making sure each of the shelves had exactly 9 books

9: System Pipeline

Problem Text

LCA Classifier

IrrelevanceClassifier

Features : Quantity Schema

For each quantity, we extract

Associated Verb

Subject of Associated Verb

Unit

Related Noun Phrases

Rate

All our features are from quantityschemas.

Subhro Roy and Dan Roth Solving General Arithmetic Word Problems 11 / 19

Page 34: Solving General Arithmetic Word Problems - …web.engr.illinois.edu/~sroy9/pdfs/arithmetic.pdf · Gwen was organizing her book case making sure each of the shelves had exactly 9 books

9: System Pipeline

Problem Text

LCA Classifier

IrrelevanceClassifier

Constraints

Constraints

Question about physicalobjects⇒ Positive answer

Question asks “How many. . .”⇒ Integer answer

Subhro Roy and Dan Roth Solving General Arithmetic Word Problems 11 / 19

Page 35: Solving General Arithmetic Word Problems - …web.engr.illinois.edu/~sroy9/pdfs/arithmetic.pdf · Gwen was organizing her book case making sure each of the shelves had exactly 9 books

9: System Pipeline

Problem Text

LCA Classifier

IrrelevanceClassifier

Constraints

Inference

Subhro Roy and Dan Roth Solving General Arithmetic Word Problems 11 / 19

Page 36: Solving General Arithmetic Word Problems - …web.engr.illinois.edu/~sroy9/pdfs/arithmetic.pdf · Gwen was organizing her book case making sure each of the shelves had exactly 9 books

10: Inference

Score of Trees

Score(E) = Irrelevance score +LCA score

Subhro Roy and Dan Roth Solving General Arithmetic Word Problems 12 / 19

Page 37: Solving General Arithmetic Word Problems - …web.engr.illinois.edu/~sroy9/pdfs/arithmetic.pdf · Gwen was organizing her book case making sure each of the shelves had exactly 9 books

10: Inference

Score of Trees

Score(E) = Irrelevance score +LCA score

= λ∑

q not used in E

Irr(q) +∑

qi ,qj used in E

LCA(qi , qj )

Subhro Roy and Dan Roth Solving General Arithmetic Word Problems 12 / 19

Page 38: Solving General Arithmetic Word Problems - …web.engr.illinois.edu/~sroy9/pdfs/arithmetic.pdf · Gwen was organizing her book case making sure each of the shelves had exactly 9 books

10: Inference

Score of Trees

Score(E) = Irrelevance score +LCA score

= λ∑

q not used in E

Irr(q) +∑

qi ,qj used in E

LCA(qi , qj )

Inference Problem

arg maxall trees E respecting contraints

Score(E)

Subhro Roy and Dan Roth Solving General Arithmetic Word Problems 12 / 19

Page 39: Solving General Arithmetic Word Problems - …web.engr.illinois.edu/~sroy9/pdfs/arithmetic.pdf · Gwen was organizing her book case making sure each of the shelves had exactly 9 books

Part III

Evaluation

Subhro Roy and Dan Roth Solving General Arithmetic Word Problems 13 / 19

Page 40: Solving General Arithmetic Word Problems - …web.engr.illinois.edu/~sroy9/pdfs/arithmetic.pdf · Gwen was organizing her book case making sure each of the shelves had exactly 9 books

11: Datasets

AI2 Dataset : Addition, subtraction problems

IL Dataset : Exactly one operation problems

Commoncore Dataset : Multi-step problems New !!

Subhro Roy and Dan Roth Solving General Arithmetic Word Problems 14 / 19

Page 41: Solving General Arithmetic Word Problems - …web.engr.illinois.edu/~sroy9/pdfs/arithmetic.pdf · Gwen was organizing her book case making sure each of the shelves had exactly 9 books

11: Datasets

AI2 Dataset : Addition, subtraction problems

IL Dataset : Exactly one operation problems

Commoncore Dataset : Multi-step problems New !!

Subhro Roy and Dan Roth Solving General Arithmetic Word Problems 14 / 19

Page 42: Solving General Arithmetic Word Problems - …web.engr.illinois.edu/~sroy9/pdfs/arithmetic.pdf · Gwen was organizing her book case making sure each of the shelves had exactly 9 books

12: Commoncore Dataset

600 word problems equally divided in the following types :

Addition followed by Subtraction

Subtraction followed by Addition

Addition and Multiplication

Addition and Division

Subtraction and Multiplication

Subtraction and Division

Subhro Roy and Dan Roth Solving General Arithmetic Word Problems 15 / 19

Page 43: Solving General Arithmetic Word Problems - …web.engr.illinois.edu/~sroy9/pdfs/arithmetic.pdf · Gwen was organizing her book case making sure each of the shelves had exactly 9 books

12: Commoncore Dataset

600 word problems equally divided in the following types :

Addition followed by Subtraction

Subtraction followed by Addition

Addition and Multiplication

Addition and Division

Subtraction and Multiplication

Subtraction and Division

Challenging Evaluation Setting

Test on one type by training on all other types

Subhro Roy and Dan Roth Solving General Arithmetic Word Problems 15 / 19

Page 44: Solving General Arithmetic Word Problems - …web.engr.illinois.edu/~sroy9/pdfs/arithmetic.pdf · Gwen was organizing her book case making sure each of the shelves had exactly 9 books

13: Effect of Constraints

Subhro Roy and Dan Roth Solving General Arithmetic Word Problems 16 / 19

Page 45: Solving General Arithmetic Word Problems - …web.engr.illinois.edu/~sroy9/pdfs/arithmetic.pdf · Gwen was organizing her book case making sure each of the shelves had exactly 9 books

14: Comparison with Other Systems

AI2 IL CC

Hosseini 2014 77.7 - -

Roy 2015 - 52.7 -

Kushman 2014 64.0 73.7 2.3

Table: Accuracy in correctly solving arithmetic problems

Subhro Roy and Dan Roth Solving General Arithmetic Word Problems 17 / 19

Page 46: Solving General Arithmetic Word Problems - …web.engr.illinois.edu/~sroy9/pdfs/arithmetic.pdf · Gwen was organizing her book case making sure each of the shelves had exactly 9 books

14: Comparison with Other Systems

AI2 IL CC

Hosseini 2014 77.7 - -

Roy 2015 - 52.7 -

Kushman 2014 64.0 73.7 2.3

Our System 78.0 73.9 45.2

Table: Accuracy in correctly solving arithmetic problems

Subhro Roy and Dan Roth Solving General Arithmetic Word Problems 17 / 19

Page 47: Solving General Arithmetic Word Problems - …web.engr.illinois.edu/~sroy9/pdfs/arithmetic.pdf · Gwen was organizing her book case making sure each of the shelves had exactly 9 books

15: Conclusion

We developed a solver for a general class of arithmetic word problems.

Theory of Monotonic LCA can be applied to more general settings, inparticular, to algebra word problems.

Subhro Roy and Dan Roth Solving General Arithmetic Word Problems 18 / 19

Page 48: Solving General Arithmetic Word Problems - …web.engr.illinois.edu/~sroy9/pdfs/arithmetic.pdf · Gwen was organizing her book case making sure each of the shelves had exactly 9 books

15: Conclusion

We developed a solver for a general class of arithmetic word problems.

Theory of Monotonic LCA can be applied to more general settings, inparticular, to algebra word problems.

Subhro Roy and Dan Roth Solving General Arithmetic Word Problems 18 / 19

Page 49: Solving General Arithmetic Word Problems - …web.engr.illinois.edu/~sroy9/pdfs/arithmetic.pdf · Gwen was organizing her book case making sure each of the shelves had exactly 9 books

16:

Thank You

Datasets available athttp://cogcomp.cs.illinois.edu/page/resource view/98.

Subhro Roy and Dan Roth Solving General Arithmetic Word Problems 19 / 19