Don't Judge a Language Model by Its Last Layer: Contrastive Learning with Layer-Wise Attention Pooling

Dongsuk Oh, Yejin Kim, Hodong Lee, H. Howie Huang, Heuiseok Lim
9/13/2022
cs.CLcs.AI
contrastive-ssl

Official code: nlpods/LayerAttPooler (9 stars, Python, last commit 2022-11-04).

Abstract

Recent pre-trained language models (PLMs) achieved great success on many natural language processing tasks through learning linguistic features and contextualized sentence representation. Since attributes captured in stacked layers of PLMs are not clearly identified, straightforward approaches such as embedding the last layer are commonly preferred to derive sentence representations from PLMs.

Show full abstract

This paper introduces the attention-based pooling strategy, which enables the model to preserve layer-wise signals captured in each layer and learn digested linguistic features for downstream tasks. The contrastive learning objective can adapt the layer-wise attention pooling to both unsupervised and supervised manners. It results in regularizing the anisotropic space of pre-trained embeddings and being more uniform. We evaluate our model on standard semantic textual similarity (STS) and semantic search tasks. As a result, our method improved the performance of the base contrastive learned BERT_base and variants.

View on arXivView PDF

Code Implementations(1)

Don't Judge a Language Model by Its Last Layer: Contrastive Learning with Layer-Wise Attention Pooling

90Python, ShellSep 6, 20224 years ago

Similar Papers

Cite this paper

@article{oh2022dont,
  title  = {Don't Judge a Language Model by Its Last Layer: Contrastive Learning with Layer-Wise Attention Pooling},
  author = {Dongsuk Oh and Yejin Kim and Hodong Lee and H. Howie Huang and Heuiseok Lim},
  year   = {2022},
  eprint = {2209.05972},
  archivePrefix = {arXiv},
  url    = {https://arxiv.org/abs/2209.05972}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2209.05972.svg)](https://codeofpaper.com/paper/2209.05972)

Discussion