Skip to content
StackDecode
LLM Library
EncoderOpen weightsArchitecture animation

BERT

The encoder that made pretrained transformers standard for language understanding.

At a glance

Made by
Google
Released
2018
Type
Encoder
Access
Open weights
Parameters
110M and 340M
Context window
512 tokens
Attention
Bidirectional self-attention

How it works

BERT reads text in both directions and is trained by hiding words and predicting them (masked language modelling). It is fine-tuned for classification, search and tagging rather than generating text.

Architecture, step by step

A token travels from text in to prediction out. The boxed layers repeat many times.

× N layersText inTokenizerEmbedding + positionBidirectional self-attentionAdd and normFeed-forward (MLP)Add and normFinal normOutput headPrediction

Raw text enters the system, for example "The cat sat on the".

stage:
1/10
part:
Text in
1/10

The green dot is one token travelling through the model. The boxed section repeats for every layer.

What stands out

  • Bidirectional attention
  • Masked language modelling plus next-sentence prediction
  • Still widely used for search and classification

Keep in mind

Not a chat model: it does not generate long text.

Related models