Papers › Universal Transformers

Universal Transformers

10 Jul 2018ICLR 2019 5arXiv:1807.03819archive 2025-07-28

Mostafa Dehghani, Stephan Gouws, Oriol Vinyals, Jakob Uszkoreit, Łukasz Kaiser

Recurrent neural networks (RNNs) sequentially process data by updating their state with each new data point, and have long been the de facto choice for sequence modeling tasks. However, their inherently sequential computation makes them slow to train. Feed-forward and convolutional architectures have recently been shown to achieve superior results on some sequence modeling tasks such as machine translation, with the added advantage that they concurrently process all inputs in the sequence, leading to easy parallelization and faster training times. Despite these successes, however, popular feed-forward sequence models like the Transformer fail to generalize in many simple tasks that recurrent models handle with ease, e.g. copying strings or even simple logical inference when the string or formula lengths exceed those observed at training time. We propose the Universal Transformer (UT), a parallel-in-time self-attentive recurrent sequence model which can be cast as a generalization of the Transformer model and which addresses these issues. UTs combine the parallelizability and global receptive field of feed-forward sequence models like the Transformer with the recurrent inductive bias of RNNs. We also add a dynamic per-position halting mechanism and find that it improves accuracy on several tasks. In contrast to the standard Transformer, under certain assumptions, UTs can be shown to be Turing-complete. Our experiments show that UTs outperform standard Transformers on a wide range of algorithmic and language understanding tasks, including the challenging LAMBADA language modeling task where UTs achieve a new state of the art, and machine translation where UTs achieve a 0.9 BLEU improvement over Transformers on the WMT14 En-De dataset.

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="1807.03819")

Code

Syntology Ran 14 of 25 code samples harvested from 5 repositories linked to this paper; 11 have no recorded run. Of those that ran: 1 ran · honoured contract; 13 ran with no contract checked.

By repository: community (archive-listed): 25 samples from 5 repositories, 14 ran. The run record, sample by sample. “Ran” means executed on a synthesized input, not that the code is correct or reproduces the paper.

tensorflow/tensor2tensor officialmentioned in papermentioned on GitHubtf report
MostafaDehghani/bAbI-T2T mentioned on GitHubtfApache-2.0 report
cfiken/universal_transformer mentioned on GitHubtf report
kpot/keras-transformer mentioned on GitHubtf report
moon23k/Transformer_Archs mentioned on GitHubpytorch report
sidney1505/arc_maml_transformer mentioned on GitHubtf report
ypeleg/MinimalIsAllYouNeed mentioned on GitHub 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

25 samples harvested; 14 ran; 1 honoured the contract we drafted; 11 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
13ran
11unverified

Licence: 24 of the 25 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 5 repositories linked to this paper, official or community; each sample names its own and says which. “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.

ACT cfiken/universal_transformer/model/ut.py community (archive-listed) ran no licence file found · pointer only · df7ba9e22f4021de · report
EmbeddingSharedWeights cfiken/universal_transformer/model/ut.py community (archive-listed) ran no licence file found · pointer only · ab44c54bef771f0e · report
Embeddings moon23k/Transformer_Archs/model/recurrent.py community (archive-listed) ran · metamorphic tier: invariant no licence file found · pointer only · 50973ad904b644b9 · report
FeedForwardNetwork cfiken/universal_transformer/model/ut.py community (archive-listed) ran no licence file found · pointer only · 81f546780efe0c63 · report
LayerNormalization sidney1505/arc_maml_transformer/keras_transformer/transformer.py community (archive-listed) ran no licence file found · pointer only · 8187fac026534417 · report
LayerWrapper cfiken/universal_transformer/model/ut.py community (archive-listed) ran no licence file found · pointer only · 8f3fd62209af26f0 · report
MultiHeadSelfAttention sidney1505/arc_maml_transformer/keras_transformer/transformer.py community (archive-listed) ran no licence file found · pointer only · 99fc6b1e929c1a86 · report
MultiheadAttention cfiken/universal_transformer/model/ut.py community (archive-listed) ran no licence file found · pointer only · 97703c2875660e0b · report
PositionalEncoding moon23k/Transformer_Archs/model/recurrent.py community (archive-listed) ran no licence file found · pointer only · 55f808c7c4cab374 · report
SelfAttention cfiken/universal_transformer/model/ut.py community (archive-listed) ran fingerprinted no licence file found · pointer only · 72219f63ad9d256a · report
StandardDecoder moon23k/Transformer_Archs/model/recurrent.py community (archive-listed) ran · metamorphic tier: invariant no licence file found · pointer only · ac79741037ef4e2b · report
TransformerTransition sidney1505/arc_maml_transformer/keras_transformer/transformer.py community (archive-listed) ran no licence file found · pointer only · d297901c2cb19187 · report
_BaseMultiHeadAttention sidney1505/arc_maml_transformer/keras_transformer/transformer.py community (archive-listed) ran no licence file found · pointer only · 1eb7bb2c7019e81d · report
generate_signal moon23k/Transformer_Archs/model/recurrent.py community (archive-listed) ran · honoured contract fingerprinted no licence file found · pointer only · 58801803f9aacb41 · report
ACT_basic andreamad8/Universal-Transformer-Pytorch/models/UTransformer.py community (archive-listed) unverified no licence file found · pointer only · 48da21be9c4b565a · report
DecoderStack cfiken/universal_transformer/model/ut.py community (archive-listed) unverified no licence file found · pointer only · 785dd04c3d9161a4 · report
EncoderStack cfiken/universal_transformer/model/ut.py community (archive-listed) unverified no licence file found · pointer only · 9d2c61e66b4346a7 · report
LayerNormalization cfiken/universal_transformer/model/ut.py community (archive-listed) unverified no licence file found · pointer only · d65227646941963e · report
ModelBase moon23k/Transformer_Archs/model/recurrent.py community (archive-listed) unverified no licence file found · pointer only · 6dd3fd72476b96f4 · report
RecurrentDecoder moon23k/Transformer_Archs/model/recurrent.py community (archive-listed) unverified no licence file found · pointer only · d939293e6a574006 · report
RecurrentEncoder moon23k/Transformer_Archs/model/recurrent.py community (archive-listed) unverified no licence file found · pointer only · 1e5ecdd2d7834bc5 · report
RecurrentTransformer moon23k/Transformer_Archs/model/recurrent.py community (archive-listed) unverified no licence file found · pointer only · 848001379d12e45b · report
TransformerBlock sidney1505/arc_maml_transformer/keras_transformer/transformer.py community (archive-listed) unverified no licence file found · pointer only · bfa58c8b92ee3953 · report
UniversalTransformer cfiken/universal_transformer/model/ut.py community (archive-listed) unverified no licence file found · pointer only · b3026a17c1914957 · report
log_decode_results MostafaDehghani/bAbI-T2T/t2t_usr_dir/babi_transformer_decoder.py community (archive-listed) unverified Apache-2.0 (permissive) · 82a2fb5195404bdd · report

Tasks

Inductive BiasLAMBADALanguage ModelingLanguage ModellingLearning to ExecuteMachine TranslationTranslation

Results from the paper archive 2025-07-28

TaskDatasetModelMetricValueRank at snapshotLeaderboardReport
Language Modelling LAMBADA Universal Transformer (w/ dynamic halting) Accuracy 56.25 #30 of 37 Archive leaderboard report
Machine Translation WMT2014 English-German universal transformer base BLEU score 28.9 #37 of 91 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

Introduced by this paper: Universal Transformer

Absolute Position EncodingsAdamAttentionAttention DropoutBPEDense ConnectionsDropoutLabel SmoothingLayer NormalizationLinear LayerMulti-Head AttentionPosition-Wise Feed-Forward LayerReLUResidual ConnectionSoftmaxTransformerUniversal Transformer

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