# Enhancing the Transformer with Explicit Relational Encoding for Math Problem Solving

Source: [Enhancing the Transformer with Explicit Relational Encoding for Math Problem Solving](<https://www.sota2.com/research/paper/68fa68ac1e209131cea1da90>)

Collection index: [llms.txt](<https://www.sota2.com/research/llms.txt>)

Data updated: 2026-01-04T03:11:27.513Z

Authors: Imanol Schlag, Paul Smolensky, Roland Fernandez, Nebojsa Jojic, J\\"urgen Schmidhuber, Jianfeng Gao

Published: 2019-10-15T09:19:55.000Z

## Abstract

We incorporate Tensor-Product Representations within the Transformer in order to better support the explicit representation of relation structure. Our Tensor-Product Transformer (TP-Transformer) sets a new state of the art on the recently-introduced Mathematics Dataset containing 56 categories of free-form math word-problems. The essential component of the model is a novel attention mechanism, called TP-Attention, which explicitly encodes the relations between each Transformer cell and the other cells from which values have been retrieved by attention. TP-Attention goes beyond linear combination of retrieved values, strengthening representation-building and resolving ambiguities introduced by multiple layers of standard attention. The TP-Transformer's attention maps give better insights into how it is capable of solving the Mathematics Dataset's challenging problems. Pretrained models and code will be made available after publication.

## Recorded benchmark results

A research result applies to its stated dataset, split, metric and evaluation configuration. Compare like-for-like settings, preserve the metric's unit and direction, and distinguish paper-reported results from independent reproduction. The best result recorded here is not a claim of exhaustive, current global coverage.

- [Mathematical Reasoning on Mathematics Dataset (interpolation)](<https://www.sota2.com/research/sota/mathematical-reasoning-on-mathematics-dataset-interpolation.md>): Mathematical Reasoning; Mathematics Dataset (interpolation); Accuracy: 81.92.

- [Mathematical Reasoning on Mathematics Dataset Extrapolation](<https://www.sota2.com/research/sota/mathematical-reasoning-on-mathematics-dataset-extrapolation.md>): Mathematical Reasoning; Mathematics Dataset Extrapolation; Accuracy: 54.71.

- [Mathematical Reasoning on Mathematics Dataset (train)](<https://www.sota2.com/research/sota/mathematical-reasoning-on-mathematics-dataset-train.md>): Mathematical Reasoning; Mathematics Dataset (train); Accuracy: 89.01.

## Original sources and implementation

[Original paper](<https://arxiv.org/abs/1910.06611>)

[PDF](<https://arxiv.org/pdf/1910.06611.pdf>)

[Implementation](<https://www.sota2.com/github.com/ischlag/TP-Transformer>)
