All models

distilbert

A smaller, faster transformer language model pretrained by knowledge distillation.

Language · 148 operations Checked

100%

Showing the top corner; full diagram not loaded yetShowing a small copy; full diagram not loaded yetLarge diagram, not loaded yet

Open SVG

Loading diagram (26 KB)

Open in a new tab

Click or tap a spot to read it up close. Scroll or drag inside the diagram to move through it. Zoom with + and − or Ctrl and scroll. Press 0 for the whole graph. Swipe inside the diagram to move through it. Use + and − to zoom.

At a glance

Parameters
67M
Operations
148
Framework
PyTorch
Recurrent
No
Published
2019
License
Apache-2.0
Checked
Passed: the trace was replayed operation by operation and matched the model's own output for this input.

Files

The diagram is a drawing of a TorchLens trace of the source code. It contains no code or weights.

Details
Stable ID
m4321
Graph hash
cb3a42c427e12727d01cd7438867f1a13b4eaf89e469febf9200805ade8d0a78
Skeleton hash
2bd9a27d5e6c1e771ec9a68038dbd3d31b42c2a2ad35b9dcc78a067d91af95ed
Architecture hash
e4a8aac7fb9fa982bc1f2c0cd9f84e326c8c7123b2d0fbf3d5f0144e8aae4574
Diagram SHA-256
eea38491ccc05aabcd6c49df3965d9697a2d5a84868340545ed5335065f885ee
TorchLens version
2.35.3
Renderer
graphviz 2.43.0+pyvips 3.2.0+libvips 8.18.7+render-opts@06c1f0d3
Check
Forward pass replayed in PyTorch

How this diagram was made

transformers.AutoModelForMaskedLM.from_config()

What it is

DistilBERT is a language model pretrained by knowledge distillation to be smaller, with faster inference and less compute needed for training. Its pretraining uses a triple loss objective: a language modeling loss, a distillation loss and a cosine-distance loss. With that objective, DistilBERT is described as showing similar performance to a larger transformer language model.

DistilBERT has no token_type_ids input, so there is no need to indicate which token belongs to which segment, and segments are simply separated with the separation token. It also has no option to select the input positions through a position_ids input. The library's implementation was adapted in part from the XLM model code and in part from a PyTorch version of the Google AI Bert model.

Key idea. DistilBERT uses knowledge distillation during pretraining, with a triple loss, to produce a smaller and faster model that performs similarly to a larger transformer language model.

  • DistilBERT
  • distilled BERT
  • knowledge distillation
  • DistilBertForMaskedLM
  • masked language modeling
  • text classification
  • smaller language model

AI-written summary, based on the model's documentation and checked automatically against it; not reviewed by a person. Corrections welcome.