Instructions to use TengfeiLiuCoder/RefCaptioner with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use TengfeiLiuCoder/RefCaptioner with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="TengfeiLiuCoder/RefCaptioner") 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 AutoProcessor, AutoModelForMultimodalLM processor = AutoProcessor.from_pretrained("TengfeiLiuCoder/RefCaptioner") model = AutoModelForMultimodalLM.from_pretrained("TengfeiLiuCoder/RefCaptioner", 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=40) print(processor.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use TengfeiLiuCoder/RefCaptioner with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "TengfeiLiuCoder/RefCaptioner" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "TengfeiLiuCoder/RefCaptioner", "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/TengfeiLiuCoder/RefCaptioner
- SGLang
How to use TengfeiLiuCoder/RefCaptioner 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 "TengfeiLiuCoder/RefCaptioner" \ --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": "TengfeiLiuCoder/RefCaptioner", "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 "TengfeiLiuCoder/RefCaptioner" \ --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": "TengfeiLiuCoder/RefCaptioner", "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 TengfeiLiuCoder/RefCaptioner with Docker Model Runner:
docker model run hf.co/TengfeiLiuCoder/RefCaptioner
RefCaptioner
RefCaptioner is an 8B vision-language model for multi-reference image-grounded video captioning. Given a video and an ordered set of reference images, it writes a fluent English description and places tags such as <Image_1> directly after the visual phrases grounded by those references. Reference images may include distractors; the model is expected to omit tags that cannot be grounded in the video.
The released weights are a merged Hugging Face checkpoint based on Qwen3-VL-8B-Instruct. No PEFT adapter is required at inference time.
Model details
| Item | Value |
|---|---|
| Base model | Qwen/Qwen3-VL-8B-Instruct |
| Release checkpoint | RefCaptioner1.0 |
| Input | Ordered reference images plus one video |
| Output | English caption with local <Image_n> bindings |
| Thinking mode | Disabled |
| Weight format | Merged safetensors |
Installation
pip install -r requirements.txt
RefCaptioner uses the standard Qwen3-VL inference stack and does not require a task-specific runtime. Any environment that can run Qwen3-VL with a compatible Transformers release can be used directly.
The benchmark environment used torch==2.9.0, transformers==4.57.6, accelerate==1.14.0, qwen-vl-utils==0.0.14, and av==17.1.0.
Quick start
python inference.py \
--model NOVAglow646/RefCaptioner \
--video /path/to/video.mp4 \
--images /path/to/ref_1.jpg /path/to/ref_2.jpg /path/to/ref_3.png
The image order defines the tag mapping: the first image is <Image_1>, the second is <Image_2>, and so on. The script uses the exact prompt structure and deterministic decoding configuration used for the reported test-set inference.
Reproduction configuration
The released benchmark captions were generated with the following settings:
| Parameter | Value |
|---|---|
| Prompt protocol | Prompt_1.0 |
| Maximum input length | 18,000 tokens |
| Maximum new tokens | 512 |
| Video sampling rate | 2 FPS |
| Minimum video frames | 4 |
| Reference-image maximum pixels | 602,112 |
| Video-frame maximum pixels | 602,112 |
| Decoding | Greedy (do_sample=False) |
| Temperature | 0.0 |
| Top-p / top-k | 1.0 / 0 |
| Inference dtype | bfloat16 |
| Thinking | Disabled |
The same values are machine-readable in inference_config.json. The eight GPUs used for the full benchmark only provided sample-level parallelism; eight GPUs are not a model requirement. A single device can run the model when it has enough memory, while device_map="auto" can distribute the model across available devices.
Input and output contract
The prompt labels each ordered reference before presenting the associated image, then presents the video. The model must:
- describe visible video content in one English paragraph;
- place every used
<Image_n>immediately after a concrete grounded phrase; - group tags only when they ground the same visual unit; and
- omit distractor or uncertain references rather than forcing all tags into the caption.
Example output:
MRVBench Results
The following scores report RefCaptioner on MRVBench. Eff-Bind = Ref-Tag-R × Ref-Bind.
| Model | KP-Cov ↑ | VQA ↑ | VQA-Cov ↑ | Ref-Tag-P ↑ | Ref-Tag-R ↑ | Ref-Bind ↑ | Eff-Bind ↑ | Dist-Rej ↑ | FalseRef-Any ↓ | Subj-R ↑ | Subj-F1 ↑ | MRVScore ↑ |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| RefCaptioner | 0.882 | 0.686 | 0.837 | 0.994 | 0.943 | 0.967 | 0.912 | 0.985 | 0.100 | 0.817 | 0.869 | 0.888 |
These values are tied to the prompt and preprocessing configuration above; changing frame sampling, pixel limits, prompt wording, or decoding can change the results.
Intended use
The model is intended for research on multi-reference video understanding, grounded caption generation, reference selection, and local phrase-to-image binding. It is not designed to identify people, infer sensitive attributes, or establish the provenance or ownership of visual content.
Limitations
- Results depend on frame sampling and may miss short events between sampled frames.
- The output is English and follows a task-specific caption style.
- Reference tags express visual grounding, not identity verification.
Users should verify generated descriptions before applying them in consequential settings.
License
The model weights are released under the Apache 2.0 license, following the base model. The companion benchmark contains separate media and annotation considerations; consult its dataset card before use or redistribution.
Citation
@misc{liu2026refcaptionermultireferenceimagegroundedvideo,
title={RefCaptioner: Multi-Reference Image-Grounded Video Captioning},
author={Tengfei Liu and Yang Shi and Yuran Wang and Xiaohan Zhang and Yuqing Wen and Yuqi Tang and Qixun Wang and Zhuoran Zhang and Xuanyu Zhu and Weihong Lin and Xinlei Yu and Yujie Wei and Xinwei Long and Fengxiang Wang and Xinlong Chen and Yue Ding and Jialu Chen and Haotian Wang and Yuanxing Zhang},
year={2026},
eprint={2607.28509},
archivePrefix={arXiv},
primaryClass={cs.CV},
url={https://arxiv.org/abs/2607.28509}
}
- Downloads last month
- -
Model tree for TengfeiLiuCoder/RefCaptioner
Base model
Qwen/Qwen3-VL-8B-Instruct
docker model run hf.co/TengfeiLiuCoder/RefCaptioner