Instructions to use eugeneliu01/Faithful_Thinking_with_Image with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use eugeneliu01/Faithful_Thinking_with_Image with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="eugeneliu01/Faithful_Thinking_with_Image") 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)# pip install -U transformers accelerate # Load model directly from transformers import AutoProcessor, AutoModelForMultimodalLM processor = AutoProcessor.from_pretrained("eugeneliu01/Faithful_Thinking_with_Image") model = AutoModelForMultimodalLM.from_pretrained("eugeneliu01/Faithful_Thinking_with_Image", device_map="auto") 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?"} ] }, ] inputs = processor.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=256) print(processor.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use eugeneliu01/Faithful_Thinking_with_Image with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "eugeneliu01/Faithful_Thinking_with_Image" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "eugeneliu01/Faithful_Thinking_with_Image", "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/eugeneliu01/Faithful_Thinking_with_Image
- SGLang
How to use eugeneliu01/Faithful_Thinking_with_Image 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 "eugeneliu01/Faithful_Thinking_with_Image" \ --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": "eugeneliu01/Faithful_Thinking_with_Image", "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 "eugeneliu01/Faithful_Thinking_with_Image" \ --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": "eugeneliu01/Faithful_Thinking_with_Image", "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 eugeneliu01/Faithful_Thinking_with_Image with Docker Model Runner:
docker model run hf.co/eugeneliu01/Faithful_Thinking_with_Image
SCCM-RL
This repository contains the SCCM-RL model, associated with the paper On the Faithfulness of Visual Thinking: Measurement and Enhancement.
SCCM-RL is fine-tuned from Qwen2.5-VL-7B-Instruct using SCCM learning. The upstream model is licensed under Apache 2.0.
TL;DR: We measure the faithfulness of visual evidence in multimodal chain-of-thought and introduce Sufficient-Component Cause Model (SCCM) learning to encourage sufficient yet minimal visual evidence for answering.
Abstract
Large vision-language models can generate interleaved visual and textual reasoning after reinforcement fine-tuning. However, correct answers do not necessarily imply faithful visual evidence: predictions can remain unchanged when visual observations are corrupted. We probe this behavior through visual and textual interventions and evaluate visual evidence from two perspectives: relevance and sufficiency. To improve visual faithfulness, we introduce SCCM learning, which encourages reasoning traces to generate sufficient yet minimal visual components that can independently lead to the correct answer.
For more details, please refer to the GitHub repository.
Installation
Clone the companion repository and install its dependencies in a Linux environment with NVIDIA GPUs and compatible CUDA:
git clone https://github.com/EugeneLiu01/Faithful_Thinking_with_Image.git
cd Faithful_Thinking_with_Image
conda create -n faithful-mcot python=3.10 -y
conda activate faithful-mcot
pip install torch==2.6.0 torchvision==0.21.0 torchaudio==2.6.0 \
--index-url https://download.pytorch.org/whl/cu124
pip install flash-attn==2.7.4.post1 --no-build-isolation
pip install -r requirements.txt \
--extra-index-url https://download.pytorch.org/whl/cu124
These commands follow the companion repository's CUDA 12.4 reference environment. See its README for other CUDA versions.
Usage
Download this checkpoint to a local directory, then prepare V*Bench following the companion repository's data preparation instructions. Configure the local answer judge as described in its README before running evaluation.
From the companion repository, run baseline inference with the image-cropping tool loop:
bash scripts/simple_eval_ddp.sh /path/to/SCCM_model
For the full faithfulness evaluation pipeline, including visual and textual interventions:
bash scripts/one4all.sh /path/to/SCCM_model
The full pipeline additionally requires the Azure OpenAI judge configuration described in the companion README. Outputs include reasoning traces, predictions, accuracy summaries, and intervention comparisons.
Citation
If you find this work useful, please cite:
@article{liu2025faithfulness,
title={On the Faithfulness of Visual Thinking: Measurement and Enhancement},
author={Liu, Zujing and Pan, Junwen and She, Qi and Gao, Yuan and Xia, Guisong},
journal={arXiv preprint arXiv:2510.23482},
year={2025}
}
- Downloads last month
- 43