Skip to main content
QUICK REVIEW

[Paper Review] BERT's output layer recognizes all hidden layers? Some Intriguing Phenomena and a simple way to boost BERT

Wei-Tsung Kao, Tsung-Han Wu|arXiv (Cornell University)|Jan 25, 2020
Topic ModelingComputer Science22 references6 citations
TL;DR

This paper discovers that BERT's output layer can reconstruct input tokens from hidden representations of any layer—despite never being trained on them—revealing surprising representational similarity across layers. By simply duplicating layers in pre-trained BERT models (no retraining), the method boosts performance on downstream NLP tasks like SQuAD 2.0 and SNLI, with gains of up to 1.5 F1 points and 0.6% accuracy, respectively, even when using the same hyperparameters as baseline models.

ABSTRACT

Although Bidirectional Encoder Representations from Transformers (BERT) have achieved tremendous success in many natural language processing (NLP) tasks, it remains a black box. A variety of previous works have tried to lift the veil of BERT and understand each layer's functionality. In this paper, we found that surprisingly the output layer of BERT can reconstruct the input sentence by directly taking each layer of BERT as input, even though the output layer has never seen the input other than the final hidden layer. This fact remains true across a wide variety of BERT-based models, even when some layers are duplicated. Based on this observation, we propose a quite simple method to boost the performance of BERT. By duplicating some layers in the BERT-based models to make it deeper (no extra training required in this step), they obtain better performance in the downstream tasks after fine-tuning.

Motivation & Objective

  • To investigate whether BERT's output layer can reconstruct input sequences from hidden states of intermediate layers, despite not being trained on them.
  • To explore the representational similarity across BERT’s hidden layers by probing with the pre-trained output head.
  • To develop and evaluate a simple, training-free method to improve BERT-based models by increasing depth through layer duplication.
  • To assess whether this depth augmentation improves performance on downstream NLP tasks such as text classification, natural language inference, and question answering.
  • To examine the impact of layer duplication on ensemble methods and model generalization.

Proposed method

  • The pre-trained BERT output layer (MLM head) is used as a decoder to reconstruct input token sequences from hidden representations of each layer, without any additional training.
  • The method evaluates token-level accuracy of reconstructed sequences when each layer's output is fed into the output layer.
  • Layer duplication is applied by inserting copies of existing layers (e.g., duplicating first three layers in BERT-base) to increase model depth, without tying weights.
  • The deeper models are fine-tuned on downstream tasks using the same hyperparameters as the baseline, enabling direct performance comparison.
  • Ensemble models are created by summing output probabilities from multiple models with different duplicated layer configurations to boost performance.
  • Experiments are conducted on BERT-base, ALBERT-base, ALBERT-large, ALBERT-xlarge, and ALBERT-xxlarge using SST-2, SNLI, and SQuAD 2.0 datasets.

Experimental results

Research questions

  • RQ1Can BERT’s output layer reconstruct the original input sequence from hidden representations of any intermediate layer, despite not being trained on them?
  • RQ2Do hidden representations across different BERT layers have sufficiently similar distributions to be decoded by the same output layer?
  • RQ3Does duplicating layers in a pre-trained BERT model improve downstream performance without retraining or hyperparameter tuning?
  • RQ4Is the performance gain from layer duplication consistent across different BERT variants and NLP tasks?
  • RQ5Can the layer duplication trick enhance ensemble model performance on challenging benchmarks like SQuAD 2.0?

Key findings

  • The output layer of BERT can reconstruct input sequences from hidden states of all layers with high token-level accuracy, even though it was only trained on the final layer’s representations.
  • This reconstruction ability holds across multiple BERT variants, including ALBERT, indicating strong representational similarity across layers.
  • Duplicating layers in pre-trained BERT models leads to consistent performance improvements on SQuAD 2.0 and SNLI, with a 1.5 F1 score boost and 0.6% accuracy gain on SNLI, respectively.
  • The performance gain is achieved without any additional training or hyperparameter tuning, using the same settings as the baseline models.
  • Ensemble models combining multiple duplicated-layer variants achieve further performance gains on SQuAD 2.0, with the best ensemble reaching 85.50 EM and 88.59 F1.
  • The method shows no improvement on SST-2, likely due to the task’s simplicity and high baseline performance, leaving little room for enhancement.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.