Once is Enough: A Light-Weight Cross-Attention for Fast Sentence Pair Modeling

Yuanhang Yang, Shiyi Qi, Chuanyi Liu, Qifan Wang, Cuiyun Gao +1 more
10/11/2022
cs.CLcs.AI
transformer-attention

Official code: ysngki/MixEncoder (2 stars, Python, last commit 2023-10-16).

Abstract

Transformer-based models have achieved great success on sentence pair modeling tasks, such as answer selection and natural language inference (NLI). These models generally perform cross-attention over input pairs, leading to prohibitive computational costs.

Show full abstract

Recent studies propose dual-encoder and late interaction architectures for faster computation. However, the balance between the expressive of cross-attention and computation speedup still needs better coordinated. To this end, this paper introduces a novel paradigm MixEncoder for efficient sentence pair modeling. MixEncoder involves a light-weight cross-attention mechanism. It conducts query encoding only once while modeling the query-candidate interaction in parallel. Extensive experiments conducted on four tasks demonstrate that our MixEncoder can speed up sentence pairing by over 113x while achieving comparable performance as the more expensive cross-attention models.

View on arXivView PDF

Code Implementations(1)

ysngki/MixEncoderOfficial100%
22PythonOct 16, 20233 years ago

Similar Papers

Cite this paper

@article{yang2022once,
  title  = {Once is Enough: A Light-Weight Cross-Attention for Fast Sentence Pair Modeling},
  author = {Yuanhang Yang and Shiyi Qi and Chuanyi Liu and Qifan Wang and Cuiyun Gao and Zenglin Xu},
  year   = {2022},
  eprint = {2210.05261},
  archivePrefix = {arXiv},
  url    = {https://arxiv.org/abs/2210.05261}
}

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

Discussion