Files
UniME-Phi3.5-V-4.2B/README.md
ModelHub XC 5599435d09 初始化项目,由ModelHub XC社区提供模型
Model: DeepGlint-AI/UniME-Phi3.5-V-4.2B
Source: Original Platform
2026-08-04 17:26:16 +08:00

4.8 KiB
Raw Permalink Blame History

license, datasets, language, base_model, library_name, tags, pipeline_tag
license datasets language base_model library_name tags pipeline_tag
mit
TIGER-Lab/MMEB-train
en
microsoft/Phi-3.5-vision-instruct
transformers
Retrieval
Multimodal
Embedding
image-text-to-text

Breaking the Modality Barrier: Universal Embedding Learning with Multimodal LLMs

Tiancheng Gu*, Kaicheng Yang*, Ziyong Feng, Xingjun Wang, Yanzhao Zhang, Dingkun Long, Yingda Chen, Weidong Cai, Jiankang Deng

🏡 Project Page | 📄 Paper | 💻 Github

UniME achieves the top ranking on the MMEB leaderboard training using a 336×336 image resolution.The screenshot is captured at 08:00 UTC+8 on May 6, 2025.

💡 Highlights

To enhance the MLLM's embedding capability, we propose textual discriminative knowledge distillation. The training process involves decoupling the MLLM's LLM component and processing text with the prompt "Summarize the above sentences in one word.", followed by aligning the student (MLLM) and teacher (NV-Embed V2) embeddings via KL divergence on batch-wise similarity distributions. Notably, only the LLM component is fine-tuned during this process, while all other parameters remain frozen.

After that, we propose hard negative enhanced instruction tuning enhances multimodal systems by improving visual sensitivity, strengthening cross-modal alignment, and boosting instruction-following capabilities. At its core are two key innovations: a false negative filtering mechanism using a similarity threshold to eliminate misleading samples, and an automatic hard negative sampling strategy that selects top-k similar but non-matching examples to increase training difficulty.

🧭 Quick Start

git clone https://github.com/deepglint/UniME.git
cd UniME
conda create -n uniME python=3.10 -y
conda activate uniME
pip install -r requirements.txt
import torch
from PIL import Image
from torch.nn import functional as F
from transformers import AutoProcessor, AutoModelForCausalLM

base_model_path="DeepGlint-AI/UniME-Phi3.5-V-4.2B"
img_prompt = '<|user|>\n<|image_1|>\nSummary above image in one word: <|end|>\n<|assistant|>\n'
text_prompt = '<|user|>\n<sent>\nSummary above sentence in one word: <|end|>\n<|assistant|>\n'

text = "A man is crossing the street with a red car parked nearby."
image_path = "figures/demo.png"
input_texts = text_prompt.replace('<sent>', text)
input_image_prompt = img_prompt
input_image = [Image.open(image_path)]

transform = AutoProcessor.from_pretrained(base_model_path, trust_remote_code=True)
model = AutoModelForCausalLM.from_pretrained(base_model_path,device_map="cuda", trust_remote_code=Truetorch_dtype=torch.float16, _attn_implementation='flash_attention_2')
transform.tokenizer.padding_side = "left"
transform.tokenizer.padding = True

inputs_text = transform(text=input_texts,
                    images=None,
                    return_tensors="pt", 
                    padding=True)
for key in inputs_text: inputs_text[key] = inputs_text[key].to("cuda")
inputs_image = transform(text=input_image_prompt,
                    images=input_image, 
                    return_tensors="pt", 
                    padding=True).to("cuda")

with torch.no_grad():
  emb_text = model(**inputs_text, output_hidden_states=True, return_dict=True).hidden_states[-1][:, -1, :]
  emb_image = model(**inputs_image, output_hidden_states=True, return_dict=True).hidden_states[-1][:, -1, :]
  emb_text = F.normalize(emb_text, dim=-1)
  emb_image = F.normalize(emb_image, dim=-1)
  Score = emb_image @ emb_text.T
print("Score: ", Score)

🔢 Results

Diverse Retrieval

MMEB

📖 Citation

If you find this repository useful, please use the following BibTeX entry for citation.

@misc{gu2025breakingmodalitybarrieruniversal,
      title={Breaking the Modality Barrier: Universal Embedding Learning with Multimodal LLMs}, 
      author={Tiancheng Gu and Kaicheng Yang and Ziyong Feng and Xingjun Wang and Yanzhao Zhang and Dingkun Long and Yingda Chen and Weidong Cai and Jiankang Deng},
      year={2025},
      eprint={2504.17432},
      archivePrefix={arXiv},
      primaryClass={cs.CV},
      url={https://arxiv.org/abs/2504.17432}, 
}