Hugging FaceTom AarsenTutorial
Training and Finetuning Multimodal Embedding & Reranker Models with Sentence Transformers
Summary
Sentence Transformers provides a Python library for training and using embedding and reranker models across text, images, audio, and video in retrieval and semantic search applications. The post shows how to finetune multimodal models on task-specific data, using Visual Document Retrieval as the example: matching text queries with document page images while preserving charts, tables, and layout. It describes the SentenceTransformerTrainer pipeline, model and processor configuration, dataset handling, and alternative Router-based encoders, while also covering multimodal reranker training with BinaryCrossEntropyLoss and direction-specific datasets. On its evaluation data, finetuning Qwen/Qwen3-VL-Embedding-2B raised NDCG@10 from 0.888 to 0.947 and outperformed all tested VDR models, including models up to 4x its size.
Context
General-purpose multimodal embedding models are trained across diverse languages and tasks, so they are rarely optimal for a specific task. Visual Document Retrieval requires matching text queries to relevant document screenshots while understanding document layouts, charts, tables, and text.
Approach / What changed
The post finetunes Qwen/Qwen3-VL-Embedding-2B for Visual Document Retrieval using SentenceTransformerTrainer, a task-specific dataset, configurable processor and model arguments, and multimodal training components. It also describes Router-based models with separate modality encoders and covers multimodal reranker training with direction-specific datasets and BinaryCrossEntropyLoss.
Takeaways
Finetuning Qwen/Qwen3-VL-Embedding-2B for Visual Document Retrieval improved evaluation NDCG@10 from 0.888 to 0.947.
The preprocessed training dataset contains 53,512 English query-image samples and resolves four hard negatives per sample into document screenshot images.
Router-based multimodal models use separate encoders whose embedding spaces must be aligned through training; a Dense projection can map them into a shared space.
Source and freshness
- Source
- huggingface.co
- Published
- Added to Yomu
- Last updated
Summaries are generated from the original by a language model. Check the original before relying on it.
Keep reading
Related reading
The Good Stuff
Paid picks we use ourselves. Links carry a referral code — a subscription through one earns us a commission at no extra cost to you.
The best engineering reads, once a week
One useful email. Unsubscribe anytime.