Papers › DistilBERT, a distilled version of BERT: smaller, faster, cheaper and lighter

DistilBERT, a distilled version of BERT: smaller, faster, cheaper and lighter

2 Oct 2019NeurIPS 2019 12arXiv:1910.01108archive 2025-07-28

Victor Sanh, Lysandre Debut, Julien Chaumond, Thomas Wolf

As Transfer Learning from large-scale pre-trained models becomes more prevalent in Natural Language Processing (NLP), operating these large models in on-the-edge and/or under constrained computational training or inference budgets remains challenging. In this work, we propose a method to pre-train a smaller general-purpose language representation model, called DistilBERT, which can then be fine-tuned with good performances on a wide range of tasks like its larger counterparts. While most prior work investigated the use of distillation for building task-specific models, we leverage knowledge distillation during the pre-training phase and show that it is possible to reduce the size of a BERT model by 40%, while retaining 97% of its language understanding capabilities and being 60% faster. To leverage the inductive biases learned by larger models during pre-training, we introduce a triple loss combining language modeling, distillation and cosine-distance losses. Our smaller, faster and lighter model is cheaper to pre-train and we demonstrate its capabilities for on-device computations in a proof-of-concept experiment and a comparative on-device study.

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

Code

Syntology Ran 19 of 27 code samples harvested from 6 repositories linked to this paper; 8 have no recorded run. Of those that ran: 3 ran · honoured contract; 1 ran · violated contract; 5 ran · our draft was wrong; 3 ran · fixture could not drive it; 7 ran with no contract checked.

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

37 repositories listed; official and paper-mentioned ones first.

huggingface/swift-coreml-transformers officialmentioned in papermentioned on GitHubpytorchApache-2.0 report
huggingface/transformers officialmentioned in papermentioned on GitHubpytorch report
allenai/scifact mentioned on GitHubpytorchNOASSERTION report
askaydevs/distillbert-qa mentioned on GitHubpytorch report
ayeffkay/rubert-tiny mentioned on GitHubpytorch report
dngback/co-forget-protocol mentioned on GitHubApache-2.0 report
enzomuschik/distilfnd mentioned on GitHubpytorchMIT report
epfml/collaborative-attention mentioned on GitHubpytorch report
facebookresearch/EgoTV mentioned on GitHubpytorchNOASSERTION report
flexible-fl/flex-nlp mentioned on GitHubAGPL-3.0 report
frankaging/Causal-Distill mentioned on GitHubpytorchMIT report
franknb/Text-Summarization mentioned on GitHub report
huggingface/node-question-answering mentioned on GitHubtfApache-2.0 report
huggingface/tflite-android-transformers mentioned on GitHubtfApache-2.0 report
jaketae/pytorch-malware-detection mentioned on GitHubpytorchMIT report
knuddj1/op_text mentioned on GitHubpytorchMIT report
knuddy/op_text mentioned on GitHubpytorchMIT report
lukexyz/Deep-Lyrical-Genius mentioned on GitHubpytorchMIT report
mkavim/finetune_bert mentioned on GitHubtf report
monologg/distilkobert mentioned on GitHubpytorch report
msorkhpar/wiki-entity-summarization-preprocessor mentioned on GitHubpytorchCC-BY-4.0 report
nageshsinghc4/deepwrap mentioned on GitHubtf report
reycn/multi-modal-scale mentioned on GitHubpytorchMIT report
rybread1/stack-overflow-question-classification mentioned on GitHubnot reachable when probed 2026-09-17 — repositories for recent papers often appear after camera-ready report
sdadas/polish-roberta mentioned on GitHubpytorchLGPL-3.0 report
stefan-it/europeana-bert mentioned on GitHubtfMIT report
suinleelab/path_explain mentioned on GitHubtf report
twobooks/intro-aws-training mentioned on GitHubpytorch 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

27 samples harvested; 19 ran; 3 honoured the contract we drafted; 8 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.

3ran · honoured contract
1ran · violated contract
5ran · our draft was wrong
3ran · fixture could not drive it
7ran
8unverified

Licence: 0 of the 27 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 6 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.

timeit_and_report_mean huggingface/swift-coreml-transformers/model_generation/distilbert-onnx-coreml.py official repository unverified Apache-2.0 (permissive) · 3ae355fe5a2be50f · report
ArgsAdapterDistilBERT epfml/collaborative-attention/src/collaborative_attention/adapter_distilbert.py community (archive-listed) ran Apache-2.0 (permissive) · bd41263948c9f93a · report
DistillBertConfig mkavim/finetune_bert/finetune/modeling_distilbert.py community (archive-listed) ran · metamorphic tier: deterministic Apache-2.0 (permissive) · d3e9e3aeb78c5878 · report
DistillBertMultiHeadSelfAttention mkavim/finetune_bert/finetune/modeling_distilbert.py community (archive-listed) ran Apache-2.0 (permissive) · c73b35f8741d5bbc · report
FeedForward mkavim/finetune_bert/finetune/modeling_distilbert.py community (archive-listed) ran Apache-2.0 (permissive) · 586463f8edb14bc7 · report
GroupedBatchSampler monologg/distilkobert/distillation/distiller.py community (archive-listed) ran Apache-2.0 (permissive) · c01d1e6d469d9bfd · report
PretrainedConfig mkavim/finetune_bert/finetune/modeling_distilbert.py community (archive-listed) ran · metamorphic tier: deterministic Apache-2.0 (permissive) · aa85de675f71b596 · report
_quantize monologg/distilkobert/distillation/distiller.py community (archive-listed) ran · fixture could not drive it Apache-2.0 (permissive) · f5d6d16633127806 · report
build_transform reycn/multi-modal-scale/script/3.evaluation.batch.py community (archive-listed) ran MIT (permissive) · 57e95166ade5f25c · report
create_lengths_groups monologg/distilkobert/distillation/distiller.py community (archive-listed) ran · fixture could not drive it fingerprinted Apache-2.0 (permissive) · 2fe0a0a44bca4abd · report
create_position_ids mkavim/finetune_bert/finetune/modeling_distilbert.py community (archive-listed) ran · our draft was wrong fingerprinted Apache-2.0 (permissive) · 4e8314bcf966eece · report
distilbert_layers epfml/collaborative-attention/src/collaborative_attention/adapter_distilbert.py community (archive-listed) ran · our draft was wrong Apache-2.0 (permissive) · 024e22b6643186b4 · report
dynamic_preprocess reycn/multi-modal-scale/script/3.evaluation.batch.py community (archive-listed) ran · our draft was wrong MIT (permissive) · 6dc77bb22fb9d660 · report
find_closest_aspect_ratio reycn/multi-modal-scale/script/3.evaluation.batch.py community (archive-listed) ran · fixture could not drive it MIT (permissive) · bd77f5f8067f18e9 · report
gelu mkavim/finetune_bert/finetune/modeling_distilbert.py community (archive-listed) ran · honoured contract fingerprinted Apache-2.0 (permissive) · 9bc31d06256e1691 · report
gelu_new mkavim/finetune_bert/finetune/modeling_distilbert.py community (archive-listed) ran · honoured contract fingerprinted Apache-2.0 (permissive) · 5b3fd00218623502 · report
get_initializer mkavim/finetune_bert/finetune/modeling_distilbert.py community (archive-listed) ran · our draft was wrong Apache-2.0 (permissive) · 333abb7d28cd1f9f · report
get_input_mask mkavim/finetune_bert/finetune/modeling_distilbert.py community (archive-listed) ran · violated contract fingerprinted Apache-2.0 (permissive) · 57e9478bd6df4915 · report
shape_list mkavim/finetune_bert/finetune/modeling_distilbert.py community (archive-listed) ran · our draft was wrong fingerprinted Apache-2.0 (permissive) · 6220c13c591c68a7 · report
swish mkavim/finetune_bert/finetune/modeling_distilbert.py community (archive-listed) ran · honoured contract fingerprinted Apache-2.0 (permissive) · 86d13b9f67274f19 · report
DistilBERTCollaborativeAdapter epfml/collaborative-attention/src/collaborative_attention/adapter_distilbert.py community (archive-listed) unverified Apache-2.0 (permissive) · 299d28a1eb667c41 · report
DistillBertModel mkavim/finetune_bert/finetune/modeling_distilbert.py community (archive-listed) unverified Apache-2.0 (permissive) · 1f3a00e205369e86 · report
DistillBertPretrained mkavim/finetune_bert/finetune/modeling_distilbert.py community (archive-listed) unverified Apache-2.0 (permissive) · 604d8efbff65993f · report
Distiller monologg/distilkobert/distillation/distiller.py community (archive-listed) unverified Apache-2.0 (permissive) · 20e3c004457d9336 · report
LmSeqsDataset monologg/distilkobert/distillation/distiller.py community (archive-listed) unverified Apache-2.0 (permissive) · 2efdc2800d06d37c · report
get_confidence_scores knuddj1/op_text/op_text/utils.py community (archive-listed) unverified MIT (permissive) · b07754f6f7d44e9e · report
load_distillbert_model_weights_from_checkpoint mkavim/finetune_bert/finetune/modeling_distilbert.py community (archive-listed) unverified Apache-2.0 (permissive) · 4db4878c2df8732e · report

Tasks

Hate Speech DetectionKnowledge DistillationLanguage ModelingLanguage ModellingLinguistic AcceptabilityNatural Language InferenceOnly Connect Walls Dataset Task 1 (Grouping)Question AnsweringSemantic Textual SimilaritySentiment AnalysisTransfer Learning

Results from the paper archive 2025-07-28

TaskDatasetModelMetricValueRank at snapshotLeaderboardReport
Linguistic Acceptability CoLA DistilBERT 66M Accuracy 49.1% #38 of 43 Archive leaderboard report
Natural Language Inference QNLI DistilBERT 66M Accuracy 90.2% #36 of 43 Archive leaderboard report
Natural Language Inference RTE DistilBERT 66M Accuracy 62.9% #68 of 90 Archive leaderboard report
Natural Language Inference WNLI DistilBERT 66M Accuracy 44.4 #23 of 23 Archive leaderboard report
Only Connect Walls Dataset Task 1 (Grouping) OCW DistilBERT (BASE) # Correct Groups 49 ± 4 #21 of 22 Archive leaderboard report
Only Connect Walls Dataset Task 1 (Grouping) OCW DistilBERT (BASE) # Solved Walls 0 ± 0 #21 of 22 Archive leaderboard report
Only Connect Walls Dataset Task 1 (Grouping) OCW DistilBERT (BASE) Adjusted Mutual Information (AMI) 14.0 ± .3 #21 of 22 Archive leaderboard report
Only Connect Walls Dataset Task 1 (Grouping) OCW DistilBERT (BASE) Adjusted Rand Index (ARI) 11.3 ± .3 #21 of 22 Archive leaderboard report
Only Connect Walls Dataset Task 1 (Grouping) OCW DistilBERT (BASE) Fowlkes Mallows Score (FMS) 29.1 ± .2 #21 of 22 Archive leaderboard report
Only Connect Walls Dataset Task 1 (Grouping) OCW DistilBERT (BASE) Wasserstein Distance (WD) 86.7 ± .6 #21 of 22 Archive leaderboard report
Question Answering MultiTQ DistillBERT Hits@1 8.3 #10 of 11 Archive leaderboard report
Question Answering MultiTQ DistillBERT Hits@10 48.4 #10 of 11 Archive leaderboard report
Question Answering Quora Question Pairs DistilBERT 66M Accuracy 89.2% #14 of 19 Archive leaderboard report
Question Answering SQuAD1.1 dev DistilBERT EM 77.7 #20 of 55 Archive leaderboard report
Question Answering SQuAD1.1 dev DistilBERT 66M F1 85.8 #54 of 55 Archive leaderboard report
Semantic Textual Similarity MRPC DistilBERT 66M Accuracy 90.2% #14 of 45 Archive leaderboard report
Semantic Textual Similarity STS Benchmark DistilBERT 66M Pearson Correlation 0.907 #16 of 66 Archive leaderboard report
Sentiment Analysis IMDb DistilBERT 66M Accuracy 92.82 #30 of 49 Archive leaderboard report
Sentiment Analysis SST-2 Binary classification DistilBERT 66M Accuracy 91.3 #55 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

AdamAttentionAttention DropoutBERTDense ConnectionsDistilBERTDropoutKnowledge DistillationLayer NormalizationLinear LayerLinear Warmup With Linear DecayMulti-Head AttentionResidual ConnectionSoftmaxWeight 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