TL;DR
This paper takes the first steps toward measuring the internal representational similarity of 7B-parameter large language models (LLMs). By analyzing final-layer representations across different tasks, the authors reveal that LLMs are not uniformly similar and that existing similarity metrics often contradict one another, highlighting the need for extreme caution when evaluating model relationships.
What Problem Does This Paper Address?
With the explosion of open-source LLMs, we lack a deep understanding of how these models differ beneath the surface of standard benchmark scores. Measuring internal similarity could help engineers optimize model selection, detect illegal model reuse, and improve ensembling techniques.
While prior work evaluated smaller models like BERT, scaling representational similarity measures to modern decoder-only LLMs introduces unique challenges. Specifically, LLMs suffer from non-deterministic text generation and varying tokenization schemes, making direct layer-to-layer comparisons difficult. This paper addresses these challenges to establish a baseline for comparing modern 7B models.
Methods
The authors focus on the last layer of representations before the final classifier, arguing that similarity here strongly implies functional (output) similarity. To sidestep the standard challenges of LLM evaluation, they use fixed input prompts to ensure determinism and only compare the representation of the final token, bypassing tokenization mismatches across different models.
They evaluate these representations under specific geometric invariances: Orthogonal Transformations (OT, like rotations and reflections), Isotropic Scaling (IS), and Translation (TR). They deploy a suite of standard and advanced metrics to compare the models, including:
- Orthogonal Procrustes
- Aligned Cosine Similarity
- Norm RSM-Difference
- Jaccard Similarity
- Representational Similarity Analysis (RSA)
- Centered Kernel Alignment (CKA)
Datasets
The study evaluates models zero-shot on two distinct domains:
- Winogrande: A benchmark for commonsense reasoning requiring the model to fill in a blank based on binary options.
- HumanEval: A code generation benchmark where prompts consist of docstrings describing desired code functionality. For this dataset, code-specific models (CodeLlama and CodeLlama-Python) were added to the evaluation pool.
Key Insights and Ideas
- LLM representations are not universal: Models exhibit significant structural differences despite similar parameter counts. For instance, StableLM Alpha is a clear outlier on Winogrande, while OpenLlama and OPT diverge sharply from the pack on HumanEval.
- Metrics disagree violently: Even when sharing the same mathematical invariances, different metrics tell completely different stories. Falcon appears highly unique on Winogrande when measured by Orthogonal Procrustes, but looks completely standard under Aligned Cosine Similarity. The authors note that a few high-variance dimensions might be masking finer-grained differences in cosine-based metrics.
- Similarity is task-dependent: A model that behaves like its peers on one task might look entirely unique on another. GPT-J aligns closely with other models on commonsense reasoning but stands out as highly dissimilar during code generation, likely reflecting differences in training data composition.
- The scale interpretation problem: Many popular similarity metrics lack an absolute upper bound, making it difficult to interpret whether a uniform set of scores implies that models are equally similar or equally distinct.
Key Results
The authors present pairwise similarity heatmaps across 11 base 7B models.
- On Winogrande, the average Spearman correlation ($\rho$) between different similarity measures is remarkably low at 0.35, proving that your choice of metric drastically alters your conclusion.
- On HumanEval, the metrics align slightly better, yielding an average correlation of $\rho = 0.65$.
- The cross-task correlation is weak: the average Spearman correlation between heatmaps on Winogrande versus HumanEval is just 0.34, confirming that representational similarity does not easily generalize across applications.
Limitations and Future Work
- Sample Size vs. Dimensionality: The datasets used have fewer samples than the embedding dimensions, which can cause alignment-based metrics (like Procrustes) to overfit and overestimate similarity.
- Scale Constraints: The study is strictly limited to 7B parameter models; it remains unknown if these similarity patterns hold true for larger scales (e.g., 13B, 70B+).
- Prompt Sensitivity: The authors used a single specific prompting format per dataset. Given how sensitive LLMs are to prompt engineering, changing the prompt style could alter internal representations in unstudied ways.
Summary updated