BERT is a pretrained bidirectional Transformer encoder for building rich representations of input text. Every position can attend to tokens before and after it, making BERT useful for language understanding rather than generation in a loop. section 15.4.1
Masked language modeling
To pretrain BERT, replace roughly 15% of tokens in a text sequence with [MASK]. The model predicts the original tokens from their surrounding context. This unsupervised setup requires no labels and can use large text collections such as Wikipedia. section 15.4.1
Keep these distinctions in mind:
- BERT predicts masked tokens from both directions; a causal language model predicts each token from preceding tokens. section 15.4.1
- Pretraining the entire Transformer produces context-sensitive word embeddings, rather than fixed embeddings independent of surrounding words. section 15.4.1








