Skip to content

A Fusion Network of Sequence-to-Sequence Model and Tree-based Decoder for Math Word Problems

Notifications You must be signed in to change notification settings

nicholas9698/mwp-bert2bert-tree

Repository files navigation

BERT2BERT-Tree

This is the official repo for the paper "A Fusion Network of Sequence-to-Sequence Model and Tree-based Decoder for Math Word Problems".

Train and Test

The checkpoints of MWP-BERT we used can be obtained from https://drive.google.com/drive/folders/1staS6zCiAarNNMz9GhckNGkc_OD2HL1O?usp=drive_link

Liang, Zhengwen et al., MWP-BERT: Numeracy-Augmented Pre-training for Math Word Problem Solving, NAACL 2022

Math23K

Run the following to train the model and reproduce the results of Train-Test:

python -u run_bert2bert_tree_attributes.py

Run the following to train the model and reproduce the results of 5-Fold Cross-Validation:

python -u cross_valid_bert2bert_tree.py

Ape-clean

Run the following to train the model and reproduce the results of Train-Test:

python -u run_wape.py

Main Results

We reproduce the main results of BERT2BERT-Tree in the following tables:

Dataset Euqation accuracy Value accuracy
Math23K (train/test) 73.2 85.9
Math23K (5-fold cross-validation) 72.7 84.7
Math23K (train with Ape-clean) 77.7 91.5
Ape-clean (train/test) 68.0 81.8

Dataset

The data used by the bert2bert model is uploaded to data/math23k/.

Wang, Yan, et al., Deep Neural Solver for Math Word Problems (Math23K first introduced), EMNLP 2017

The Math23K and Ape-clean data for bert2bert-tree is in data/.

Moreover, the elements of Ape-clean are sampled from Ape-210K as listed in (data/ape_simple_id.txt) and (data/ape_simple_test_id.txt)

Zhao, Wei, et al., Ape210K: A Large-Scale and Template-Rich Dataset of Math Word Problems, arXiv:2009.11506

Entity Attributes Building

Build the entity attributes for your data:

The process relies on Stanford CoreNLP, follow this guide to install the PyPI package and download the Chinese model package.

  1. Follow the instruction Recut the word in attributes_building.ipynb to prepare the data of entity attributes generating.

  2. Execute the Extract entity attributes of numbers in attributes_building.ipynb to generate the corresponding number entity attributes.

Citation

If you find this work useful, please cite our paper:

@article{}

About

A Fusion Network of Sequence-to-Sequence Model and Tree-based Decoder for Math Word Problems

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published