--- license: cc-by-nc-4.0 library_name: transformers pipeline_tag: feature-extraction base_model: - Qwen/Qwen3.5-4B-Base datasets: - UCSC-VLAA/OpenEmbed-Data tags: - multimodal-embedding - image-text-retrieval - visual-document-retrieval - sentence-transformers language: - en --- # OpenEmbed-4B

🌐 Project page  ·  📄 Paper  ·  💻 Code  ·  🗂️ Data  ·  ▶️ Colab demo

OpenEmbed is a family of multimodal embedding models at 0.8B, 2B, 4B, and 9B parameters, released with their post-training data, training code, and cached teacher embeddings. As of December 2026, OpenEmbed-4B scores higher on both the image and the visual-document tracks than any model of its size or smaller on the [MMEB-V2 leaderboard](https://huggingface.co/spaces/TIGER-Lab/MMEB-Leaderboard) that releases its training data and training code. One model embeds text, images, visual documents, and image–text combinations into one space. Each input is formatted as a single user turn that ends with an `` token, and the L2-normalized final hidden state at that token is the embedding (2,560 dimensions for OpenEmbed-4B). OpenEmbed-4B is fine-tuned from [Qwen/Qwen3.5-4B-Base](https://huggingface.co/Qwen/Qwen3.5-4B-Base) in two stages. Stage 1 trains LoRA adapters on the language model and the vision tower with a contrastive loss over 109 curated datasets. Stage 2 widens the language-model adapters and adds decoupled distillation from cached embeddings of two open-weight teachers, Qwen3-VL-Embedding-8B and WeMM-Embedding-9B. The adapters are merged into the released weights.

What leading embedding models release, MMEB-V2 image score by model size, and image and document retrieval against embedding APIs

(a) What leading embedding models release. (b) MMEB-V2 image score by model size; * reproduced by us. (c) DOCCI text-to-image R@1 and ViDoRe V3 nDCG@10 (8 public sets, English queries); r: reported results, p: recomputed from public per-query results, others measured by us. - **Paper:** OpenEmbed: A Family of Frontier Multimodal Embedding Models with Open Data, Code, and Weights ([arXiv:2612.02432](https://arxiv.org/abs/2612.02432)) - **Training data and teacher embeddings:** [UCSC-VLAA/OpenEmbed-Data](https://huggingface.co/datasets/UCSC-VLAA/OpenEmbed-Data) - **Training and evaluation code:** [UCSC-VLAA/OpenEmbed](https://github.com/UCSC-VLAA/OpenEmbed) - **Models:** [OpenEmbed-0.8B](https://huggingface.co/UCSC-VLAA/OpenEmbed-0.8B) · [OpenEmbed-2B](https://huggingface.co/UCSC-VLAA/OpenEmbed-2B) · [OpenEmbed-4B](https://huggingface.co/UCSC-VLAA/OpenEmbed-4B) · [OpenEmbed-9B](https://huggingface.co/UCSC-VLAA/OpenEmbed-9B) ## Results MMEB-V2: 36 image tasks (Hit@1; CLS: classification, VQA: visual question answering, RET: retrieval, GRD: grounding) and 24 visual-document retrieval tasks (VisDoc, nDCG@5). Evaluated with the official Qwen3-VL-Embedding MMEB-V2 evaluation code and the input format described below; the patch that applies this format is part of the code release. | Model | CLS | VQA | RET | GRD | Image | VisDoc | |---|---:|---:|---:|---:|---:|---:| | OpenEmbed-0.8B | 67.9 | 74.2 | 74.2 | 96.5 | 74.9 | 78.5 | | OpenEmbed-2B | 74.1 | 77.8 | 78.1 | 97.5 | 79.1 | 80.5 | | **OpenEmbed-4B** | **74.5** | **80.5** | **79.8** | **97.3** | **80.5** | **81.6** | | OpenEmbed-9B | 75.7 | 81.0 | 80.1 | 97.6 | 81.1 | 82.4 | ## Usage No remote code is needed. Tested with transformers 5.2.0 and 5.23.0, sentence-transformers 5.7.0 and 6.3.0 (torch 2.8.0), and vLLM 0.34.0. ```bash pip install torch torchvision "transformers>=5.15.0" "sentence-transformers>=5.7.0" ``` ### Input format OpenEmbed was trained and evaluated with WeMM-Embedding's input format, which the repository's chat template renders: - Each input is one user turn with no system turn. Images come first, followed by one text item that holds the instruction and the text, joined by a space. - The tokenizer appends the `` token. The embedding is the L2-normalized last hidden state at that token, the last non-padding position (keep the default right padding). - Images are resized to between 65,536 and 8,388,608 pixels, the bounds of training and evaluation and the processor's defaults. Scores move with the image budget, so keep them. Instructions used in training and in MMEB-V2: | Task | Query | Candidate | |---|---|---| | Caption → image | `Find me an everyday image that matches the given caption: ` | image + `Represent the given image.` | | Image → caption | image + `Find an image caption describing the given everyday image.` | caption text | | Classification | image + `Represent the given image for classification` | class name | | Visual question answering | image + `Represent the given image with the following question: ` | answer text | | Composed image retrieval | image + `Given an image, find a similar everyday image with the described changes: ` | image + `Represent the given image.` | | Document page retrieval | `Find a document image that matches the given query. ` | page image, no text | ### Transformers ```python import torch import torch.nn.functional as F from PIL import Image from transformers import AutoModel, AutoProcessor model_id = "UCSC-VLAA/OpenEmbed-4B" processor = AutoProcessor.from_pretrained(model_id, use_fast=False) model = AutoModel.from_pretrained(model_id, dtype=torch.bfloat16).cuda().eval() def embed(inputs): """inputs: dicts with an optional "image" (a PIL.Image) and an optional "text".""" texts, images = [], [] for x in inputs: content = [{"type": "image"}] if x.get("image") is not None else [] if x.get("text") or not content: content.append({"type": "text", "text": x.get("text", "")}) texts.append(processor.apply_chat_template([{"role": "user", "content": content}], tokenize=False)) if x.get("image") is not None: images.append(x["image"]) batch = processor(text=texts, images=images or None, padding=True, return_tensors="pt").to(model.device) model.rope_deltas = None # transformers < 5.15 would reuse the last image batch's value with torch.inference_mode(): hidden = model(**batch).last_hidden_state last = batch["attention_mask"].sum(dim=1) - 1 # the token rows = torch.arange(hidden.size(0), device=hidden.device) return F.normalize(hidden[rows, last].float(), dim=-1) # shape (len(inputs), 2560) queries = embed([ {"text": "Find me an everyday image that matches the given caption: A brown dog running on a beach."}, {"text": "Find a document image that matches the given query. What was the revenue in 2023?"}, ]) candidates = embed([ {"image": Image.open("dog.jpg"), "text": "Represent the given image."}, {"image": Image.open("annual_report_page.png")}, ]) print(queries @ candidates.T) ``` `use_fast=False` resizes images with PIL, as our evaluation did. The default (torchvision) processor works too and gives embeddings within a cosine of 0.999 of these. ### Sentence Transformers ```python import torch from PIL import Image from sentence_transformers import SentenceTransformer model = SentenceTransformer("UCSC-VLAA/OpenEmbed-4B", model_kwargs={"dtype": torch.bfloat16}) queries = model.encode([ "Find me an everyday image that matches the given caption: A brown dog running on a beach.", "Find a document image that matches the given query. What was the revenue in 2023?", ]) candidates = model.encode([ {"image": Image.open("dog.jpg"), "text": "Represent the given image."}, {"image": Image.open("annual_report_page.png")}, ]) print(model.similarity(queries, candidates)) ``` Add `processor_kwargs={"use_fast": False}` to resize images exactly as our evaluation did. Use transformers 5.15 or later with Sentence Transformers: older versions keep the position offsets of the last batch with images and can fail on a later batch without images. ### vLLM ```bash hf download UCSC-VLAA/OpenEmbed-4B --local-dir OpenEmbed-4B vllm serve OpenEmbed-4B --runner pooling --chat-template OpenEmbed-4B/embedding_chat_template.jinja \ --limit-mm-per-prompt.video=0 ``` ```python import base64 import requests def image_url(path): return "data:image/jpeg;base64," + base64.b64encode(open(path, "rb").read()).decode() response = requests.post("http://localhost:8000/v1/embeddings", json={ "model": "OpenEmbed-4B", "messages": [{"role": "user", "content": [ {"type": "image_url", "image_url": {"url": image_url("dog.jpg")}}, {"type": "text", "text": "Represent the given image."}, ]}], "encoding_format": "float", }) embedding = response.json()["data"][0]["embedding"] ``` We ran it on a 24 GB card with `--max-model-len 16384` added. `--limit-mm-per-prompt.video=0` leaves out video inputs, which OpenEmbed was not trained on, and the memory vLLM would set aside for them. ### How close each path is to our evaluation We compared each path with the embeddings of our evaluation (the official evaluation code, transformers 5.2.0) on nine inputs: three texts, three images with text, a document page, and an image above and one below the pixel bounds. The Transformers code above produced the evaluation's token ids and image grids for every input. Lowest cosine similarity per path: | Path | Lowest cosine | |---|---:| | Transformers code above, transformers 5.2.0 | 0.999999 | | Transformers code above, transformers 5.23.0 | 0.9996 | | Sentence Transformers 5.7.0 (transformers 5.2.0) | 0.9995 | | Sentence Transformers 6.3.0 (transformers 5.23.0) | 0.9996 | | vLLM 0.34.0 | 0.9993 | The rest comes from the numerics of later library versions and from the default image processor's resizing. `trust_remote_code=True` still loads WeMM-Embedding's class (`modeling_wemm_embedding.py`, which the evaluation code reads); its `embedding` method computes the same embedding. ## Training | | | |---|---| | Base model | [Qwen/Qwen3.5-4B-Base](https://huggingface.co/Qwen/Qwen3.5-4B-Base) (revision `1001bb4d`) | | Parameters | 4.54B (bfloat16) | | Embedding dimension | 2,560 | | Stage 1 | contrastive learning, LoRA (rank 64) on the language model and the vision tower, 109 curated datasets | | Stage 2 | language-model LoRA widened to rank 256, decoupled distillation from cached teacher embeddings (Qwen3-VL-Embedding-8B for 51 datasets, WeMM-Embedding-9B for 24) | | Hardware | TPU v5p, JAX | Training images were capped at 1,024 visual tokens (1,280 for document pages); evaluation allows up to 8,192. The recipe files of all four sizes are in the code release. ## Limitations - Encodes text, images, and document pages; not video or audio. - Trails other models on MIEB's compositionality tasks; the training mixture includes no synthetic text-perturbed negatives. - Stage 2 distills from open-weight teachers whose own post-training data are not public. - Much of the training data comes from datasets licensed for non-commercial or research use only, or with no stated license (49% of the 2B model's stage-1 pairs); the weights are released for non-commercial use. ## License The weights are licensed under [CC BY-NC 4.0](LICENSE). The model code, tokenizer, and processor files come from WeMM-Embedding (Apache-2.0), and the weights are derived from Qwen/Qwen3.5-4B-Base (Apache-2.0); see [NOTICE](NOTICE) and [third_party/](third_party). ## Citation ```bibtex @article{liu2026openembed, title = {{OpenEmbed}: A Family of Frontier Multimodal Embedding Models with Open Data, Code, and Weights}, author = {Liu, Yanqing and Zhang, Letian and Yao, Huaxiu and Zheng, Zeyu and Zhou, Yuyin and Xie, Cihang}, journal = {arXiv preprint arXiv:2612.02432}, year = {2026} } ```