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 ranMethod as code

In Syntology View this paper on Syntology, its page in Syntology's graph. That page adds which of its functions are also present in other papers' code Syntology holds, with dates, and its dated run record as JSON and a README badge. It also lists the repositories linked to the paper, the abstract and the calls for agents.

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

For agents, on Syntology's MCP service (how to connect):

Code

Syntology 4 code samples harvested from 1 repository linked to this paper: 0 ran · 4 unverified.

By repository: official repository: 4 samples from 1 repository, 0 ran (0 with no instrument failure; 0 where Syntology's instrument failed). The run record, sample by sample. “Ran” means executed on a synthesized input, not that the code is correct or reproduces the paper.

No sample is linked to this paper from 6 of its repositories that Syntology harvested for other papers:

huawei-noah/Pretrained-Language-Model officialmentioned on GitHubtfSyntology: 4 samples, 0 ran · 4 unverified report
graison-thomas/TinyFinBERT mentioned on GitHubMITSyntology: not harvested report
mkavim/finetune_bert mentioned on GitHubtfSyntology: no sample linked to this paper (harvested for another paper). Syntology's graph links these samples to BERT: Pre-training of Deep Bidirectional Transformers for Language Understanding (arXiv:1810.04805; that paper's own run record: 300 ran (of which 75 constructed an object rather than computing a result; 234 with no instrument failure: 18 honoured, 5 violated, 211 with no contract checked; 66 where Syntology's instrument failed) · 359 unverified) and DistilBERT, a distilled version of BERT: smaller, faster, cheaper and lighter (arXiv:1910.01108; that paper's own run record: 21 ran (of which 5 constructed an object rather than computing a result; 12 with no instrument failure: 3 honoured, 1 violated, 8 with no contract checked; 9 where Syntology's instrument failed) · 6 unverified); nothing checks that they implement this paper's method. report
2023-MindSpore-1/ms-code-166 mindsporeSyntology: not harvested report
MindCode-4/code-5 mindsporeSyntology: no sample linked to this paper (harvested for another paper). Syntology's graph links these samples to ViTamin: Designing Scalable Vision Models in the Vision-Language Era (arXiv:2404.02132; that paper's own run record: 6 ran (of which 0 constructed an object rather than computing a result; 4 with no instrument failure: 0 honoured, 1 violated, 3 with no contract checked; 2 where Syntology's instrument failed) · 6 unverified); nothing checks that they implement this paper's method. report
PaddlePaddle/PaddleNLP paddleSyntology: no sample linked to this paper (harvested for another paper). Syntology's graph links these samples to ERNIE 3.0 Tiny: Frustratingly Simple Method to Improve Task-Agnostic Distillation... (arXiv:2301.03416; that paper's own run record: 2 ran (of which 0 constructed an object rather than computing a result; 2 with no instrument failure: 0 honoured, 0 violated, 2 with no contract checked; 0 where Syntology's instrument failed) · 1 unverified); nothing checks that they implement this paper's method. report
mindspore-ai/models mindsporeSyntology: no sample linked to this paper (harvested for another paper). Syntology's graph links these samples to AdaBin: Improving Binary Neural Networks with Adaptive Binary Sets (arXiv:2208.08084; that paper's own run record: 4 ran (of which 0 constructed an object rather than computing a result; 4 with no instrument failure: 0 honoured, 0 violated, 4 with no contract checked; 0 where Syntology's instrument failed) · 1 unverified); nothing checks that they implement this paper's method. report
pwc-1/Paper-10 mindsporeSyntology: no sample linked to this paper (harvested for another paper). Syntology's graph links these samples to StableToolBench: Towards Stable Large-Scale Benchmarking on Tool Learning of Large... (arXiv:2403.07714; that paper's own run record: 11 ran (of which 0 constructed an object rather than computing a result; 8 with no instrument failure: 0 honoured, 2 violated, 6 with no contract checked; 3 where Syntology's instrument failed) · 4 unverified); nothing checks that they implement this paper's method. report
pwc-1/Paper-9 mindsporeSyntology: no sample linked to this paper (harvested for another paper). Syntology's graph links these samples to RandAugment: Practical automated data augmentation with a reduced search space (arXiv:1909.13719; that paper's own run record: 58 ran (of which 1 constructed an object rather than computing a result; 7 with no instrument failure: 0 honoured, 1 violated, 6 with no contract checked; 51 where Syntology's instrument failed) · 7 unverified); nothing checks that they implement this paper's method. report
xiaolilaoli/tiny_bert_ms mindsporeSyntology: not harvested 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.

A paper named beside a repository with no sample linked to this paper is shown with that paper's own run record, not this paper's: “ran” means executed on a synthesized input, not that the code is correct, and “where Syntology's instrument failed” counts failures of Syntology's instrument, not of the code. Papers are listed in arXiv-id order, at most three per repository.

Code Syntology ran Syntology

4 samples harvested: 0 ran · 4 unverified. Syntology's record for this page has not changed since , the first build that kept a record date for it; when this build read Syntology's graph is in the build record. That date is 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 “the contract check could not run” are failures of Syntology's instrument, not of the code: the sample ran on Syntology's synthesized input, and then the drafted contract did not describe it, or the check itself raised an error (RAISES), lacked a dependency (DEP_MISSING) or ran out of time (TIMEOUT); hover the label for which. A metamorphic tier, where shown, is evidence of the output's shape, not that the sample implements the method.

Each sample ends with its code_sha256. A sample's code_sha256 is Syntology's identity for that exact code. It is printed in full (16 hexadecimal characters for every sample in this build), and get_code(code_sha256="…") takes it exactly as printed. An agent calls it on Syntology's MCP service (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 are grouped by repository: a repository marked official first, then by how directly the repository is tied to the paper, then in the archive's order; never by how many ran. 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 six 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; the licence is outside the permissive list Syntology serves text under (MIT, Apache-2.0, BSD and similar); this paper's copy was not located, so its licence is not recorded; or this paper's copy is cleared, but the stored copy of the same code that Syntology serves is not. 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.

A function or class name links to its page when the name occurs in the harvested code of at least 5 papers; the name is a string, not an identity.

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

Method as code Syntology

What Syntology's graph records as this paper's claimed method, lifted into code: each assembly names its bricks (functions and classes), each with its own role and its own verification level. An assembly is not a check that the code implements the method correctly or reproduces the paper's results. Levels are each brick's own verification level in Syntology's graph (level 0: no recorded run), listed brick by brick and never combined into one level; “ran” means the brick executed on a synthesized input, not that its output is correct, and the instrument figure counts failures of Syntology's instrument, not of the code. Where a model read the code against the paper's claim, each assembly's label verdict is one model's judgement, kept in this page's JSON twin; it is not calibrated, so no card prints it.

1 assembly on this paper: 1 harvested, 0 generated.

harvested Assembly for TinyBERT (graph method: TinyBERT). 18 bricks; individually on a fixture: 5 ran (of which 4 constructed an object rather than computing a result; 5 with no instrument failure: 1 honoured, 0 violated, 4 with no contract checked; 0 where Syntology's instrument failed) · 13 unverified. The assembly has not been run end-to-end.

  1. TinyBertForPreTraining entry · level 0 · unverified · aeb5fa56defa897a
  2. BertModel model · level 0 · unverified · 57ddc6f7b4914314
  3. BertPreTrainedModel helper · level 0 · unverified · 39f5d68d67913dc7
  4. BertPreTrainingHeads model · level 0 · unverified · f41c936d29d457a8
  5. BertEmbeddings helper · level 0 · unverified · 822402eb726689f9
  6. BertEncoder helper · level 0 · unverified · b824da45c7d85285
  7. BertPooler helper · level 1 · ran · 1ffe5589b401ff00
  8. BertConfig helper · level 1 · ran · 8a8e46e7b74bcec6
  9. load_tf_weights_in_bert helper · level 0 · unverified · 0453ed29d1aecc4c
  10. BertLMPredictionHead helper · level 0 · unverified · 031455b1879a2b6c
  11. BertLayer helper · level 0 · unverified · 39b12df168592d79
  12. BertPredictionHeadTransform helper · level 0 · unverified · 0d693a0079ce791d
  13. BertAttention helper · level 0 · unverified · 5416853a8be3a2d7
  14. BertIntermediate helper · level 1 · ran · f27f0935fbe1b62b
  15. BertOutput helper · level 0 · unverified · a0407d4bf4593206
  16. BertSelfAttention helper · level 1 · ran · 72415b9f7aa76ac9
  17. BertSelfOutput helper · level 0 · unverified · 178a7c8f563f0beb
  18. gelu helper · level 1 · ran · honoured contract · fdc64f4c72036ae4

Each brick ends with its code_sha256, Syntology's identity for that exact code; click one to copy the get_code call that returns it. For agents, on Syntology's MCP service: assembly(arxiv_id="1909.10351") returns these assemblies with each brick's role and wiring (how to connect).

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