Making Text Embedders Few-Shot Learners
Chaofan Li, Minghao Qin, Shitao Xiao, Jianlyu Chen, Kun Luo, Defu Lian, Yingxia Shao, Zheng Liu
Abstract
Large language models (LLMs) with decoder-only architectures have demonstrated exceptional text-generation capabilities across a variety of tasks. Some researchers have also adapted these models for text representation tasks. However, in text representation tasks, these models often face performance degradation on unseen tasks. In-context learning (ICL), which leverages examples provided in the input context, enables LLMs to handle unseen tasks effectively. Inspired by this, we aim to fully utilize the inherent properties of LLMs to enhance text representation performance across different tasks through the ICL approach. In this paper, we introduce a simple yet effective training strategy, which significantly improves text representation capabilities. Unlike previous models that prepend task instructions to the text, our method randomly samples a varying number of examples during training, endowing the embedding model with in-context learning abilities while maintaining its zero-shot capabilities. This approach does not require additional data construction or modifications to the model architecture. On the contrary, we find that some popular modifications to the model, such as bidirectional attention, can degrade performance, undermining the inherent characteristics of LLMs. We have publicly released our method at this repo. * Co-first authors † Corresponding authors, with Zheng Liu as the project lead Similarity Score Once upon a time, in a blooming meadow, a group of rabbits were happily racing each other. Their playful chase led them to a hidden, glowing burrow. Inside, they discovered an enchanted world where animals spoke and wishes came true, a secret haven of endless adventures. On a meadow, a group of rabbits are running, with an eagle chasing them from behind. To survive, the rabbits must run as fast as they can. Candidates Query A group of rabbits are running. Scene: A cat is chasing a mouse through a castle. Fairy Tale: In an ancient castle, a mouse named Max and a cat named Sir Whiskers stumbled upon a secret chamber with a magical crystal. Instead of continuing their chase, they called a truce to protect the crystal. Together, they used its magic to bring prosperity and harmony to the castle. Scene: A frog is sitting on a lilypad under a moonlit sky. Fairy Tale: Under a moonlit sky, a cursed prince in the form of a frog sat on a lilypad. A kind maiden named Lila came by and, moved by his sorrow, kissed him. The curse was broken, and the frog transformed into a prince. They married and ruled a kingdom happily ever after. Scene: A young girl discovers an old, dusty book in an attic. Fairy Tale: Once upon a time, a curious young girl named Eliza found an old, dusty book in her grandmother's attic. As she opened it, she was transported into a magical realm where she had to help a brave knight save a cursed kingdom. Together, they broke the curse and restored peace. Given a scene, retrieve the fairy tale that unfolds with this scene.
Ask about this paper
Your agent reads all of it.
Lune indexed this paper to the last equation, along with the top-tier papers that cite it. Ask a question and the answer quotes them.
Your agent calls
Luneget_paper_fulltext
Free to start. No credit card required.
Terminal
Install the CLIlune papers fulltext 2ed3203f-0238-4ebe-8ef3-8cad9ca51ff6Cited by top-tier papers34
- KaLM-Embedding-V2: Superior Training Techniques and Data Inspire A Versatile Embedding ModelXinping Zhao, Xinshuo Hu, Zifei Shan, Shouzheng Huang et al.ICLR 2026 · 47 citations
- DRAMA: Diverse Augmentation from Large Language Models to Smaller Dense RetrieversXueguang Ma, Xi Victoria Lin, Barlas Oguz, Jimmy Lin et al.ACL 2025 · 20 citations
- MILCO: Learned Sparse Retrieval Across Languages via a Multilingual ConnectorThong Nguyen, Yibin Lei, Jia-Huei Ju, Eugene Yang et al.ICLR 2026 · 16 citations
- ReasonEmbed: Enhanced Text Embeddings for Reasoning-Intensive Document RetrievalJianlyu Chen, Junwei Lan, Chaofan Li, Defu Lian et al.ACL 2026 · 13 citations
- Let LLMs Speak Embedding Languages: Generative Text Embeddings via Iterative Contrastive RefinementYu-Che Tsai, Kuan-Yu Chen, Yuan-Chi Li, Yuan-Hao Chen et al.ICLR 2026 · 11 citations
Builds on19
- Language Models are Few-Shot LearnersTom B. Brown, Benjamin Mann, Nick Ryder, Melanie Subbiah et al.NeurIPS 2020 · 64,255 citations
- Training language models to follow instructions with human feedbackLong Ouyang, Jeffrey Wu, Xu Jiang, Diogo Almeida et al.NeurIPS 2022 · 24,707 citations
- Chain-of-Thought Prompting Elicits Reasoning in Large Language ModelsJason Wei, Xuezhi Wang, Dale Schuurmans, Maarten Bosma et al.NeurIPS 2022 · 22,562 citations
- Finetuned Language Models are Zero-Shot LearnersJason Wei, Maarten Bosma, Vincent Y. Zhao, Kelvin Guu et al.ICLR 2022 · 4,966 citations
- Approximate Nearest Neighbor Negative Contrastive Learning for Dense Text RetrievalLee Xiong, Chenyan Xiong, Ye Li, Kwok-Fung Tang et al.ICLR 2021 · 1,547 citations
Related papers
- What Do Language Models Learn in Context? The Structured Task HypothesisJiaoda Li, Yifan Hou, Mrinmaya Sachan, Ryan CotterellACL 2024 · 5 citations
- Feature-Adaptive and Data-Scalable In-Context LearningJiahao Li, Quan Wang, Licheng Zhang, Guoqing Jin et al.ACL 2024
- Task Descriptors Help Transformers Learn Linear Models In-ContextRuomin Huang, Rong GeICLR 2025
- In-Context Learning Learns Label Relationships but Is Not Conventional LearningJannik Kossen, Yarin Gal, Tom RainforthICLR 2024 · 61 citations
- Self-ICL: Zero-Shot In-Context Learning with Self-Generated DemonstrationsWei-Lin Chen, Cheng-Kuang Wu, Yun-Nung Chen, Hsin-Hsi ChenEMNLP 2023 · 8 citations
