Analyzing Text Representations by Measuring Task Alignment

César González-Gutiérrez, Audi Primadhanty, Francesco Cazzaro, Ariadna QuattoniACL 2023

Introduction

In Natural Language Processing (NLP), pre-trained models like BERT provide high-quality text representations. However, the specific reasons why certain representations excel in few-shot learning scenarios—where labeled data is scarce—remain poorly understood. This research investigates whether a representation's effectiveness stems from its intrinsic geometric properties (tight, separate clusters) or its alignment with specific task labels.

Methodology: The Task Hierarchical Alignment Score (THAS)

To quantify how well a representation aligns with a target task, the authors propose the Task Hierarchical Alignment Score (THAS). The metric is calculated through a three-step process:

  1. Hierarchical Clustering: Unlabeled text representations are organized into a dendrogram, capturing data structure across all levels of granularity.
  2. Measuring Purity: At each level of the hierarchy, cluster "purity" is measured against gold-standard labels using the Area Under the Precision-Recall Curve (AUC).
  3. Aggregation: The final THAS is the area under the curve of these alignment scores across the entire hierarchy.
Overview of the THAS metric calculation process.

This approach allows researchers to determine if the natural groupings in the data correspond to human-defined classes, even before extensive labeling occurs.

Key Results and Insights

The study evaluated various representations (BERT, GloVe, fastText, BoW) across four text classification datasets: IMDB, Sentiment140, WikiToxic, and CivilComments.

Alignment vs. Geometry

The most significant finding is that task alignment is a near-perfect predictor of few-shot performance. The correlation between THAS and the Area under the Learning Curve (ALC) reached a Spearman’s $r_s$ of 0.99. In contrast, unsupervised geometric metrics like the Adjusted Davies-Bouldin Index (ADBI), which measure cluster quality without labels, showed a negligible correlation of 0.07.

Correlation between few-shot performance (ALC) and alignment (THAS) vs. geometry (ADBI).

BERT’s Structural Advantage

The results provide a structural explanation for BERT's dominance in NLP tasks. BERT (particularly with average pooling) exhibits a latent hierarchy that is significantly better aligned with classification tasks than older methods like fastText or Bag-of-Words. This alignment allows simple classifiers to succeed with very few training examples.

Conclusion and Future Work

The research demonstrates that "good" representations are those whose natural clusters happen to match the task's labels. While THAS currently requires labels for analysis, it serves as a powerful diagnostic tool. Future work may explore applying these insights to active learning—using cluster purity to identify the most informative samples for labeling—and extending the metric to multi-class or sequence-tagging tasks.

Summary updated

BibTeX
@inproceedings{gonzalezgutierrez2023analyzing,
  author = {César González-Gutiérrez and Audi Primadhanty and Francesco Cazzaro and Ariadna Quattoni},
  title = {{Analyzing Text Representations by Measuring Task Alignment}},
  booktitle = {Annual Meeting of the Association for Computational Linguistics},
  year = {2023},
  doi = {10.18653/v1/2023.acl-short.7},
}
Figure