Papers › Distilling Task-Specific Knowledge from BERT into Simple Neural Networks

Distilling Task-Specific Knowledge from BERT into Simple Neural Networks

28 Mar 2019arXiv:1903.12136archive 2025-07-28

Raphael Tang, Yao Lu, Linqing Liu, Lili Mou, Olga Vechtomova, Jimmy Lin

In the natural language processing literature, neural networks are becoming increasingly deeper and complex. The recent poster child of this trend is the deep language representation model, which includes BERT, ELMo, and GPT. These developments have led to the conviction that previous-generation, shallower neural networks for language understanding are obsolete. In this paper, however, we demonstrate that rudimentary, lightweight neural networks can still be made competitive without architecture changes, external training data, or additional input features. We propose to distill knowledge from BERT, a state-of-the-art language representation model, into a single-layer BiLSTM, as well as its siamese counterpart for sentence-pair tasks. Across multiple datasets in paraphrasing, natural language inference, and sentiment classification, we achieve comparable results with ELMo, while using roughly 100 times fewer parameters and 15 times less inference time.

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

Code

Syntology Ran 9 of 9 code samples harvested from 2 repositories linked to this paper; 0 have no recorded run. Of those that ran: 3 ran · honoured contract; 5 ran · our draft was wrong; 1 ran · fixture could not drive it.

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

AI-Mart/distill_lstm mentioned on GitHubpaddle report
aqweteddy/BERTDistilForClassification mentioned on GitHubpytorch report
castorini/d-bert mentioned on GitHubpytorch report
pvgladkov/knowledge-distillation 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

9 samples harvested; 9 ran; 3 honoured the contract we drafted; 0 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
5ran · our draft was wrong
1ran · fixture could not drive it

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

batch_to_inputs pvgladkov/knowledge-distillation/knowledge_distillation/bert_trainer.py community (archive-listed) ran · our draft was wrong fingerprinted MIT (permissive) · 3ea37bfa7bd6625b · report
convert_dp_to_single castorini/d-bert/dbert/finetune/classifier.py community (archive-listed) ran · our draft was wrong MIT (permissive) · 31cb7e5ee37e07ad · report
convert_single_to_dp castorini/d-bert/dbert/finetune/classifier.py community (archive-listed) ran · our draft was wrong MIT (permissive) · 76d68a1ed9ae4351 · report
evaluate castorini/d-bert/dbert/distill/run/distill_birnn.py community (archive-listed) ran · honoured contract MIT (permissive) · 502edb147c17e8f6 · report
evaluate_score castorini/d-bert/dbert/distill/run/distill_birnn.py community (archive-listed) ran · honoured contract MIT (permissive) · e4a51df9636b003c · report
init_sos castorini/d-bert/dbert/generate/finetune_transfoxl.py community (archive-listed) ran · honoured contract MIT (permissive) · 59e0610210960189 · report
mse_forward_monkey_patch castorini/d-bert/dbert/finetune/classifier.py community (archive-listed) ran · our draft was wrong MIT (permissive) · fb341ab6d38412a8 · report
sample_query castorini/d-bert/dbert/generate/finetune_transfoxl.py community (archive-listed) ran · fixture could not drive it MIT (permissive) · 36da55e25256092f · report
transfo_encode castorini/d-bert/dbert/generate/finetune_transfoxl.py community (archive-listed) ran · our draft was wrong MIT (permissive) · 4837663eda94ee99 · report

Tasks

Natural Language InferenceSentenceSentiment AnalysisSentiment Classification

Results from the paper archive 2025-07-28

TaskDatasetModelMetricValueRank at snapshotLeaderboardReport
Sentiment Analysis SST-2 Binary classification Single layer bilstm distilled from BERT Accuracy 90.7 #60 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 DropoutBERTBPEBiLSTMCosine AnnealingDense ConnectionsDiscriminative Fine-TuningDropoutELMoGPTLSTMLayer NormalizationLinear LayerLinear Warmup With Cosine AnnealingLinear Warmup With Linear DecayMulti-Head AttentionResidual ConnectionSigmoid ActivationSoftmaxTanh ActivationWeight 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