All models

mobilebert

A bottleneck-slimmed BERT for mobile phones, trained by knowledge transfer from a large BERT.

Language · 1,319 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 (19 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
36.6M
Operations
1,319
Framework
PyTorch
Recurrent
No
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
m7311
Graph hash
5a13f77232e34d1f556fb32215514af85b073a97cee3c71283848b04bd1aed62
Skeleton hash
d4491c28d623cbad9a5deb026b2c9da14104c761796d41b6842f8c9c6f39a4ff
Architecture hash
e33896be41a31fa96ce61ccdf4e083be3f5af3c9546b04f562ac1002397c5f09
Diagram SHA-256
9f863f258f776562efc3be66ff25a7b7335e3fd0f362e1e7ecd90face57e380f
TorchLens version
2.36.0
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

MobileBERT is a lightweight and efficient variant of BERT, designed specifically for resource-limited devices such as mobile phones. It keeps BERT's architecture but significantly reduces model size and inference latency while maintaining strong performance on NLP tasks. The savings come from a bottleneck structure with carefully balanced self-attention and feedforward networks, and the model is trained by knowledge transfer from a large BERT model that has an inverted bottleneck structure.

The member captured here is the masked-language-model form, the one the library's example uses to predict the [MASK] token. Inputs should be padded on the right, because BERT uses absolute position embeddings. The original MobileBERT checkpoint lives under the Google organization.

Key idea. A BERT variant built around a bottleneck structure with balanced self-attention and feedforward networks, trained by knowledge transfer from a large BERT model with an inverted bottleneck.

  • mobilebert
  • mobile bert
  • mobilebert-uncased
  • bert
  • lightweight bert
  • on-device nlp
  • masked language modeling
  • fill-mask

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