TL;DR
This paper investigates what linguistic features make neural language models (NLMs) like BERT and GPT-2 assign low probabilities (high perplexity) to sentences. By analyzing a wide range of linguistic features, the authors found that while both models are sensitive to similar syntactic and morphosyntactic phenomena, GPT-2's perplexity is more influenced by lexical properties, whereas BERT's is more affected by sentence length and global syntactic structure.
What Problem Does This Paper Address?
Perplexity is a standard metric for evaluating language models, but its relationship with the linguistic knowledge encoded within these models is not fully understood. Previous work has shown a dissociation between a model's perplexity and its performance on specific linguistic tasks, suggesting that low perplexity doesn't automatically equate to strong linguistic competence. This paper aims to bridge this gap by exploring which specific linguistic characteristics of a sentence contribute to its perplexity score, moving beyond simple sentence length and controlled syntactic variations to analyze sentences from real-world usage. The goal is to understand how the internal linguistic representations of models like BERT and GPT-2 are reflected in their perplexity scores.
Methods
The researchers employed a two-pronged approach:
- Correlation Analysis: They first computed sentence-level perplexity scores for both BERT (using a masked language model approach) and GPT-2 (a traditional autoregressive model). They then measured the Spearman correlation between these scores to see how well the models' perplexity predictions align.
- Linguistic Feature Regression: They curated a comprehensive set of 78 linguistic features, categorized into 9 groups (e.g., raw text properties, morphosyntactic information, syntactic tree structures, use of subordination). They then trained Linear Support Vector Regression (LinearSVR) models to predict the perplexity scores of BERT and GPT-2 using these linguistic features. To isolate the impact of individual features, they also trained separate models for each feature.
Datasets
The experiments were conducted on three English Universal Dependencies (UD) treebanks:
- ParTUT (Sanguinetti and Bosco, 2015)
- GUM corpus (Zeldes, 2017)
- English Web Treebank (EWT) (Silveira et al., 2014)
The combined dataset comprised 22,505 sentences.
Key Insights and Ideas
- BERT and GPT-2 Agree (Mostly): Despite their architectural differences (bidirectional vs. unidirectional), BERT and GPT-2 exhibit a moderate to substantial correlation in their sentence-level perplexity scores. This suggests that their underlying mechanisms for assessing sentence likelihood are not entirely dissimilar.
- Linguistic Features Trump Sentence Length: The linguistic features, when used collectively, significantly outperform sentence length alone in predicting both BERT and GPT-2 perplexities. This highlights that the complexity of a sentence's structure and content, beyond its sheer size, is a crucial factor in how models perceive its probability.
- GPT-2 Loves Lexical Variety, BERT Likes Structure: GPT-2's perplexity is more sensitive to features related to lexical properties, such as vocabulary richness and part-of-speech distributions. In contrast, BERT's perplexity is more strongly influenced by global syntactic features and sentence length.
- Shared Perplexity Drivers: Both models are similarly affected by core morphosyntactic features (like lexical density and pronoun presence) and basic verb structure. This indicates a common ground in what makes sentences "difficult" for these models.
- Shorter Sentences are More Predictive: When analyzing sentences grouped by fixed lengths, shorter sentences generally yielded higher predictive scores for the linguistic features. This is likely because the feature space is more constrained and thus more informative for shorter sequences.
Key Results
- Spearman correlations between BERT and GPT-2 perplexities were consistently moderate to substantial (e.g., 0.63 for all sentences).
- LinearSVR models using all linguistic features outperformed a baseline model using only sentence length, achieving R² scores of 0.38 for BERT and 0.22 for GPT-2 on the full dataset.
- When analyzing individual features, "lexical_density" and "%_upos_PRON" were among the top predictors for both models.
- For GPT-2, features like "lexical_density" and "%_upos_PROPN" were particularly strong predictors.
- For BERT, features related to sentence length and global syntactic structure like "parse_depth" and "clause_length" showed higher predictive power.
Limitations and Future Work
- Correlation vs. Causation: The study identifies features that are predictive of perplexity, but it doesn't definitively establish a causal link or explain the exact mechanism by which these features influence the models' internal representations.
- Model Specificity: While the study compares two prominent models, the findings might not generalize to all types of NLMs.
- Future Work: The authors suggest further investigation into the interaction between features and how these findings can be used to develop more linguistically informed NLP models or to better understand model biases. They also note that the predictive power of features can vary significantly with sentence length, suggesting a need for length-aware analysis.
Summary updated