distilbert-base-uncased

What is this model? DistilBERT‑base‑uncased is a distilled, lightweight version of the original BERT‑base transformer. It retains the bidirectional masked‑language‑modeling (MLM) architecture while reducing size and inference latency.

distilbert 6.9M downloads apache-2.0 Fill Mask Top 50
Frameworkstransformerspytorchtfjaxrustsafetensors
Languagesen
Datasetsbookcorpuswikipedia
Tagsdistilbertfill-maskexbert
Downloads
6.9M
License
apache-2.0
Pipeline
Fill Mask
Author
distilbert

Run distilbert-base-uncased locally on a Q4KM hard drive

Accelerate your NLP workloads with a Q4KM hard drive pre‑loaded with DistilBERT‑base‑uncased . Enjoy instant access, zero‑download latency, and optimized I/O for large‑scale inference. Get this model...

Shop Q4KM Drives

Technical Overview

What is this model? DistilBERT‑base‑uncased is a distilled, lightweight version of the original BERT‑base transformer. It retains the bidirectional masked‑language‑modeling (MLM) architecture while reducing size and inference latency. The model is uncased – all input text is lower‑cased and tokenised using the same WordPiece vocabulary as BERT‑base.

Key features & capabilities

  • 66 M trainable parameters (≈ 40 % fewer than BERT‑base’s 110 M).
  • ~60 % faster inference on modern GPUs while preserving ~97 % of BERT‑base’s downstream performance.
  • Supports the full Hugging Face pipeline API for fill‑mask, feature‑extraction, text‑classification, question‑answering, etc.
  • Available in PyTorch, TensorFlow, JAX and Rust via the transformers library.
  • Pre‑trained on the English BookCorpus + Wikipedia (≈ 3 B tokens).

Architecture highlights

  • 6 transformer encoder layers (vs. 12 in BERT‑base).
  • Hidden size = 768, feed‑forward size = 3072, 12 attention heads.
  • Distillation training combines three losses:
    • Distillation loss – KL‑divergence between student and teacher logits.
    • Masked language modeling (MLM) – 15 % token masking.
    • Cosine embedding loss – aligns hidden‑state representations with the teacher.

Intended use cases – fine‑tuning on any downstream task that benefits from a full‑sentence representation: sentiment analysis, named‑entity recognition, sentence‑pair classification, question answering, and masked‑word prediction. The model is not suited for autoregressive generation (e.g., GPT‑style text completion).

Benchmark Performance

DistilBERT‑base‑uncased is typically evaluated on the GLUE benchmark suite. Reported scores (average across GLUE tasks) are about 97 % of BERT‑base while using < 50 % of the compute. Specific numbers from the original paper (Sanh et al., 2019) include:

  • MNLI (matched): 84.5 % (vs. 86.7 % for BERT‑base).
  • SQuAD‑v1.1 F1: 88.9 % (vs. 90.9 % for BERT‑base).
  • CoLA MCC: 55.8 % (vs. 60.5 % for BERT‑base).

These benchmarks matter because they reflect the model’s ability to understand sentence‑level semantics, a core requirement for most NLP pipelines. The slight drop in accuracy is often acceptable given the substantial speed‑up and lower memory footprint, especially for production environments with latency constraints.

Hardware Requirements

VRAM for inference – The model’s checkpoint is ~250 MB (safetensors). A single‑GPU inference pass fits comfortably in 2 GB of VRAM (including the tokeniser overhead). For batch inference or larger sequence lengths (≤ 512 tokens) a 4 GB GPU provides headroom.

Recommended GPU specifications

  • Any modern NVIDIA GPU with at least 4 GB VRAM (e.g., GTX 1650, RTX 2060, Tesla T4).
  • For high‑throughput serving, consider GPUs with 8 GB+ VRAM (RTX 3080, A100) to enable larger batch sizes.

CPU requirements – The model can run on CPU‑only environments, but latency will increase roughly 5‑10× compared to GPU. A recent multi‑core CPU (≥ 8 threads) with ≥ 16 GB RAM is recommended for acceptable response times.

Storage needs – The model files (weights, tokenizer vocab, config) occupy ~250 MB. Including the transformer library and optional safetensors, allocate ≈ 500 MB of disk space.

Performance characteristics – On a RTX 2070, the model processes ~150 tokens/ms for a batch size of 1 (single‑sentence inference). Throughput scales linearly with batch size up to the VRAM limit.

Use Cases

Primary intended applications – masked‑language modeling, feature extraction, and fine‑tuning for downstream NLP tasks.

  • Sentiment analysis – fine‑tune on movie‑review or product‑review datasets.
  • Named‑entity recognition (NER) – leverage the token‑level representations for entity tagging.
  • Question answering – integrate as the encoder in a QA pipeline (e.g., SQuAD‑style).
  • Text classification – spam detection, intent classification, topic tagging.
  • Masked‑word prediction – use the fill‑mask pipeline for autocomplete or language‑learning tools.

Real‑world examples – chat‑bot intent detection, document triage in legal tech, content moderation, and search‑query expansion.

Industries & domains – e‑commerce, finance, healthcare (clinical note analysis), media, and any sector that processes large volumes of English text.

Integration possibilities – the model can be deployed via Hugging Face Inference API, TorchServe, TensorFlow Serving, or embedded in Rust applications using the transformers crate. It also works seamlessly with Azure Machine Learning (the model is tagged “deploy:azure”).

Training Details

Methodology – DistilBERT was trained using a three‑loss distillation approach: (1) KL‑divergence between student and teacher logits, (2) standard MLM loss, and (3) cosine embedding loss on hidden states. The student model has half the number of layers (6 vs. 12) but the same hidden dimension.

Datasets – The model was pre‑trained on the English BookCorpus and Wikipedia corpora, totaling roughly 3 billion tokens.

Compute requirements – Training was performed on 8 × NVIDIA V100 GPUs for ~3 days, consuming ≈ 150 TFLOP‑days of compute. This high‑throughput setting allowed the model to converge to BERT‑base‑level representations despite the reduced size.

Fine‑tuning capabilities – The model can be fine‑tuned on any Hugging Face‑compatible task using the standard Trainer API. Because it retains the same tokenisation and architecture as BERT‑base, downstream scripts can be swapped with minimal code changes.

Licensing Information

The model card lists the license as Apache‑2.0. The “unknown” tag in the metadata is a placeholder; the official README clarifies the Apache‑2.0 terms.

What the license allows – Apache‑2.0 is a permissive open‑source license. You may:

  • Use the model for commercial or non‑commercial purposes.
  • Modify the model weights or code.
  • Distribute the model as part of a larger product.

Restrictions & requirements

  • Provide proper attribution (retain the copyright notice and license file).
  • State any modifications you make.
  • Include a copy of the Apache‑2.0 license in distributions.

The license does **not** impose copyleft obligations, making DistilBERT‑base‑uncased suitable for proprietary applications as long as the attribution clause is respected.

Pre-loaded AI models. Ready to run.

Skip the downloads. Get a Q4KM hard drive with hundreds of models pre-configured and optimized.

Shop Q4KM Hard Drives