Similarity Analysis of Contextual Word Representation Models

John M. Wu, Yonatan Belinkov, Hassan Sajjad, Nadir Durrani, Fahim Dalvi, James R. Glass

Introduction

In the effort to understand the internal mechanisms of Large Language Models (LLMs), researchers have traditionally relied on "probing classifiers." This method involves training a small supervised model on top of frozen pre-trained representations to predict linguistic features like syntax or part-of-speech. However, probing is inherently indirect and requires expensive labeled data. It fails to answer a fundamental question: if two models achieve similar accuracy on a probe, are they actually processing information in the same way?

This research moves beyond probing to directly compare the internal "worldviews" of diverse NLP models, including BERT, GPT, and ELMo. By measuring inter- and intra-model similarity without external annotations, we can determine how different architectures and training objectives influence internal logic.

Methodology

The study employs several similarity measures to analyze models at different granularities:

  1. Neuron-level (neuronsim): Measures the maximum correlation between individual neurons across layers to determine how localized information is.
  2. Representation-level (ckasim): Uses Centered Kernel Alignment (CKA) to compare the entire vector space of a layer, capturing the collective behavior of all neurons.
  3. Attention-level: Compares attention maps and the collective behavior of attention heads using metrics like Jensen-Shannon divergence.

These metrics were applied to models trained on the Penn Treebank (PTB) and Universal Dependencies English Web Treebank, with further evaluation on the GLUE benchmark to observe the effects of fine-tuning.

Key Insights: Universal Representations vs. Unique Neurons

A primary discovery of this work is that while different architectures develop remarkably similar overall representations, they do so using entirely different individual neurons. This suggests that models converge on a "universal" conceptual space despite having different internal "filing systems."

Comparison of neuron-level similarity (left) and representation-level similarity (right) across different model families.

As shown in the figure above, neuronsim (left) reveals very low similarity between different model families, indicating that specific neurons do not align across architectures. In contrast, ckasim (right) shows significantly higher similarity, proving that the aggregate vector spaces are highly correlated.

Layer-wise Dynamics and Localization

The analysis also reveals distinct patterns in how information is processed across layers:

  • The Input Effect: Lower layers are more similar across architectures because they are closer to the raw text. Higher layers diverge as they become more specialized to the model's specific training objective (e.g., masked vs. causal language modeling).
  • Information Localization: In most models, information starts distributed across many neurons in lower layers and becomes increasingly localized in specific neurons as it moves toward the top layers.
Evolution of model scores across layers, illustrating the progression of internal representations.

Practical Implications: Efficient Fine-tuning

Observations of model similarity during fine-tuning show that the process is "top-heavy." Fine-tuning primarily reshapes the top layers and their attention patterns while leaving the bottom layers largely untouched.

Leveraging this insight, the authors experimented with freezing the bottom six layers of BERT and XLNet during task-specific training. This approach maintained—and in some cases improved—performance on tasks like SST-2 and QNLI, while reducing backpropagation computation by over 50%. This demonstrates that understanding internal similarity can lead directly to more efficient training paradigms.

Conclusion

By shifting from probing to direct similarity analysis, this research highlights a convergence in the representational spaces of modern NLP models. While individual neurons remain architecture-specific, the collective "worldview" of these models is surprisingly consistent. These findings not only provide theoretical clarity but also offer practical paths toward more efficient model adaptation.

Summary updated

BibTeX
@inproceedings{wu2020similarity,
  author = {John M. Wu and Yonatan Belinkov and Hassan Sajjad and Nadir Durrani and Fahim Dalvi and James R. Glass},
  title = {{Similarity Analysis of Contextual Word Representation Models}},
  booktitle = {Annual Meeting of the Association for Computational Linguistics},
  year = {2020},
  doi = {10.18653/v1/2020.acl-main.422},
}
Figure