Resource-Efficient Adaptation of Large Language Models for Text Embeddings via Prompt Engineering and Contrastive Fine-tuning
Benedikt Roth, Stephan Rappensperger, Tianming Qiu, Hamza Imamovi\'c, Julian W\"ormann, Hao Shen

TL;DR
This paper presents a resource-efficient method for adapting large language models into effective text embedding tools by combining prompt engineering and contrastive fine-tuning, improving performance on clustering tasks.
Contribution
It introduces a novel combination of prompt engineering and contrastive fine-tuning strategies for LLMs to produce high-quality text embeddings efficiently.
Findings
Enhanced clustering performance on MTEB benchmark
Fine-tuning shifts focus to semantically relevant words
Effective adaptation with resource-efficient methods
Abstract
Large Language Models (LLMs) have become a cornerstone in Natural Language Processing (NLP), achieving impressive performance in text generation. Their token-level representations capture rich, human-aligned semantics. However, pooling these vectors into a text embedding discards crucial information. Nevertheless, many non-generative downstream tasks, such as clustering, classification, or retrieval, still depend on accurate and controllable sentence- or document-level embeddings. We explore several adaptation strategies for pre-trained, decoder-only LLMs: (i) various aggregation techniques for token embeddings, (ii) task-specific prompt engineering, and (iii) text-level augmentation via contrastive fine-tuning. Combining these components yields competitive performance on the English clustering track of the Massive Text Embedding Benchmark (MTEB). An analysis of the attention map…
Peer Reviews
No public reviews on file for this paper yet. If you reviewed it on a platform where reviews are public (OpenReview, ICLR, NeurIPS, ICML), you can paste yours below so the community can read it here.
Videos
No videos yet. Explain this paper in a talk, walkthrough, or lecture? Add one.
