Source-linked AI summary

When BERT Plays the Lottery, All Tickets Are Winning

Sai Prasanna, Anna Rogers, Anna Rumshisky

arXiv:2005.00561v2cs.CLcs.LG

TL;DR

Fine-tuned BERT raises the question of whether only particular pretrained subnetworks are needed for task performance. The paper compares magnitude and structured pruning while examining the linguistic character of successful subnetworks. It finds subnetworks comparable to the full model, yet structured-pruned subnetworks remain broadly trainable and good subnetworks are unstable.

  • Problem

    The paper asks whether fine-tuned BERT contains specialized winning subnetworks and whether their success reflects transferable linguistic knowledge.

  • Method

    The authors compare magnitude-based weight pruning with importance-based structured pruning of BERT attention heads and MLPs across GLUE fine-tuning.

  • Results

    Good subnetworks reach performance comparable to the full model, while structured pruning leaves even random and worst subnetworks highly trainable.

  • Takeaways & Limitations

    Most pretrained BERT weights are potentially useful in fine-tuning, and good-subnetwork success is not explained by stable meaningful patterns in individual attention heads.

  • Takeaways & Limitations

    The analysis does not exclude linguistic information encoded in combinations of BERT elements, and its pattern counts are only crude upper-bound estimates.

Abstract

from arXiv · show

Large Transformer-based models were shown to be reducible to a smaller number of self-attention heads and layers. We consider this phenomenon from the perspective of the lottery ticket hypothesis, using both structured and magnitude pruning. For fine-tuned BERT, we show that (a) it is possible to find subnetworks achieving performance that is comparable with that of the full model, and (b) similarly-sized subnetworks sampled from the rest of the model perform worse. Strikingly, with structured pruning even the worst possible subnetworks remain highly trainable, indicating that most pre-trained BERT weights are potentially useful. We also study the "good" subnetworks to see if their success can be attributed to superior linguistic knowledge, but find them unstable, and not explained by meaningful self-attention patterns.

1 Introduction

This study examines fine-tuned BERT through the lottery ticket hypothesis, comparing magnitude-based and structured pruning. It finds high-performing subnetworks, but also strong trainability among many other subnetworks and instability in the apparently good ones.

  • The authors systematically test the lottery ticket hypothesis in fine-tuned BERT across GLUE tasks.
  • Magnitude-based and importance-based pruning identify subnetworks reaching 90% of full-model performance.The structured approach prunes self-attention heads and extends importance-based pruning to MLPs.
  • Similarly sized subnetworks sampled from other model regions perform considerably worse than the identified good subnetworks.
  • Even bad subnetworks can often be re-initialized with pretrained BERT weights and fine-tuned to achieve strong performance.
  • Good subnetworks are unstable across fine-tuning initializations, and their attention heads do not necessarily encode meaningful linguistic patterns.

2 Related Work

Prior work established BERT’s overparameterization and the relevance of lottery-ticket ideas, but earlier lottery-ticket studies focused on random initializations. This paper extends that investigation to pretrained BERT and considers subnetworks as possible tools for understanding its operation.

  • BERT components can be ablated with little performance loss, motivating compression studies.
  • Earlier lottery-ticket work focused on winning random initializations rather than pretrained BERT weights.
  • This paper and concurrent work are among the first to study lottery-ticket behavior when pretrained BERT is paired with a randomly initialized task-specific classifier.
  • The authors additionally study structured pruning and whether good subnetworks can help explain how BERT works.
  • Analyzing good subnetworks is motivated by uncertainty about which pretrained knowledge BERT uses for inference and by extensive probing of its architectural blocks.

3 Methodology

The methodology fine-tunes BERT-base on nine GLUE tasks and compares iterative magnitude pruning with structured pruning of attention heads and MLPs. Masks are selected while retaining at least 90% of full-model performance, using weight magnitude or loss sensitivity.

  • Experimental setup: Experiments use uncased BERT-base, nine GLUE tasks, dev-set evaluation, and five random seeds per experiment.Test sets were not publicly distributed, so evaluation uses dev sets.
  • BERT architecture: Attention is a multi-head block whose independently parameterized heads are summed, while each layer’s MLP applies two feed-forward layers separately to vectors.
  • Magnitude pruning: Magnitude pruning iteratively removes 10% of the lowest-magnitude non-embedding weights while performance remains above 90% of the full fine-tuned model.
  • Structured pruning: Structured pruning masks attention heads and MLP blocks using binary variables while enforcing retention of at least 90% of full-model performance.
  • Diagnostics: The QNLI visualization reports surviving weights for magnitude pruning and survival across random seeds for structured pruning.
  • Structured pruning: Head and MLP importance scores are computed from expected loss sensitivity and used to prune 10% of heads and one MLP with the smallest scores.

4 BERT Plays the Lottery

The study tests lottery-ticket subnetworks in fine-tuned BERT using magnitude-based and structured pruning, comparing good, random, and bad subnetworks across GLUE tasks. Good subnetworks can be retrained successfully, but structured pruning shows that even bad subnetworks retain substantial trainability and useful information.

  • Pruning patterns: 42-57% of weights are removed across architecture blocks with magnitude pruning, while structured pruning concentrates important heads in earlier and middle layers and important MLPs in middle layers.Magnitude pruning removes more weights from earlier layers; structured pruning reveals different survival patterns for heads and MLPs.
  • Pruning patterns: Pruning heads and MLPs together produces smaller subnetworks than pruning either component separately, suggesting interaction between self-attention heads and MLPs.When pruned separately, 49% of heads and 75% of MLPs remain, compared with 22% and 50% when pruned together.
  • Good, random, and bad subnetworks: For 7 out of 9 tasks, magnitude pruning removes 10-15% more weights than structured pruning, while its smaller subnetworks mostly reach full-model performance.Structured-pruned good subnetworks are mostly slightly behind the full model, whereas random structured subnetworks often perform on par with good ones.
  • Stability and limitations: WNLI results are unreliable because similar train and development sentences have opposite labels, and structured pruning removes the whole model.This dataset is excluded from reliable interpretation in the reported pruning comparisons.
  • Good, random, and bad subnetworks: Structured-pruned bad subnetworks are comparable to BiLSTM baselines, while magnitude-pruned bad subnetworks trail structured-pruned ones by at least 5 points on 6/9 tasks.The structured-pruned bad subnetwork is competitive with BiLSTM+GloVe in 5/9 tasks, loses substantially in 2, and wins in 2.
  • Good, random, and bad subnetworks: Randomly initialized, randomly pruned BERT is over 15 points behind the structured-pruned bad mask over pretrained weights on average, showing that pretrained components retain useful information.The paper concludes that some lottery tickets yield the largest gains, but all subnetworks contain a non-trivial amount of useful information.
  • Stability and limitations: Bad and random structured-pruned subnetworks show standard deviations over 10 points across several GLUE tasks, including MNLI and SST-2.The variability occurs not only on smaller datasets such as MRPC, CoLA, and STS-B, but also on larger datasets.

5 Interpreting BERT’s Subnetworks

The “good” subnetworks are unstable across fine-tuning runs and do not preferentially encode non-trivial linguistic relations in individual self-attention heads. Their cross-task overlaps are present but do not clearly reflect shared linguistic patterns or task type.

  • 5.1 Stability of the “Good” Subnetworks: Fleiss’ kappa ranged from 0.15-0.32 across five random seeds, indicating unstable head survival in the “good” subnetworks.Cochran Q tests found no significant similarity of the five-seed head-survival masks at α = 0.05.
  • 5.1 Stability of the “Good” Subnetworks: Most heads and MLPs had low importance scores at each pruning iteration, so many could be pruned with about equal success.This score distribution helps explain why the subnetworks selected across random initializations are unstable.
  • 5.2 How Linguistic are the “Good” Subnetworks?: The analysis classified attention maps as diagonal, block, vertical, vertical+diagonal, or heterogeneous, using heterogeneous attention as an upper-bound estimate for non-trivial linguistic information.A six-layer CNN classified 100 generated attention maps per GLUE task using 400 annotated maps for training.
  • 5.2 How Linguistic are the “Good” Subnetworks?: Super-survivor heads did not preferentially encode heterogeneous, non-trivial linguistic relations in either raw or normed self-attention.Raw patterns contained more block and vertical attention, while norming increased diagonal patterns and left vertical attention prominent for three tasks.
  • 5.2 How Linguistic are the “Good” Subnetworks?: Super-survivor heads showed little association with heterogeneous attention: Pearson’s correlation was 0.015 for raw and 0.025 for normed attention.Many important heads instead had diagonal patterns, which the authors describe as seemingly redundant.
  • 5.3 Information Shared Between Tasks: Good-subnetwork overlaps exceeded expectations under complete head independence in some task pairs but were not particularly large overall.MRPC and QNLI shared over half of their good subnetworks; the overlaps were not explained by individual linguistic patterns or task type.

6 Discussion

The study confirms lottery-ticket behavior for pre-trained BERT under magnitude and structured pruning, while revealing that even structured-pruned bad subnetworks remain strong. The instability and weak linguistic interpretability of good subnetworks make broad explanations based on selected individual components unlikely, leaving open whether useful information lies in component combinations.

  • The study confirms the main lottery ticket hypothesis prediction for pre-trained BERT with both magnitude-based and structured pruning.
  • Structured-pruned random subnetworks were almost as good as good subnetworks, and even the worst subnetworks performed on par with a strong baseline.This suggests that weights removed by pruning are not simply inactive.
  • Whether bad subnetworks succeed because they retain linguistic knowledge or because GLUE tasks are easy remains an open question.The authors consider the latter explanation more likely because good subnetworks were neither stable nor enriched for interpretable heads.
  • The authors question whether transfer success in BERT and related Transformers reflects better language knowledge or properties such as flatter and wider optimization optima.They also ask whether similar loss landscapes can result from non-linguistic pre-training tasks.

7 Conclusion

The study finds that pruned BERT subnetworks can match full-model performance, while structured-pruning results suggest most pre-trained weights remain useful. The identified good subnetworks are unstable and are not explained by distinctive linguistic patterns in individual heads.

  • Pruned “good” subnetworks reach performance comparable with the full model, whereas “bad” subnetworks generally do not.
  • Under structured pruning, even “bad” subnetworks can be fine-tuned separately to achieve fairly strong performance.
  • The good subnetworks are unstable across fine-tuning runs, and their success is not attributable exclusively to non-trivial linguistic patterns in individual self-attention heads.
  • The findings suggest that most pre-trained BERT weights are potentially useful and that success may relate more to optimization surfaces than specific linguistic knowledge.
  • The study reports 115.644 kg of CO2eq emissions and 249.068 kWh of electricity use.

B Iterative Pruning Modes

The appendix compares iterative structured-pruning modes that remove attention heads, MLPs, or both according to importance scores. The combined strategy prunes heads and MLPs until performance remains within 90% of the development-set threshold, then continues component-wise pruning.

  • Iterative Pruning Modes: Heads-only pruning removes the lowest-importance unmasked heads in each iteration, up to 144 heads in full BERT-base.
  • Iterative Pruning Modes: MLP-only pruning iteratively masks the remaining MLP with the smallest importance score.
  • Iterative Pruning Modes: Heads-and-MLPs pruning computes both importance scores in one backward pass and removes 10% of heads plus one lowest-scoring MLP per iteration.
  • Iterative Pruning Modes: The combined strategy first prunes until development-set performance is within 90%, then continues with heads-only and MLP-only pruning.
  • Survival Statistics: Figure 15 reports each surviving head or MLP’s average number of GLUE tasks and standard deviation across five fine-tuning initializations.
  • Evaluation: Table 3 reports GLUE-task metric means and standard deviations evaluated across five seeds.

D Longer Fine-tuning of “Bad” s-pruned Subnetworks

Figure 16 compares mean GLUE-task metrics across epochs using five evaluation seeds, with the best result bolded. Its metrics may differ slightly from earlier reports because it uses a new fine-tuning run.

  • Mean GLUE-task metrics are evaluated across five seeds at different training epochs.
  • The best metric at each comparison is bolded.
  • Slight metric divergence from previously reported values reflects a new fine-tuning run.

E Performance of the “Super Survivor” Subnetworks

The super-survivor experiment compares very small good, bad, and random subnetworks and examines whether their success reflects unique linguistic information. Across many tasks, non-good subnetworks perform nearly as well, while attention-pattern analysis tests for distinctive behavior.

  • Subnetwork Construction: The experiment compares good, bad, and random subnetworks of the same size.Good subnetworks contain super-survivor heads and MLPs; bad and random subnetworks are selected from other elements.
  • Subnetwork Construction: Good subnetworks contain components surviving across all random seeds and occupy 10-30% of the full model, versus 50-70% for earlier pruned subnetworks.
  • Performance: On 6 out of 9 tasks, bad and random subnetworks behave nearly as well as the good subnetworks.
  • Performance: This result suggests that super-survivor heads and MLPs did not survive importance pruning because they encoded unique linguistic information necessary for GLUE performance.
  • Attention-Pattern Analysis: Two separately trained CNN classifiers analyze raw and weight-normed BERT attention maps using annotated attention patterns.
  • Attention-Pattern Analysis: The analysis compares full and super-survivor-pruned BERT across pre-training and fine-tuning, reporting attention-pattern fractions over 100 development samples, tasks, and five seeds.
  • Attention-Pattern Analysis: Figure 18 shows the attention-pattern distributions for all BERT self-attention heads and super-survivor heads.

G How Task-independent are the “Good” Subnetworks?

The “good” subnetworks are examined for task-specific and shared components across GLUE tasks, using pairwise comparisons of surviving heads and MLPs under structured pruning.

  • Task overlap: Task-specific components that consistently survive fine-tuning runs may encode information useful for their associated tasks.The proposed overlap analysis is intended to characterize task relationships, including information that is not deeply linguistic.
  • Comparison setup: Figure 19 compares GLUE tasks by the number of shared heads and MLPs in “good” subnetworks and super-survivors.The comparison covers structured-importance-pruned subnetworks and components surviving across all random seeds.
  • Figure interpretation: Each Figure 19 cell reports the average number of surviving heads out of 144 or layers out of 12, with standard deviation across 5 random initializations.The diagonal represents architecture components surviving for a given task, while remaining elements represent components common across GLUE tasks.
Loading 2005.00561v2…