Ditto: A Simple and Efficient Approach to Improve Sentence Embeddings

Qian Chen, Wen Wang, Qinglin Zhang, Siqi Zheng, Chong Deng +4 more
5/18/2023
cs.CL

No official code found. Best implementation: alibaba-damo-academy/SpokenNLP (128 stars, Apache-2.0, PyTorch, last commit 2026-03-11).

Abstract

Prior studies diagnose the anisotropy problem in sentence representations from pre-trained language models, e.g., BERT, without fine-tuning. Our analysis reveals that the sentence embeddings from BERT suffer from a bias towards uninformative words, limiting the performance in semantic textual similarity (STS) tasks. To address this bias, we propose a simple and efficient unsupervised approach, Diagonal Attention Pooling (Ditto), which weights words with model-based importance estimations and computes the weighted average of word representations from pre-trained models as sentence embeddings. Ditto can be easily applied to any pre-trained language model as a postprocessing operation. Compared to prior sentence embedding approaches, Ditto does not add parameters nor requires any learning. Empirical evaluations demonstrate that our proposed Ditto can alleviate the anisotropy problem and improve various pre-trained models on STS tasks.

View on arXivView PDF

Code Implementations(1)

PyTorchApache-2.0

A wide variety of research projects developed by the SpokenNLP team of Speech Lab, Alibaba Group.

12812Shell, PythonNov 25, 20227 months agoApache-2.0
deep-learningmachine-learningnatural-language-processingnlppython+1 more

Cite this paper

@article{chen2023ditto,
  title  = {Ditto: A Simple and Efficient Approach to Improve Sentence Embeddings},
  author = {Qian Chen and Wen Wang and Qinglin Zhang and Siqi Zheng and Chong Deng and Hai Yu and Jiaqing Liu and Yukun Ma and Chong Zhang},
  year   = {2023},
  eprint = {2305.10786},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2305.10786v2}
}

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/2305.10786.svg)](https://codeofpaper.com/paper/2305.10786)

Discussion