Papers › TLM: Token-Level Masking for Transformers

TLM: Token-Level Masking for Transformers

28 Oct 2023arXiv:2310.18738archive 2025-07-28

Yangjun Wu, Kebin Fang, Dongxiang Zhang, Han Wang, Hao Zhang, Gang Chen

Structured dropout approaches, such as attention dropout and DropHead, have been investigated to regularize the multi-head attention mechanism in Transformers. In this paper, we propose a new regularization scheme based on token-level rather than structure-level to reduce overfitting. Specifically, we devise a novel Token-Level Masking (TLM) training strategy for Transformers to regularize the connections of self-attention, which consists of two masking techniques that are effective and easy to implement. The underlying idea is to manipulate the connections between tokens in the multi-head attention via masking, where the networks are forced to exploit partial neighbors' information to produce a meaningful representation. The generality and effectiveness of TLM are thoroughly evaluated via extensive experiments on 4 diversified NLP tasks across 18 datasets, including natural language understanding benchmark GLUE, ChineseGLUE, Chinese Grammatical Error Correction, and data-to-text generation. The results indicate that TLM can consistently outperform attention dropout and DropHead, e.g., it increases by 0.5 points relative to DropHead with BERT-large on GLUE. Moreover, TLM can establish a new record on the data-to-text benchmark Rotowire (18.93 BLEU). Our code will be publicly available at https://github.com/Young1993/tlm.

PaperPDFCodeCode 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="2310.18738")

Code

Syntology Ran 19 of 28 code samples harvested from 2 repositories linked to this paper; 9 have no recorded run. Of those that ran: 1 ran · our draft was wrong; 18 ran with no contract checked.

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

young1993/tlm officialmentioned in paperjax 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

28 samples harvested; 19 ran; 0 honoured the contract we drafted; 9 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 · our draft was wrong
18ran
9unverified

Licence: 28 of the 28 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 2 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.

booleans_processing Young1993/tlm/transformers/modeling_tf_utils.py official repository ran no licence file found · pointer only · 743ceb9025a7955d · report
convert_pytorch_state_dict_to_flax Young1993/tlm/transformers/modeling_flax_pytorch_utils.py official repository ran no licence file found · pointer only · db0c9b6ddfd01ae5 · report
dummy_loss Young1993/tlm/transformers/modeling_tf_utils.py official repository ran no licence file found · pointer only · 3c1eb64dde6b86af · report
infer_metric_tags_from_eval_results Young1993/tlm/transformers/modelcard.py official repository ran no licence file found · pointer only · dd8f7751ef859581 · report
keras_serializable Young1993/tlm/transformers/modeling_tf_utils.py official repository ran no licence file found · pointer only · 6a3959a0ffd36577 · report
parse_keras_history Young1993/tlm/transformers/modelcard.py official repository ran no licence file found · pointer only · 18450df3733a6e7e · report
quick_gelu Young1993/tlm/transformers/modeling_flax_utils.py official repository ran fingerprinted no licence file found · pointer only · a66d2b78670c85e1 · report
rename_key_and_reshape_tensor Young1993/tlm/transformers/modeling_flax_pytorch_utils.py official repository ran no licence file found · pointer only · 1236c8c8ab59ff20 · report
check_imports Young1993/tlm/transformers/dynamic_module_utils.py official repository unverified no licence file found · pointer only · 301682fc3342590a · report
dtype_byte_size Young1993/tlm/transformers/modeling_flax_utils.py official repository unverified no licence file found · pointer only · 9d98806acb3144b7 · report
flax_shard_checkpoint Young1993/tlm/transformers/modeling_flax_utils.py official repository unverified no licence file found · pointer only · e3ce70ca9258800e · report
get_relative_import_files Young1993/tlm/transformers/dynamic_module_utils.py official repository unverified no licence file found · pointer only · 00cc853a73f3aeb6 · report
get_relative_imports Young1993/tlm/transformers/dynamic_module_utils.py official repository unverified no licence file found · pointer only · 450aeffe7f80f917 · report
is_hf_dataset Young1993/tlm/transformers/modelcard.py official repository unverified no licence file found · pointer only · 569927b3efc92b80 · report
construct_parallel_data_lbl blcuicall/CCL2022-CLTC/baselines/track1/data_preprocess.py found in paper text by Syntology ran no licence file found · pointer only · 5967acfb31566dce · report
construct_parallel_data_para blcuicall/CCL2022-CLTC/baselines/track1/data_preprocess.py found in paper text by Syntology ran no licence file found · pointer only · 37070b4bd77f89f1 · report
convert_to_unicode blcuicall/CCL2022-CLTC/baselines/track2/tokenization.py found in paper text by Syntology ran · our draft was wrong fingerprinted no licence file found · pointer only · 1923fc05163d207d · report
encode_parallel_data blcuicall/CCL2022-CLTC/baselines/track1/data_preprocess.py found in paper text by Syntology ran no licence file found · pointer only · f02b7d24b3c3ecb3 · report
get_correction_map blcuicall/CCL2022-CLTC/baselines/track1/eval_char_level.py found in paper text by Syntology ran no licence file found · pointer only · bec43ad3f12fba68 · report
get_eval_metrics blcuicall/CCL2022-CLTC/baselines/track1/eval_char_level.py found in paper text by Syntology ran no licence file found · pointer only · befde8a6e72b2fa6 · report
get_weights_name blcuicall/CCL2022-CLTC/baselines/track2/gector/gec_model.py found in paper text by Syntology ran fingerprinted no licence file found · pointer only · 1e8d0a0db7a3947f · report
load_vocab blcuicall/CCL2022-CLTC/baselines/track2/tokenization.py found in paper text by Syntology ran no licence file found · pointer only · deb4d1793cf3ba73 · report
metric_file blcuicall/CCL2022-CLTC/baselines/track1/eval_sent_level.py found in paper text by Syntology ran no licence file found · pointer only · 7b3c30e644fc5e5e · report
read_file blcuicall/CCL2022-CLTC/baselines/track1/eval_sent_level.py found in paper text by Syntology ran no licence file found · pointer only · 40a3d4e153df98ef · report
sent_metric_detect blcuicall/CCL2022-CLTC/baselines/track1/eval_sent_level.py found in paper text by Syntology ran no licence file found · pointer only · 2384075fc45a1f65 · report
get_best_score blcuicall/CCL2022-CLTC/baselines/track1/utils.py found in paper text by Syntology unverified no licence file found · pointer only · 23c9c8f028972e4e · report
get_char_metrics blcuicall/CCL2022-CLTC/baselines/track1/eval_char_level.py found in paper text by Syntology unverified no licence file found · pointer only · 9b9e456240811606 · report
printable_text blcuicall/CCL2022-CLTC/baselines/track2/tokenization.py found in paper text by Syntology unverified no licence file found · pointer only · 0e5615f8994003cf · report

Tasks

Data-to-Text GenerationGrammatical Error CorrectionNatural Language UnderstandingText Generation

Results from the paper archive 2025-07-28

No leaderboard rows for this paper in the archive.

Methods

Attention DropoutDropoutLinear LayerSoftmax

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