BERT (language model)
Written by GPT-6 Luna from the web 15 of 47 sentences cited
An AI wrote this article, and it can be wrong.
BERT (Bidirectional Encoder Representations from Transformers) is a language model introduced by researchers at Google in 2018 that uses a Transformer encoder to represent words in context from both directions. It became an influential method for adapting a model pre-trained on unlabeled text to tasks such as question answering, text classification and language inference.12
BERT helped establish pre-training followed by fine-tuning as a widely used approach in natural language processing. Its performance on several benchmarks drew attention to the value of using both left and right context, while later studies examined its training choices, computational demands and tendency to reflect social biases in text. Google also adapted BERT for Search in 2019; subsequent encoder models have retained or revised aspects of its approach.134
Origins
Jacob Devlin, Ming-Wei Chang, Kenton Lee and Kristina Toutanova introduced BERT in a paper first submitted to arXiv on October 11, 2018. The authors were members of Google AI Language. Google announced an open-source release of code and pre-trained models on November 2, 2018; the work was later published in the 2019 proceedings of the North American Chapter of the Association for Computational Linguistics.125
The paper built on earlier work that used large quantities of unlabeled text to learn representations transferable to language tasks with smaller labeled datasets. Earlier models, including GPT and ELMo, had demonstrated the usefulness of pre-trained contextual representations, but used different strategies for accessing context. BERT’s central proposal was to train a Transformer deeply bidirectionally, conditioning each token representation on text on both sides rather than only on preceding words.12
Architecture
BERT uses the encoder portion of the Transformer architecture. Its self-attention layers let each token’s representation incorporate information from other tokens in the input, while position and segment embeddings identify token order and, where relevant, which of two text segments a token belongs to. This design produces contextual representations: the same word can be represented differently depending on the surrounding sentence.1
The original release included two English model sizes. BERTBASE has 12 Transformer layers, 12 attention heads and 110 million parameters; BERTLARGE has 24 layers, 16 heads and 340 million parameters. The larger model generally performed better in the paper’s evaluations, but also required more computation. These specifications describe the original models, not every later model using the BERT name or approach.61
Training and use
BERT was pre-trained on the BooksCorpus, containing about 800 million words, and English Wikipedia, containing about 2.5 billion words in the text used by the researchers. Its main training objective, masked language modeling, selected 15% of WordPiece tokens for prediction. Of those selected tokens, 80% were replaced by a special mask token, 10% by a random token and 10% left unchanged; the model learned to recover the original token using its surrounding context.1
A second objective, next sentence prediction, trained the model to classify whether one text segment followed another in the source corpus. In the training examples, the second segment was the actual continuation half the time and a randomly selected segment the other half. For a downstream task, practitioners could fine-tune the pre-trained model using labeled examples and add a task-specific output layer, rather than build a new architecture from scratch. For question answering, for example, the model was trained to identify the start and end of an answer span in a passage.1
Evaluation
The original paper reported new best results at the time on 11 natural language processing tasks. On the GLUE benchmark, which combines multiple language-understanding tasks, BERTLARGE achieved a score of 80.5, a 7.7-point absolute improvement over the previous best reported in the paper. On the Stanford Question Answering Dataset (SQuAD) version 1.1, it achieved an F1 score of 93.2; the paper also reported results on MultiNLI and SQuAD version 2.0.17
These results helped make transfer learning—a general model adapted to a particular task—a prominent research and development strategy. They did not establish that BERT understood language in every sense or performed equally well in every setting: benchmark scores measure performance on specified datasets and tasks. The GLUE authors, for example, described the benchmark as a way to compare models across tasks and analyze their capabilities, including through a diagnostic test suite.71
Applications
Google announced in October 2019 that it was applying BERT to Search ranking and featured snippets. The company said the ranking change would affect about one in ten English-language searches in the United States, with the aim of better interpreting the relationship between words in longer or conversational queries. Google illustrated this with queries where small words such as “to” or “for” change the intended meaning.3
The same general-purpose representations can be adapted to classification, named-entity recognition, sentence-pair inference and question answering. Google later reported applying BERT to Search features in additional languages and locales. Such use is distinct from generating long passages of text: BERT’s core design produces contextual representations for input text, which downstream systems use to make predictions or rank results.231
Limitations and legacy
Researchers later revisited BERT’s training recipe. The 2019 RoBERTa study found that the original model had been undertrained and that longer training, more data and other changes improved results; its recipe also removed next sentence prediction. This did not mean that all later models used the same method, but it showed that benchmark performance depended on training choices as well as the basic architecture.8
Research also documented social biases in contextual representations such as BERT. A 2019 study evaluated gender bias in a pronoun-resolution task, while another study reported evidence of gender and racial bias in contextual word representations, including BERT. Such findings concern model behavior measured using particular methods and tasks; they do not imply that every use produces the same effects.94
BERT’s influence continued in later encoder models that changed its objective, scale or architecture. ELECTRA, for example, trained an encoder to detect tokens replaced by a generator rather than to predict only masked tokens, with its authors reporting greater computational efficiency in their experiments. A December 2024 paper introduced ModernBERT, a revised bidirectional encoder designed for longer inputs and more efficient inference. These developments show the continuing use of encoder models while also marking departures from the original BERT design.1011
References
11 sourcesUnderstanding searches better than ever beforeblog.googleOct 25, 2019· cited 3×
Assessing Social and Intersectional Biases in Contextualized Word Representationspapers.nips.cc· cited 2×
GLUE: A Multi-Task Benchmark and Analysis Platform for Natural Language Understandingarxiv.orgApr 20, 2018· cited 2×
RoBERTa: A Robustly Optimized BERT Pretraining Approacharxiv.orgJul 26, 2019
Measuring Bias in Contextualized Word Representationsaclanthology.org
ELECTRA: Pre-training Text Encoders as Discriminators Rather Than Generatorsarxiv.orgMar 23, 2020