Papers › TinyBERT: Distilling BERT for Natural Language Understanding

TinyBERT: Distilling BERT for Natural Language Understanding

23 Sep 2019Findings of the Association for Computational Linguistics 2020arXiv:1909.10351archive 2025-07-28

Xiaoqi Jiao, Yichun Yin, Lifeng Shang, Xin Jiang, Xiao Chen, Linlin Li, Fang Wang, Qun Liu

Language model pre-training, such as BERT, has significantly improved the performances of many natural language processing tasks. However, pre-trained language models are usually computationally expensive, so it is difficult to efficiently execute them on resource-restricted devices. To accelerate inference and reduce model size while maintaining accuracy, we first propose a novel Transformer distillation method that is specially designed for knowledge distillation (KD) of the Transformer-based models. By leveraging this new KD method, the plenty of knowledge encoded in a large teacher BERT can be effectively transferred to a small student Tiny-BERT. Then, we introduce a new two-stage learning framework for TinyBERT, which performs Transformer distillation at both the pretraining and task-specific learning stages. This framework ensures that TinyBERT can capture he general-domain as well as the task-specific knowledge in BERT. TinyBERT with 4 layers is empirically effective and achieves more than 96.8% the performance of its teacher BERTBASE on GLUE benchmark, while being 7.5x smaller and 9.4x faster on inference. TinyBERT with 4 layers is also significantly better than 4-layer state-of-the-art baselines on BERT distillation, with only about 28% parameters and about 31% inference time of them. Moreover, TinyBERT with 6 layers performs on-par with its teacher BERTBASE.

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

Code

Syntology Ran 0 of 4 code samples harvested from 1 repository linked to this paper; 4 have no recorded run.

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

huawei-noah/Pretrained-Language-Model officialmentioned on GitHubtf report
graison-thomas/TinyFinBERT mentioned on GitHubMIT report
mkavim/finetune_bert mentioned on GitHubtf report
pwc-1/Paper-9 mindspore 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

4 samples harvested; 0 ran; 0 honoured the contract we drafted; 4 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.

4unverified

Licence: 4 of the 4 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 huawei-noah/Pretrained-Language-Model. “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.

BertLMPredictionHead huawei-noah/Pretrained-Language-Model/TinyBERT/transformer/modeling.py official repository unverified no licence file found · pointer only · 031455b1879a2b6c · report
BertPreTrainingHeads huawei-noah/Pretrained-Language-Model/TinyBERT/transformer/modeling.py official repository unverified no licence file found · pointer only · f41c936d29d457a8 · report
BertPredictionHeadTransform huawei-noah/Pretrained-Language-Model/TinyBERT/transformer/modeling.py official repository unverified no licence file found · pointer only · 0d693a0079ce791d · report
TinyBertForPreTraining huawei-noah/Pretrained-Language-Model/TinyBERT/transformer/modeling.py official repository unverified no licence file found · pointer only · aeb5fa56defa897a · report

Tasks

Knowledge DistillationLanguage ModellingLinguistic AcceptabilityNatural Language InferenceNatural Language UnderstandingParaphrase IdentificationQuestion AnsweringSemantic Textual SimilaritySentiment Analysis

Results from the paper archive 2025-07-28

TaskDatasetModelMetricValueRank at snapshotLeaderboardReport
Linguistic Acceptability CoLA TinyBERT-4 14.5M Accuracy 43.3% #40 of 43 Archive leaderboard report
Linguistic Acceptability CoLA Dev TinyBERT-6 67M Accuracy 54 #4 of 6 Archive leaderboard report
Natural Language Inference MultiNLI TinyBERT-6 67M Matched 84.6 #31 of 67 Archive leaderboard report
Natural Language Inference MultiNLI TinyBERT-6 67M Mismatched 83.2 #31 of 67 Archive leaderboard report
Natural Language Inference MultiNLI TinyBERT-4 14.5M Matched 82.5 #37 of 67 Archive leaderboard report
Natural Language Inference MultiNLI TinyBERT-4 14.5M Mismatched 81.8 #37 of 67 Archive leaderboard report
Natural Language Inference MultiNLI Dev TinyBERT-6 67M Matched 84.5 #1 of 10 Archive leaderboard report
Natural Language Inference MultiNLI Dev TinyBERT-6 67M Mismatched 84.5 #1 of 10 Archive leaderboard report
Natural Language Inference QNLI TinyBERT-6 67M Accuracy 90.4% #34 of 43 Archive leaderboard report
Natural Language Inference QNLI TinyBERT-4 14.5M Accuracy 87.7% #39 of 43 Archive leaderboard report
Natural Language Inference RTE TinyBERT-6 67M Accuracy 66% #64 of 90 Archive leaderboard report
Natural Language Inference RTE TinyBERT-4 14.5M Accuracy 62.9% #69 of 90 Archive leaderboard report
Paraphrase Identification Quora Question Pairs TinyBERT F1 71.3 #14 of 31 Archive leaderboard report
Question Answering SQuAD1.1 dev TinyBERT-6 67M EM 79.7 #15 of 55 Archive leaderboard report
Question Answering SQuAD1.1 dev TinyBERT-6 67M F1 87.5 #15 of 55 Archive leaderboard report
Question Answering SQuAD2.0 dev TinyBERT-6 67M EM 69.9 #13 of 13 Archive leaderboard report
Question Answering SQuAD2.0 dev TinyBERT-6 67M F1 73.4 #13 of 13 Archive leaderboard report
Semantic Textual Similarity MRPC TinyBERT-6 67M Accuracy 87.3% #29 of 45 Archive leaderboard report
Semantic Textual Similarity MRPC TinyBERT-4 14.5M Accuracy 86.4% #33 of 45 Archive leaderboard report
Semantic Textual Similarity MRPC Dev TinyBERT-6 67M Accuracy 86.3 #2 of 2 Archive leaderboard report
Semantic Textual Similarity STS Benchmark TinyBERT-4 14.5M Pearson Correlation 0.799 #28 of 66 Archive leaderboard report
Sentiment Analysis SST-2 Binary classification TinyBERT-6 67M Accuracy 93.1 #43 of 87 Archive leaderboard report
Sentiment Analysis SST-2 Binary classification TinyBERT-4 14.5M Accuracy 92.6 #46 of 87 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 EncodingsAdamAttentionAttention DropoutBERTBPEDense ConnectionsDropoutKnowledge DistillationLabel SmoothingLayer NormalizationLinear LayerLinear Warmup With Linear DecayMulti-Head AttentionPosition-Wise Feed-Forward LayerReLUResidual ConnectionSoftmaxTransformerWeight DecayWordPiece

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