All models

squeezebert

A BERT-like bidirectional transformer that uses grouped convolutions in place of fully-connected layers.

Language · 381 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 (31 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
51.7M
Operations
381
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
m10237
Graph hash
5c80caf464a1fc46e96de6f79c4703f16d61818d21c010093938c363df778ee8
Skeleton hash
477ba822af4116d44c43987cb47e7563384f669ad96cba618d68902020979ddd
Architecture hash
98669ca48c2e06e4d6f6a842f996b169230dd245072def2580b614a02942472a
Diagram SHA-256
49b3f74315a82d44a2fda2f7d7ae525b6dccee18461a75bcd1c67250e6b64125
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

SqueezeBERT is a bidirectional transformer similar to BERT. The key difference is that it uses grouped convolutions instead of fully-connected layers for the Q, K, V and FFN layers. The idea comes from computer vision, where the authors observe that grouped convolutions have yielded significant speedups.

The motivation is running language models on smartphones: the paper measures BERT-base taking 1.7 seconds to classify a text snippet on a Pixel 3 smartphone. On the same phone it reports SqueezeBERT running 4.3x faster than BERT-base, with competitive accuracy on the GLUE test set. SqueezeBERT uses absolute position embeddings, so the usual advice is to pad inputs on the right rather than the left.

Key idea. SqueezeBERT replaces several operations in self-attention layers with grouped convolutions, and the paper reports it running 4.3x faster than BERT-base on the Pixel 3.

  • squeezebert
  • squeeze bert
  • efficient transformer
  • grouped convolutions
  • mobile nlp
  • masked language model
  • fill-mask

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