Abstract
This paper studies the relative importance of attention heads in Transformer-based models to aid their interpretability in cross-lingual and multi-lingual tasks. Prior research has found that only a few attention heads are important in each mono-lingual Natural Language Processing (NLP) task and pruning the remaining heads leads to comparable or improved performance of the model. However, the impact of pruning attention heads is not yet clear in cross-lingual and multi-lingual tasks. Through extensive experiments, we show that (1) pruning a number of attention heads in a multi-lingual Transformer-based model has, in general, positive effects on its performance in cross-lingual and multi-lingual tasks and (2) the attention heads to be pruned can be ranked using gradients and identified with a few trial experiments. Our experiments focus on sequence labeling tasks, with potential applicability on other cross-lingual and multi-lingual tasks. For comprehensiveness, we examine two pre-trained multi-lingual models, namely multi-lingual BERT (mBERT) and XLM-R, on three tasks across 9 languages each. We also discuss the validity of our findings and their extensibility to truly resource-scarce languages and other task settings.
Introduction
Transformer-based models like BERT and XLM-R are the workhorses of modern NLP, yet they are notoriously over-parameterized. While research in monolingual settings has shown that many attention heads are redundant, their role in cross-lingual and multi-lingual contexts—where a model trained on one language is applied to another—has been less clear. This study investigates whether pruning these redundant heads can improve performance and interpretability in cross-lingual sequence labeling tasks.
Methodology
The researchers evaluated mBERT and XLM-R on three tasks: Part-of-Speech (POS) tagging, Named Entity Recognition (NER), and Slot Filling (SF) across 9 diverse languages (including Arabic, Chinese, Hebrew, and Urdu). To identify redundant heads, they employed a gradient-based ranking method. After fine-tuning on a source language (e.g., English), they calculated the absolute gradients for each attention head on a development set. Heads with low gradients were deemed less critical and iteratively pruned. This approach was validated against Layer-wise Relevance Propagation (LRP) and random pruning.
Universal Task Heads
A key finding of this research is the existence of "universal" task heads. The study found that the attention heads identified as important for a specific task (such as NER) largely overlap across different languages. This suggests that multi-lingual Transformers learn language-agnostic feature extractors that are specialized for the task rather than the specific language.
Performance Gains and Data Efficiency
Contrary to the intuition that more parameters are always better, pruning often acted as a regularizer, improving cross-lingual performance. By removing "noisy" heads that might overfit to source-language specificities, the models generalized better to target languages.
Furthermore, pruned models demonstrated superior data efficiency. In several language pairs, a pruned model could achieve or exceed the performance of a full model while using significantly less training data in the target language. For instance, in Japanese NER experiments, a pruned model matched the accuracy of the full model while requiring 20% less training data.
Key Results
The experimental results across POS, NER, and Slot Filling tasks were overwhelmingly positive:
- POS Tagging: Pruning improved performance in 88 out of 96 experimental pairs, with average F1 increases of 0.91 for mBERT and 1.78 for XLM-R in cross-lingual settings.
- NER: Pruning provided marginal but consistent gains even on high-performing models (e.g., increasing an F1 from 99.26 to 99.31).
- Slot Filling: Performance improved in 31 out of 34 experiments.
- Validation: Pruning the highest-ranked (most important) heads led to a sharp decline in performance, confirming the accuracy of the gradient-based importance ranking.
Limitations and Future Work
The study primarily focused on token-level sequence labeling tasks. Future research should investigate if these findings extend to sentence-level tasks like Natural Language Inference (NLI) or to larger generative architectures. Additionally, while the study identifies which heads are important, further work is needed to understand the specific linguistic features (syntax vs. semantics) these heads capture in a multi-lingual context.
Summary updated