Papers › Enhancing the Transformer with Explicit Relational Encoding for Math Problem Solving

Enhancing the Transformer with Explicit Relational Encoding for Math Problem Solving

15 Oct 2019arXiv:1910.06611archive 2025-07-28

Imanol Schlag, Paul Smolensky, Roland Fernandez, Nebojsa Jojic, Jürgen Schmidhuber, Jianfeng Gao

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.

PaperPDFConference PDFCodeCode Syntology ran

In Syntology Open this paper in Syntology's Atlas, the map of the papers in Syntology's graph and their citations.

For agents, Syntology's MCP tool lists every function and class Syntology harvested from this paper and whether it ran (how to connect): get_harvested_code_for_paper(arxiv_id="1910.06611")

Code

Syntology Ran 1 of 11 code samples harvested from 1 repository linked to this paper; 10 have no recorded run. Of those that ran: 1 ran · honoured contract.

By repository: official repository: 11 samples from 1 repository, 1 ran. The run record, sample by sample. “Ran” means executed on a synthesized input, not that the code is correct or reproduces the paper.

ischlag/TP-Transformer officialmentioned in papermentioned on GitHubpytorchMIT report
jlrussin/interpret-math-transformer mentioned on GitHubpytorchGPL-3.0 report

Repository list and official/mentioned flags are the archive's, frozen 2025-07-28. Reachability, where shown, is from one Syntology probe window (2026-09-16 to 2026-09-18); repositories not probed show nothing. GitHub stars are not tracked.

Code Syntology ran Syntology

11 samples harvested; 1 ran; 1 honoured the contract we drafted; 10 have no recorded run. Read from Syntology's graph 2026-09-24; that is when this build read the record, not when the samples ran.

1ran · honoured contract
10unverified

Licence: 0 of the 11 samples are pointer only, meaning Syntology does not serve that copy's text. This page shows no code text for any sample; each one links to its file in the repository.

Harvested from ischlag/TP-Transformer. “Ran” means the sample executed on a synthesized input. It does not mean the output is correct, and nothing here reproduces the paper's results. “Honoured” and “violated” refer to a contract Syntology drafted from the code itself; “our draft was wrong” and “fixture could not drive it” are failures of Syntology's instrument, not of the code.

Each sample ends with its code_sha256, Syntology's identity for that exact code. An agent fetches the stored sample with Syntology's MCP tool get_code(code_sha256="…") (how to connect); click an identity to copy that call.

Repository labels, per sample. official repository: The archive marks this repository official for the paper. named in the paper: The archive records that the paper mentions this repository; it is not marked official. community (archive-listed): In the archive's code links for this paper, not marked official and not recorded as mentioned in the paper. found in paper text by Syntology: Syntology found this repository in the paper's own text; whether it is the authors' implementation is not asserted. community: Not in the archive's code links for this paper; a community repository Syntology harvested. Samples from a repository marked official are listed first. Licence labels name the repository's licence as recorded at harvest. “Pointer only” means Syntology does not serve that copy's text, for one of four reasons: no licence file was found; the licence was not identified; the licence is recorded as permissive but that copy's record is not marked cleared; or the licence is outside the permissive list Syntology serves text under (MIT, Apache-2.0, BSD and similar). Some licences outside that list permit redistribution, such as WTFPL, and GPL-3.0 under its conditions; they are simply not on the list. Hover a licence label for the reason. File links open the file on GitHub at the default branch, which may have changed since the harvest.

count_parameters ischlag/TP-Transformer/utils/lib.py official repository ran · honoured contract MIT (permissive) · f6b944f50d3f15ae · report
build_transformer ischlag/TP-Transformer/models/transformer.py official repository unverified MIT (permissive) · ce9444c4e1d8e4a6 · report
get_read_streams ischlag/TP-Transformer/merge_all_dm_math.py official repository unverified MIT (permissive) · a20c7972eaaca117 · report
get_write_stream ischlag/TP-Transformer/merge_all_dm_math.py official repository unverified MIT (permissive) · 3ad1dc245ff6f211 · report
is_nan ischlag/TP-Transformer/models/tp-transformer.py official repository unverified MIT (permissive) · d570016512f5c4f5 · report
is_nan_string ischlag/TP-Transformer/models/tp-transformer.py official repository unverified MIT (permissive) · 0823d2f457cf6ad5 · report
make_jit_pairs_and_indexes ischlag/TP-Transformer/process_dm_math.py official repository unverified MIT (permissive) · 944be7e833810869 · report
pick_new_seed ischlag/TP-Transformer/utils/lib.py official repository unverified MIT (permissive) · 40146ea057e31174 · report
read_files ischlag/TP-Transformer/process_dm_math.py official repository unverified MIT (permissive) · 552c0d8df4dd0117 · report
split_into_x_y ischlag/TP-Transformer/process_dm_math.py official repository unverified MIT (permissive) · 5186e518cde7c126 · report
tensor_find ischlag/TP-Transformer/utils/lib.py official repository unverified MIT (permissive) · 73a42887d25c7f1c · report

Tasks

MathQuestion Answering

Results from the paper archive 2025-07-28

TaskDatasetModelMetricValueRank at snapshotLeaderboardReport
Question Answering Mathematics Dataset TP-Transformer Accuracy 0.8192 #1 of 3 Archive leaderboard report

Ranks are positions in the archive's leaderboards as they stood at the 2025-07-28 snapshot. Results published since then are not among these rows, so a rank here is not a current standing.

Methods

Absolute Position EncodingsAdamAttentionBPEDense ConnectionsDropoutLabel SmoothingLayer NormalizationLinear LayerMulti-Head AttentionPosition-Wise Feed-Forward LayerReLUResidual ConnectionSoftmaxTransformer

Report a problem or propose a change · a person checks every report against the paper or source before anything changes; decisions are listed on /corrections