{"about":{"site":"https://codewithpapers.app","non_affiliation":"Code with Papers and Syntology are not affiliated with, endorsed by, or sponsored by Papers with Code, Meta, or the pwc-archive mirror.","licence":"CC BY-SA 4.0","licence_url":"https://creativecommons.org/licenses/by-sa/4.0/legalcode","attribution":"https://codewithpapers.app/attribution","modified":"archive material modified by Syntology; see the attribution page"},"url":"/paper/mpnet-masked-and-permuted-pre-training-for","title":"MPNet: Masked and Permuted Pre-training for Language Understanding","arxiv_id":"2004.09297","date":"2020-04-20","proceeding":"NeurIPS 2020 12","authors":["Kaitao Song","Xu Tan","Tao Qin","Jianfeng Lu","Tie-Yan Liu"],"abstract":"BERT adopts masked language modeling (MLM) for pre-training and is one of the most successful pre-training models. Since BERT neglects dependency among predicted tokens, XLNet introduces permuted language modeling (PLM) for pre-training to address this problem. However, XLNet does not leverage the full position information of a sentence and thus suffers from position discrepancy between pre-training and fine-tuning. In this paper, we propose MPNet, a novel pre-training method that inherits the advantages of BERT and XLNet and avoids their limitations. MPNet leverages the dependency among predicted tokens through permuted language modeling (vs. MLM in BERT), and takes auxiliary position information as input to make the model see a full sentence and thus reducing the position discrepancy (vs. PLM in XLNet). We pre-train MPNet on a large-scale dataset (over 160GB text corpora) and fine-tune on a variety of down-streaming tasks (GLUE, SQuAD, etc). Experimental results show that MPNet outperforms MLM and PLM by a large margin, and achieves better results on these tasks compared with previous state-of-the-art pre-trained methods (e.g., BERT, XLNet, RoBERTa) under the same model setting. The code and the pre-trained models are available at: https://github.com/microsoft/MPNet.","url_abs":"https://arxiv.org/abs/2004.09297v2","url_pdf":"https://arxiv.org/pdf/2004.09297v2.pdf","source":{"archive":"pwc-archive (Hugging Face), CC BY-SA 4.0","snapshot":"2025-07-28","licence_url":"https://creativecommons.org/licenses/by-sa/4.0/legalcode","row_kind":"abstracts"},"code_links":[{"paper_slug":"mpnet-masked-and-permuted-pre-training-for","repo_url":"https://github.com/microsoft/MPNet","is_official":1,"mentioned_in_paper":1,"mentioned_in_github":1,"framework":"pytorch","reach":null},{"paper_slug":"mpnet-masked-and-permuted-pre-training-for","repo_url":"https://github.com/huggingface/transformers","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"pytorch","reach":null},{"paper_slug":"mpnet-masked-and-permuted-pre-training-for","repo_url":"https://github.com/michael-wzhu/mpnet_zh","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"ok","spdx":"MIT"}},{"paper_slug":"mpnet-masked-and-permuted-pre-training-for","repo_url":"https://github.com/microsoft/MASS","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"ok","spdx":"NOASSERTION"}},{"paper_slug":"mpnet-masked-and-permuted-pre-training-for","repo_url":"https://github.com/JunnYu/paddle-mpnet","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":0,"framework":"paddle","reach":{"status":"ok"}},{"paper_slug":"mpnet-masked-and-permuted-pre-training-for","repo_url":"https://github.com/PaddlePaddle/PaddleNLP/tree/develop/paddlenlp/transformers/mpnet","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":0,"framework":"paddle","reach":null},{"paper_slug":"mpnet-masked-and-permuted-pre-training-for","repo_url":"https://github.com/pwc-1/Paper-9/tree/main/2/mpnet","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":0,"framework":"mindspore","reach":null}],"tasks":[{"task_slug":"language-modeling","task_name":"Language Modeling"},{"task_slug":"language-modelling","task_name":"Language Modelling"},{"task_slug":"masked-language-modeling","task_name":"Masked Language Modeling"},{"task_slug":"task-1-grouping","task_name":"Only Connect Walls Dataset Task 1 (Grouping)"},{"task_slug":null,"task_name":"Position"},{"task_slug":"sentence","task_name":"Sentence"}],"methods":[{"method_slug":"adam","method_name":"Adam"},{"method_slug":"attention","method_name":"Attention"},{"method_slug":"attention-dropout","method_name":"Attention Dropout"},{"method_slug":"bert","method_name":"BERT"},{"method_slug":"bpe","method_name":"BPE"},{"method_slug":"dense-connections","method_name":"Dense Connections"},{"method_slug":"dropout","method_name":"Dropout"},{"method_slug":"layer-normalization","method_name":"Layer Normalization"},{"method_slug":"linear-layer","method_name":"Linear Layer"},{"method_slug":"linear-warmup-with-linear-decay","method_name":"Linear Warmup With Linear Decay"},{"method_slug":"mpnet","method_name":"MPNet"},{"method_slug":"multi-head-attention","method_name":"Multi-Head Attention"},{"method_slug":"residual-connection","method_name":"Residual Connection"},{"method_slug":"sentencepiece","method_name":"SentencePiece"},{"method_slug":"softmax","method_name":"Softmax"},{"method_slug":"weight-decay","method_name":"Weight Decay"},{"method_slug":"wordpiece","method_name":"WordPiece"},{"method_slug":"xlnet","method_name":"XLNet"}],"datasets_introduced":[],"methods_introduced":[{"slug":"mpnet","name":"MPNet","full_name":"MPNet"}],"results":[{"leaderboard":"/sota/task-1-grouping-on-ocw","task":"Only Connect Walls Dataset Task 1 (Grouping)","dataset":"OCW","model":"all-mpnet (BASE)","rank_in_archive_order":16,"of":22,"metrics":{" Wasserstein Distance (WD)":"86.3 ± .4","# Correct Groups":" 50 ± 4","# Solved Walls":"0 ± 0","Adjusted Mutual Information (AMI)":"14.3 ± .5","Adjusted Rand Index (ARI)":" 11.7 ± .4","Fowlkes Mallows Score (FMS)":"29.4 ± .3"},"uses_additional_data":true}],"syntology":{"atlas_url":"https://app.syntology.ai/?focus=2004.09297","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2004.09297"}},"developers":"https://syntology.ai/developers","read_at":"2026-09-24T18:15:14+00:00","read_at_is":"when the build read Syntology's graph, not when any sample ran","claim":"Per-sample execution status on synthesized fixtures; not a correctness claim about the paper. Samples come from repositories linked to the paper, official or community; repo_kind says which.","repos":[{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/huggingface/transformers","reach":null},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/JunnYu/paddle-mpnet","reach":{"status":"ok"}},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/microsoft/MPNet","reach":null},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/PaddlePaddle/PaddleNLP/tree/develop/paddlenlp/transformers/mpnet","reach":null},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/michael-wzhu/mpnet_zh","reach":{"status":"ok","spdx":"MIT"}},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/pwc-1/Paper-9/tree/main/2/mpnet","reach":null},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/microsoft/MASS","reach":{"status":"ok","spdx":"NOASSERTION"}}],"summary":{"ran_draft_wrong":3,"ran_honours":1,"ran":1,"unverified":3},"by_repo_kind":{"official":{"samples":2,"ran":2,"repositories":1},"listed":{"samples":6,"ran":3,"repositories":1}},"repo_kind_vocabulary":{"official":"The archive marks this repository official for the paper","named_in_paper":"The archive records that the paper mentions this repository; it is not marked official","listed":"In the archive's code links for this paper, not marked official and not recorded as mentioned in the paper","found_in_text":"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"},"n_pointer_only_for_licence":6,"samples":[{"code_sha256_prefix":"cf9ffa02a42184af","entry":"whitespace_tokenize","repo":"michael-wzhu/mpnet_zh","repo_kind":"listed","path":"src/tokenization_bert.py","file_url":"https://github.com/michael-wzhu/mpnet_zh/blob/HEAD/src/tokenization_bert.py","link_basis":"harvester_set","language":"python","status":"ran_draft_wrong","verification_level":2,"contract_check":"OUTPUT_MISDECLARED","metamorphic_tier":"deterministic","behaviour_fingerprint":true,"licence":"MIT","inline_ok":false,"mcp_get_code":{"code_sha256":"cf9ffa02a42184af"}},{"code_sha256_prefix":"e7fbc7a74a3457c7","entry":"load_vocab","repo":"michael-wzhu/mpnet_zh","repo_kind":"listed","path":"src/tokenization_bert.py","file_url":"https://github.com/michael-wzhu/mpnet_zh/blob/HEAD/src/tokenization_bert.py","link_basis":"harvester_set","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"OUTPUT_MISDECLARED","metamorphic_tier":"deterministic","behaviour_fingerprint":false,"licence":"MIT","inline_ok":false,"mcp_get_code":{"code_sha256":"e7fbc7a74a3457c7"}},{"code_sha256_prefix":"a427ea7612c6b14f","entry":"reverse_tensor","repo":"microsoft/MPNet","repo_kind":"official","path":"pretraining/fairseq/models/masked_permutation_net.py","file_url":"https://github.com/microsoft/MPNet/blob/HEAD/pretraining/fairseq/models/masked_permutation_net.py","link_basis":"first_harvest_node","language":"python","status":"ran_honours","verification_level":1,"contract_check":"HONOURS","metamorphic_tier":"invariant","behaviour_fingerprint":true,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"a427ea7612c6b14f"}},{"code_sha256_prefix":"208f1b5401a10976","entry":"split_tensor","repo":"microsoft/MPNet","repo_kind":"official","path":"pretraining/fairseq/models/masked_permutation_net.py","file_url":"https://github.com/microsoft/MPNet/blob/HEAD/pretraining/fairseq/models/masked_permutation_net.py","link_basis":"first_harvest_node","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"MISDECLARED","metamorphic_tier":"deterministic","behaviour_fingerprint":true,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"208f1b5401a10976"}},{"code_sha256_prefix":"e827d94caab33f59","entry":"url_to_filename","repo":"michael-wzhu/mpnet_zh","repo_kind":"listed","path":"src/file_utils.py","file_url":"https://github.com/michael-wzhu/mpnet_zh/blob/HEAD/src/file_utils.py","link_basis":"harvester_set","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":true,"licence":"MIT","inline_ok":false,"mcp_get_code":{"code_sha256":"e827d94caab33f59"}},{"code_sha256_prefix":"d1972efc38e68259","entry":"accuracy","repo":"michael-wzhu/mpnet_zh","repo_kind":"listed","path":"src/masked_permutation_criterion.py","file_url":"https://github.com/michael-wzhu/mpnet_zh/blob/HEAD/src/masked_permutation_criterion.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":false,"mcp_get_code":{"code_sha256":"d1972efc38e68259"}},{"code_sha256_prefix":"b2be6c932ce41084","entry":"hf_bucket_url","repo":"michael-wzhu/mpnet_zh","repo_kind":"listed","path":"src/file_utils.py","file_url":"https://github.com/michael-wzhu/mpnet_zh/blob/HEAD/src/file_utils.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":false,"mcp_get_code":{"code_sha256":"b2be6c932ce41084"}},{"code_sha256_prefix":"4381d1f588a7f42a","entry":"is_remote_url","repo":"michael-wzhu/mpnet_zh","repo_kind":"listed","path":"src/file_utils.py","file_url":"https://github.com/michael-wzhu/mpnet_zh/blob/HEAD/src/file_utils.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":false,"mcp_get_code":{"code_sha256":"4381d1f588a7f42a"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}