Generating mathematical equations from natural language requires an accurate understanding of the relations among math expressions. Existing approaches can be broadly categorized into token-level and expression-level generation. The former treats equations as a mathematical language, sequentially generating math tokens. Expression-level methods generate each expression one by one. However, each expression represents a solving step, and there naturally exist parallel or dependent relations between these steps, which are ignored by current sequential methods. Therefore, we integrate tree structure into the expression-level generation and advocate an expression tree decoding strategy. To generate a tree with expression as its node, we employ a layer-wise parallel decoding strategy: we decode multiple independent expressions (leaf nodes) in parallel at each layer and repeat parallel decoding layer by layer to sequentially generate these parent node expressions that depend on others. Besides, a bipartite matching algorithm is adopted to align multiple predictions with annotations for each layer. Experiments show our method outperforms other baselines, especially for these equations with complex structures.
翻译:从自然语言生成数学方程需要准确理解数学表达式之间的关系。现有方法大致可分为词元级生成和表达式级生成两类。前者将方程视为数学语言,按顺序生成数学词元;后者则逐个生成每个表达式。然而,每个表达式代表一个求解步骤,这些步骤间自然存在并行或依赖关系,而当前顺序方法忽略了这一点。因此,我们将树结构融入表达式级生成,并提出一种表达式树解码策略。为生成以表达式为节点的树,我们采用分层并行解码策略:在每一层并行解码多个独立表达式(叶节点),并逐层重复并行解码,以顺序生成那些依赖其他表达式的父节点表达式。此外,我们采用二分图匹配算法来对齐每一层的多个预测与标注。实验结果表明,我们的方法优于其他基线方法,尤其适用于结构复杂的方程。