Sentence-T5: Scalable Sentence Encoders from Pre-trained Text-to-Text Models
This paper explores sentence embeddings from T5, proposing three extraction methods, outperforming Sentence-BERT and SimCSE, with scaling improving performance.
Key Findings
Methodology
The study investigates three approaches to derive sentence embeddings from pretrained T5: two use only the encoder with different pooling strategies (first token and mean pooling), and one employs the full encoder-decoder architecture by taking the decoder's first output. A new benchmark, SentGLUE, extends SentEval to nine tasks for transfer evaluation. Results show that encoder-only models outperform existing SOTA models like Sentence-BERT and SimCSE in transfer tasks, including semantic textual similarity (STS). Scaling from millions to billions of parameters yields consistent gains. Fine-tuning with contrastive learning further enhances embedding quality, especially on STS, establishing new state-of-the-art.
Key Results
- Unsupervised T5 embeddings, especially mean pooling, outperform SimCSE-RoBERTa on transfer tasks, with 11B models reaching 90.46 on STS. Fine-tuned models with contrastive loss surpass previous models, achieving 84.94 on STS. Larger models consistently improve transfer and similarity scores, demonstrating the benefits of scaling. Encoder-only models show better generalization at larger sizes, while encoder-decoder models excel on STS, indicating complementary strengths.
- Pretraining on multi-task data endows T5 with rich representations, and simple pooling strategies already outperform many baselines. Contrastive fine-tuning significantly boosts performance, with multi-stage training (QA + NLI) providing further gains. The results confirm that larger models and contrastive learning synergistically improve sentence embeddings, enabling more accurate semantic retrieval and understanding.
- The experiments validate that scaling models from hundreds of millions to tens of billions of parameters enhances transferability and similarity tasks. The encoder-only approach benefits from larger embedding sizes, while decoder-based methods add further improvements. These findings suggest a promising direction for building scalable, high-quality sentence representations using large pretrained models.
Significance
This research pioneers the application of large-scale T5 models for sentence embedding, demonstrating that model size and contrastive learning substantially improve semantic representations. It addresses key limitations of previous encoder-only methods, offering a scalable, versatile approach suitable for retrieval, semantic search, and downstream NLP tasks. The establishment of SentGLUE provides a comprehensive benchmark for future studies, fostering progress in sentence-level understanding. The results highlight the importance of model scaling and multi-task pretraining, setting new standards for semantic similarity and transfer performance, and opening avenues for deploying large models in real-world applications.
Technical Contribution
The key technical innovations include: (1) three novel methods for extracting sentence embeddings from T5, leveraging encoder-only pooling and decoder outputs; (2) a comprehensive benchmark (SentGLUE) for transfer evaluation; (3) multi-stage contrastive fine-tuning on QA and NLI datasets; (4) systematic scaling experiments from millions to billions of parameters, demonstrating performance gains. The work also explores the impact of model architecture choices, revealing that encoder-only models scale better for transfer, while encoder-decoder models excel in similarity tasks, providing insights into model design for sentence representations.
Novelty
This is the first comprehensive study applying large-scale T5 models to sentence embedding tasks. Unlike prior works limited to BERT-based models, this research leverages the full T5 architecture, introduces new extraction strategies, and systematically evaluates the impact of scale and fine-tuning. The combination of multi-task pretraining, contrastive learning, and large model scaling offers a novel pathway to high-quality, scalable sentence representations, filling a significant gap in the literature.
Limitations
- Despite scaling, embeddings still suffer from anisotropy issues, especially in raw form, requiring further regularization or contrastive training. Large models demand substantial computational resources, limiting accessibility.
- The current methods rely heavily on fine-tuning with labeled data, which can be costly and domain-specific. Generalization to specialized fields or low-resource languages remains challenging.
- The decoder's contribution, while beneficial, is not fully exploited in the current setup, suggesting room for architectural improvements or training strategies to better leverage the encoder-decoder synergy.
Future Work
Future directions include developing more efficient fine-tuning techniques to reduce resource requirements, exploring multi-modal extensions integrating visual or audio data, and adapting methods for low-resource languages. Further research on embedding regularization to mitigate anisotropy and collapse phenomena is also promising. Additionally, scaling models beyond 11B parameters and investigating their impact on diverse NLP tasks will be valuable for advancing semantic understanding.
AI Executive Summary
This paper marks a significant advance in the development of sentence embeddings by systematically exploring large-scale T5 models. The authors introduce three extraction strategies—two based on encoder pooling and one leveraging the decoder’s initial output—demonstrating that large models, especially those scaled to 11 billion parameters, can produce superior sentence representations. They establish SentGLUE, a comprehensive benchmark extending SentEval to nine tasks, to evaluate transfer performance. Results show that even without fine-tuning, T5 embeddings outperform existing models like Sentence-BERT and SimCSE, with mean pooling on the encoder achieving high transfer scores.
Fine-tuning with contrastive learning further boosts performance, especially on semantic textual similarity tasks, where the encoder-decoder approach achieves a new state-of-the-art with a score of 84.94. The study reveals that larger models consistently improve transfer and similarity metrics, confirming the benefits of scaling. Notably, encoder-only models exhibit better generalization at large scales, while encoder-decoder models excel in similarity tasks, indicating complementary strengths.
The research underscores the importance of multi-task pretraining and contrastive fine-tuning, providing a scalable framework for high-quality sentence representations. These findings have broad implications for NLP applications such as semantic search, question answering, and content retrieval, where efficient and accurate sentence embeddings are critical. Despite the promising results, challenges remain, including computational costs and anisotropy issues, which warrant further investigation. Overall, this work paves the way for leveraging massive pretrained models in semantic understanding, setting new standards for sentence-level NLP tasks.
Deep Analysis
Background
Recent years have seen rapid growth in pretrained language models like BERT, RoBERTa, and ELECTRA, which have significantly advanced sentence embedding techniques. Early methods such as InferSent and S-BERT used supervised or fine-tuned approaches to generate sentence vectors, achieving high accuracy in semantic similarity and transfer tasks. The advent of contrastive learning, exemplified by SimCSE, further improved embedding quality by optimizing distance properties. Meanwhile, T5 introduced a unified text-to-text framework trained on multi-task objectives, excelling in generative tasks and broad NLP benchmarks. However, its potential for sentence-level representation remained underexplored. This study bridges this gap by systematically evaluating T5's capacity to produce high-quality sentence embeddings, leveraging large-scale pretraining and contrastive fine-tuning.
Core Problem
Despite T5’s success in various NLP tasks, extracting effective sentence embeddings from its architecture poses challenges. The absence of a dedicated [CLS] token and the anisotropy of embeddings hinder direct use. Existing approaches often rely on task-specific fine-tuning, which limits generality and efficiency. Furthermore, scaling models to billions of parameters raises questions about the transferability and robustness of the resulting embeddings. Addressing these issues requires developing universal extraction methods, understanding the impact of model size, and designing training strategies that mitigate embedding collapse, all while maintaining computational feasibility.
Innovation
The core innovations include: 1) proposing three extraction methods—encoder-first token, mean pooling, and decoder-first output—tailored for T5’s architecture; 2) establishing SentGLUE, a comprehensive benchmark for sentence transfer tasks; 3) employing multi-stage contrastive learning on QA and NLI datasets to enhance embedding quality; 4) systematically scaling models from hundreds of millions to tens of billions of parameters, demonstrating performance gains. These innovations collectively enable the first large-scale application of T5 for sentence embeddings, surpassing prior encoder-only models and setting new benchmarks.
Methodology
- �� Design three extraction strategies: encoder-only first token, mean pooling, decoder-first output. • Initialize dual encoders from pre-trained T5, add projection and normalization layers. • Use contrastive loss with positive and negative pairs, employing in-batch sampling and multi-stage training on QA and NLI data. • Fine-tune models with large batch sizes (512-2048), optimizer Adafactor, learning rate 0.001, temperature τ=0.01. • Evaluate embeddings on SentEval and SentGLUE, focusing on transfer accuracy and Spearman correlation on STS. • Scale models from 110M to 11B parameters, analyzing the impact of size on performance.
Experiments
The experiments utilize web question-answer pairs and SNLI datasets for multi-stage training, with TPU-v8 hardware. Baselines include BERT, RoBERTa, and existing SOTA models. Hyperparameters such as learning rate, batch size, and temperature are carefully tuned. The evaluation covers transfer tasks (classification accuracy) and semantic similarity (Spearman’s correlation). Ablation studies compare extraction methods, model sizes, and fine-tuning strategies. Results show that larger models and contrastive training significantly improve performance, validating the approach’s scalability and robustness.
Results
Unsupervised mean pooling on 11B models achieves 90.46 on STS, outperforming previous models. Fine-tuned models with contrastive loss reach 84.94, establishing new SOTA. Encoder-only models scale better for transfer tasks, while encoder-decoder models excel in similarity metrics. The results confirm that larger models and multi-stage training synergistically enhance embedding quality, with performance improvements consistent across datasets. These findings demonstrate the effectiveness of combining scale, architecture, and contrastive learning for high-quality sentence representations.
Applications
The high-quality embeddings can be directly applied to semantic search engines, question-answering systems, and content recommendation platforms. They enable fast retrieval and accurate semantic matching across large corpora. In industry, such embeddings facilitate intelligent information retrieval, content filtering, and multilingual understanding. Future integration with multimodal data could further expand their utility, supporting applications like cross-modal retrieval and multimedia understanding, transforming how machines interpret human language.
Limitations & Outlook
Despite scaling, embeddings still face anisotropy and collapse issues, especially in raw form, requiring additional regularization. Large models demand substantial computational resources, limiting deployment in resource-constrained environments. Fine-tuning relies on labeled data, which can be costly and domain-specific, restricting generalization. Further research is needed to develop more efficient training, better regularization techniques, and methods to extend applicability to low-resource languages and specialized domains.
Plain Language Accessible to non-experts
想象你在一个厨房里,厨师需要用不同的工具和配料做出一道美味的菜。每次做菜,厨师都要记住各种材料的特点和用法。以前,厨师用笔记本记这些信息,但很慢,也容易忘记。现在,厨师得到了一台超级智能的厨房机器人,它可以通过学习大量菜谱,快速理解每种材料的特性。这个机器人可以在几秒钟内告诉你,哪种调料适合哪道菜,哪种食材可以搭配。随着它学习的内容越来越多,变得越来越聪明,做菜的速度和质量都大大提高。这就像是给厨房配备了一个超级大脑,让整个厨房变得更高效、更聪明。
ELI14 Explained like you're 14
想象你在学校里,有很多朋友,每个人都喜欢不同的游戏、说话的方式也不一样。现在,你想用一种特别的方法,快速记住每个朋友的特点,这样以后遇到他们就能马上知道他们喜欢什么。以前的方法就像用笔记本记,每次都要翻半天;现在的方法就像有个超级聪明的机器人,能一眼看出朋友的喜好。这个研究就像教这个机器人变得更聪明,让它用更少的时间,记住更多朋友的特点。它通过学习很多朋友的资料,变得越来越厉害。最后,这个机器人能在几秒钟内,告诉你哪个朋友喜欢什么,哪个朋友的性格最像。这让我们在找朋友、玩游戏、学习时都变得更方便、更有趣啦!
Abstract
We provide the first exploration of sentence embeddings from text-to-text transformers (T5). Sentence embeddings are broadly useful for language processing tasks. While T5 achieves impressive performance on language tasks cast as sequence-to-sequence mapping problems, it is unclear how to produce sentence embeddings from encoder-decoder models. We investigate three methods for extracting T5 sentence embeddings: two utilize only the T5 encoder and one uses the full T5 encoder-decoder model. To support our investigation, we establish a new sentence representation transfer benchmark, SentGLUE, which extends the SentEval toolkit to nine tasks from the GLUE benchmark. Our encoder-only models outperforms Sentence-BERT and SimCSE sentence embeddings on both SentEval and SentGLUE transfer tasks, including semantic textual similarity (STS). Scaling up T5 from millions to billions of parameters is found to produce consistent further improvements. Finally, our encoder-decoder method achieves a new state-of-the-art on STS when using sentence embeddings. Our models are released at https://tfhub.dev/google/collections/sentence-t5/1.