BERTology: Probing Attention in BERT
You'll learn how researchers decode BERT's learned linguistic knowledge by systematically analyzing attention patterns and testing for syntactic structures.
What is BERTology?
BERTology refers to the scientific study of what BERT (and similar Transformers) actually learn. Rather than treating BERT as a black box, researchers probe its internal representations—particularly attention patterns—to uncover whether it captures traditional linguistic structures like syntax trees, dependency relations, and grammatical roles.
Attention as a Window Into Language Understanding
Remember from previous lessons that BERT has 12 layers with 12 attention heads each (in BERT-base). By visualizing which tokens attend to which others, patterns emerge:
- Syntactic heads: Some attention heads consistently attend from words to their syntactic parents (like verbs attending to subjects)
- Dependency arcs: Certain heads approximate dependency parse trees
- Positional patterns: Heads that focus on adjacent tokens or specific relative positions
- Semantic grouping: Heads that cluster related entities or coreferents
Probing Tasks: Testing Linguistic Knowledge
Beyond just visualizing attention, researchers use probing classifiers—simple models trained on BERT's representations to predict linguistic properties:
- Can layer 5 predict part-of-speech tags?
- Do intermediate layers encode syntactic tree depth?
- Which layers best capture semantic similarity?
These probes reveal that BERT learns a hierarchy: lower layers capture syntax, middle layers transition to semantics, and upper layers specialize for task-specific features.
The Surprising Finding
Studies show BERT doesn't just memorize—it discovers grammatical structure without explicit supervision, even though it was only trained to predict masked words.
Key Takeaway: BERTology uses attention visualization and syntactic probing tasks to reveal that BERT spontaneously learns hierarchical linguistic structures, with different layers encoding different levels of language understanding from syntax to semantics.