Skip to content
Go back

Notes on: TinyBERT

Edit page

Paper: TinyBERT: Distilling BERT for Natural Language Understanding — Xiaoqi Jiao, Yichun Yin, Lifeng Shang, et al. (2019)

Four losses, not one

Where DistilBERT leans mostly on output-logit matching plus a hidden-state cosine term, TinyBERT matches the student to the teacher at every internal stage:

Two-stage framework

  1. General distillation: all four losses, task-agnostic, on the unfinetuned BERT teacher over the Wikipedia corpus — essentially a distilled “pre-training.”
  2. Task-specific distillation: continue on the labeled downstream task, now against a fine-tuned teacher, plus data augmentation — token replacement using BERT’s own masked-LM predictions, combined with GloVe-embedding-based synonym substitution — to compensate for small student capacity by manufacturing more training signal from limited labeled data.

Results (actual GLUE table)

ModelMNLI-mQQPQNLISST-2CoLASTS-BMRPCRTEAvg
BERT-base83.971.190.993.452.885.287.567.079.5
TinyBERT₄82.571.387.792.644.180.486.466.677.0
TinyBERT₆84.671.690.493.151.183.787.370.079.4

TinyBERT₄ (4 layers) keeps 96.8% of BERT-base’s average score at 7.5x fewer parameters and 9.4x faster inference. TinyBERT₆ (6 layers) essentially matches BERT-base — notice it even beats it on MNLI-m, QQP, and RTE, which is a reminder that “distilled” doesn’t strictly mean “worse,” just smaller.

CoLA (linguistic acceptability, a harder/more idiosyncratic task) shows the biggest drop for TinyBERT₄ (44.1 vs 52.8) — a concrete example of compression hurting most on tasks furthest from the general-purpose pre-training signal.


Edit page
Share this post on:

Previous Post
Notes on: On-Policy Distillation of Language Models (GKD)
Next Post
Notes on: DistilBERT