Instructions to use IVC-liuyuan/M3Diff with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use IVC-liuyuan/M3Diff with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="IVC-liuyuan/M3Diff") messages = [ { "role": "user", "content": [ {"type": "image", "url": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/p-blog/candy.JPG"}, {"type": "text", "text": "What animal is on the candy?"} ] }, ] pipe(text=messages)# Load model directly from transformers import AutoModelForCausalLM model = AutoModelForCausalLM.from_pretrained("IVC-liuyuan/M3Diff", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use IVC-liuyuan/M3Diff with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "IVC-liuyuan/M3Diff" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "IVC-liuyuan/M3Diff", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Describe this image in one sentence." }, { "type": "image_url", "image_url": { "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg" } } ] } ] }'Use Docker
docker model run hf.co/IVC-liuyuan/M3Diff
- SGLang
How to use IVC-liuyuan/M3Diff with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "IVC-liuyuan/M3Diff" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "IVC-liuyuan/M3Diff", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Describe this image in one sentence." }, { "type": "image_url", "image_url": { "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg" } } ] } ] }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "IVC-liuyuan/M3Diff" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "IVC-liuyuan/M3Diff", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Describe this image in one sentence." }, { "type": "image_url", "image_url": { "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg" } } ] } ] }' - Docker Model Runner
How to use IVC-liuyuan/M3Diff with Docker Model Runner:
docker model run hf.co/IVC-liuyuan/M3Diff
M³Diff
M³Diff is the official model for fine-grained Image Difference Captioning (IDC) introduced in OmniDiff: A Comprehensive Benchmark for Fine-grained Image Difference Captioning (ICCV 2025). Given a pair of similar images, the model generates a detailed natural-language description of their visual differences.
This repository contains the merged 7B model weights. The Hugging Face model
ID is IVC-liuyuan/M3Diff.
Model architecture
M³Diff extends LLaVA-OneVision-7B with a plug-and-play Multi-scale Differential Perception (MDP) module. MDP computes feature-level differences between the two images and adaptively fuses information from several vision encoder depths. This combines low-level visual detail with high-level semantics while retaining the general capabilities of the foundation model.
- Language model: Qwen2, 7B scale
- Vision encoder: SigLIP SO400M, 27 transformer layers
- Multi-scale vision features: layers 17, 20, 23, and 26
- MDP: two stacked refinement layers
- Projector: two-layer MLP
- Checkpoint format: merged FP16
safetensors
The model uses the M³Diff/LLaVA code because the MDP module is a custom model
component; loading it with stock transformers.AutoModel alone is not
supported.
Training
The model was instruction-tuned on 896K question-answer samples assembled from
OmniDiff and public IDC datasets, including Spot-the-Diff, IEdit,
Birds-to-Words, CLEVR-Change, and CLEVR-DC. The language model was adapted with
LoRA (r=128, alpha=256), while the vision encoder, multimodal projector,
and MDP module were fully fine-tuned. The reported run used eight NVIDIA A100
40GB GPUs, a global batch size of 256, and approximately 26 hours of training.
OmniDiff contains 15,598 human-captioned image pairs from 324 diverse indoor and outdoor scenarios. It covers 12 change types: viewpoint, illumination, addition, disappearance, removal, substitution, size, color, orientation, pose, OCR, and counting. Captions contain 60 words on average.
Usage
Install the official M³Diff code and its dependencies, then use its LLaVA-compatible loader:
from llava.model.builder import load_pretrained_model
from llava.mm_utils import get_model_name_from_path
model_path = "IVC-liuyuan/M3Diff"
tokenizer, model, image_processor, context_len = load_pretrained_model(
model_path=model_path,
model_base=None,
model_name=get_model_name_from_path(model_path),
)
For paired-image captioning and benchmark evaluation, use the evaluation
launchers supplied with the official M³Diff source release. They construct a
two-image prompt, preprocess both images with SigLIP, and generate the
difference caption with the qwen_2 conversation template.
Intended use and limitations
M³Diff is intended for research on image difference captioning, paired-image comparison, and fine-grained multimodal understanding. Potential applications include environmental monitoring and visual surveillance research.
The model may hallucinate, omit, or mislocalize subtle changes, especially for domains or image distributions not represented during training. Its outputs must not be treated as a sole source of truth in safety-critical settings. Users are responsible for evaluating bias, privacy, and dataset licensing for their deployment context. The current model operates on image pairs rather than continuous temporal changes or video.
Citation
@inproceedings{liu2025omnidiff,
title={OmniDiff: A Comprehensive Benchmark for Fine-grained Image Difference Captioning},
author={Liu, Yuan and Hou, Saihui and Hou, Saijie and Du, Jiabao and Meng, Shibei and Huang, Yongzhen},
booktitle={Proceedings of the IEEE/CVF International Conference on Computer Vision},
pages={21440--21449},
year={2025}
}
License and acknowledgements
The released model artifacts are provided under the Apache License 2.0. This work builds on LLaVA, LLaVA-NeXT, LLaVA-OneVision, Qwen2, SigLIP, Hugging Face Transformers, PEFT, and DeepSpeed. Users must also comply with the applicable licenses and terms of the base model, upstream projects, and datasets.
- Downloads last month
- 26
Model tree for IVC-liuyuan/M3Diff
Base model
lmms-lab/llava-onevision-qwen2-7b-ov