Skip to main content
QUICK REVIEW

[Paper Review] LRC-BERT: Latent-representation Contrastive Knowledge Distillation for Natural Language Understanding

Hao Fu, Shaojun Zhou|arXiv (Cornell University)|Dec 14, 2020
Topic ModelingComputer Science40 references5 citations
TL;DR

LRC-BERT proposes a novel knowledge distillation framework that uses contrastive learning based on angular distance (COS-NCE) to transfer intermediate layer representations from a BERT teacher to a student model, enhancing knowledge distillation beyond value matching. It further improves robustness via gradient perturbation and uses a two-stage training strategy, achieving state-of-the-art performance on GLUE with improved generalization and stability.

ABSTRACT

The pre-training models such as BERT have achieved great results in various natural language processing problems. However, a large number of parameters need significant amounts of memory and the consumption of inference time, which makes it difficult to deploy them on edge devices. In this work, we propose a knowledge distillation method LRC-BERT based on contrastive learning to fit the output of the intermediate layer from the angular distance aspect, which is not considered by the existing distillation methods. Furthermore, we introduce a gradient perturbation-based training architecture in the training phase to increase the robustness of LRC-BERT, which is the first attempt in knowledge distillation. Additionally, in order to better capture the distribution characteristics of the intermediate layer, we design a two-stage training method for the total distillation loss. Finally, by verifying 8 datasets on the General Language Understanding Evaluation (GLUE) benchmark, the performance of the proposed LRC-BERT exceeds the existing state-of-the-art methods, which proves the effectiveness of our method.

Motivation & Objective

  • To address the limitations of existing knowledge distillation methods in NLP, which focus only on output value matching and ignore structural distribution characteristics of intermediate layer representations.
  • To improve model robustness during distillation training by introducing a gradient perturbation-based architecture, a first in knowledge distillation.
  • To enhance knowledge transfer from teacher to student by designing a two-stage training strategy that prioritizes distributional structure learning in early training.
  • To enable more flexible student model architectures by decoupling student structure from teacher layer constraints, increasing compression flexibility.

Proposed method

  • Introduces a novel contrastive loss, COS-NCE, based on cosine-based noise-contrastive estimation to capture angular similarity between intermediate layer representations, modeling structural distributional features.
  • Employs a two-stage training strategy where the total distillation loss is optimized in stages, initially focusing on intermediate layer distribution learning before incorporating prediction head losses.
  • Applies gradient perturbation to the word embedding layer during training, using gradient values to perturb hidden states and improve model robustness.
  • Combines multiple loss components: KL divergence for soft labels, cross-entropy for hard labels, and COS-NCE for intermediate layer distillation, with adaptive weighting.
  • Uses a dimension transformation matrix to allow flexible student network design, decoupling student architecture from exact layer-by-layer alignment with the teacher.
  • Employs a student model with fewer parameters than the teacher, enabling efficient deployment on edge devices while maintaining high performance.

Experimental results

Research questions

  • RQ1Can contrastive learning based on angular distance improve knowledge distillation in NLP beyond value matching of intermediate representations?
  • RQ2Does gradient perturbation during training enhance the robustness of distilled student models in knowledge distillation?
  • RQ3Can a two-stage training strategy improve the effectiveness of distillation by prioritizing structural distribution learning in early training?
  • RQ4How does the proposed method compare to existing distillation techniques in terms of accuracy, robustness, and compression efficiency on standard benchmarks?

Key findings

  • LRC-BERT achieves state-of-the-art performance on the GLUE benchmark across 8 datasets, outperforming existing distillation methods.
  • The ablation study shows that removing the COS-NCE loss leads to a 4.0% drop in accuracy on the MNLI-m dev set, confirming its critical role in knowledge transfer.
  • The two-stage training method improves performance by 4.0% over the non-staged variant, demonstrating that early focus on distributional structure enhances distillation.
  • Gradient perturbation stabilizes training loss in the second stage, reducing fluctuations and improving model convergence and robustness.
  • The COS-NCE loss effectively captures angular similarity features, enabling correct predictions even when MSE-based baselines fail due to large embedding differences.
  • On the CoLA task, the model shows a 13% improvement over baseline distillation methods, highlighting the benefit of angular-based distillation.

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.