BERTops: Studying BERT Representations under a Topological Lens
Abstract
Proposing scoring functions to effectively understand, analyze and learn various properties of high dimensional hidden representations of large-scale transformer models like BERT can be a challenging task. In this work, we explore a new direction by studying the topological features of BERT hidden representations using persistent homology (PH). We propose a novel scoring function named "persistence scoring function (PSF)" which: (i) accurately captures the homology of the high-dimensional hidden representations and correlates well with the test set accuracy of a wide range of datasets and outperforms existing scoring metrics, (ii) captures interesting post fine-tuning "per-class" level properties from both qualitative and quantitative viewpoints, (iii) is more stable to perturbations as compared to the baseline functions, which makes it a very robust proxy, and (iv) finally, also serves as a predictor of the attack success rates for a wide category of black-box and white-box adversarial attack methods. Our extensive correlation experiments demonstrate the practical utility of PSF on various NLP tasks relevant to BERT.
Empirical ResultsBrowse all benchmarks →
| Benchmark | Method | Metric | Score | Protocol / Evidence |
|---|---|---|---|---|
| Multiple datasets · Test set accuracy across datasets | Persistence scoring function (PSF) | Spearman rank correlation (ρ) | -0.515 | Image Classification · split: test · fine-tunedSource quoteL128: As baselines, we compare to the popular Silhouette coefficient (SC) \cite{rousseeuw_198753}, where we subtract the value of SC on each dataset from 1 to ensure consistency in experiments, and the Davies Bouldin index (DBI) \cite{davies_bouldin_4766909}. Both these methods have been widely used in the literature to assess the quality of the learned representations of the data by machine learning models. For reference, we point the reader to the works by\cite{chauhan2020FEW, article_dbi}. Figure \ref{fig:acc_predictor} shows the dataset accuracies versus the PSF values of the different estimator functions. We can observe that PSF, with a stronger negative correlation of -0.515, outperforms both SC and DBI with a correlation of -0.442, thus affirming our claims. |
| Multiple datasets · Class-label F1-scores across datasets | Persistence scoring function (PSF) | Spearman correlation (ρ) between classwise PSF and F1-scores | -0.685 | Image Classification · fine-tunedSource quoteL135: We further conduct experiments to show that PSF can also be used for a more fine-grained analysis at a class-wise level and capture interesting properties about the same class labels across multiple datasets. This is done by calculating the Spearman correlation (\rho) of the f1-scores of the class labels to the corresponding class-wise PSF values. Similar to the previous experiment, we expect a strong negative correlation. Note that here we concatenate the PSF of the class labels across all the datasets in a single array (as opposed to averaging over an entire dataset). As shown in figure \ref{fig:label_wise}, PSF achieves a strong negative correlation of -0.685. |
BibTeX
@misc{chauhan2022bertops,
author = {Jatin Chauhan and Manohar Kaul},
title = {{BERTops: Studying BERT Representations under a Topological Lens}},
year = {2022},
eprint = {2205.00953},
archivePrefix = {arXiv},
url = {https://arxiv.org/abs/2205.00953},
}Ask Althea to put this paper to the test.