Teaching Neural Module Networks to Do Arithmetic
Jiayi Chen , Xiao-Yu Guo , Yuan-Fang Li , and Gholamreza Haffari
Faculty of Information Technology, Monash University, Melbourne, Australia
jche0069@student.monash.edu
{xiaoyu.guo,yuanfang.li,gholamreza.haffari}@monash.edu
Abstract
Answering complex questions that require
multi-step multi-type reasoning over raw text
is challenging, especially when conducting nu-
merical reasoning. Neural Module Networks
(NMNs), follow the programmer-interpreter
framework and design trainable modules to
learn different reasoning skills. However,
NMNs only have limited reasoning abilities,
and lack numerical reasoning capability. We
upgrade NMNs by: (a) bridging the gap
between its interpreter and the complex
questions; (b) introducing addition and
subtraction modules that perform numerical
reasoning over numbers. On a subset of
DROP, experimental results show that our
proposed methods enhance NMNs’ numerical
reasoning skills by 17.7% improvement of F1
score and significantly outperform previous
state-of-the-art models.
1 Introduction
Complex Question Answering (CQA) over text is
a challenging task in Natural Language Understand-
ing (NLU). Based on the programmer-interpreter
paradigm, Neural Module Networks (NMNs)
(Gupta et al.,2020) learn to first parse complex
questions as executable programs composed of
various predefined trainable modules, and then
execute such programs (implemented by modules)
over the given paragraph to predict answers of
all kinds. NMNs achieve competitive reasoning
performance on a subset of DROP (Dua et al.,
2019), and possess remarkable interpretability that
is also important for CQA.
However, NMNs’ numerical reasoning capability
is insufficient: it is incapable of handling arithmetic
operations such as addition and subtraction between
numbers, which make up nearly 40% questions of
the DROP dataset. Moreover, a gap exists between
the interpreter and the complex question since
there is no interaction between them. Motivated by
these, we propose two methods to improve NMNs’
numerical reasoning skills.
First, we incorporate the original question in the
interpreter, aiming to
directly provide question in-
formation in the “execution” process
, especially
number-related questions. The intuition behind is
that, in the original NMNs, questions participate
in the process only through the programmer. This
can cause a distance between queries and returns.
For example, in Figure 1, the first row shows that
the original NMNs found the wrong event (i.e.,
‘besieged Sinj’) solely based on the paragraph
information. In contrast, our model NMNs
±
can
easily target the correct event (i.e., ‘Sinj finally
fell’) with the help of question information.
Second, we introduce new modules to
support
addition and subtraction of up to three num-
bers
. Endowing NMNs with the ability to support
arithmetic can greatly boost its overall performance
on DROP and beyond. For instance, in Figure
1, the second row shows that the original NMNs
improperly adopt the
find-num
module for the
addition question because the module set does not
cover such an arithmetic ability. To facilitate the
learning of the
add/sub
modules, we extract QA
pairs related to addition and subtraction from the
original DROP dataset to construct a new dataset
for training and evaluation.
Experimental results show that our methods
significantly enhance NMNs’ numerical reasoning
capability. On a subset of DROP, our methods
improve F1 score by 17.7% absolute points, and
on ADD-SUB questions by 65.7% absolute points.
Compared to NumNet (Ran et al.,2019), which is
specifically designed for numerical reasoning, our
method outperforms it by 2.9% absolute F1 points.
2 Background and Related Work
Semantic Parsing
is a widely-adopted approach in
the compositional question answering (CQA) task,
which involves a number of reasoning steps. In this
arXiv:2210.02703v1 [cs.CL] 6 Oct 2022