File size: 14,918 Bytes
9e1ede2
 
ebb5018
 
 
 
 
 
 
9e1ede2
ebb5018
9a8d128
ebb5018
 
 
7ce9a7e
e4bb786
9a8d128
e4bb786
9a8d128
4826424
9a8d128
e4bb786
9a8d128
4826424
9a8d128
2e2dd7b
9a8d128
4826424
9a8d128
4826424
e4bb786
 
ab67cba
 
 
 
21d0914
 
ab67cba
 
 
21d0914
 
 
919f3e3
21d0914
 
 
ccea5b0
21d0914
145f6a2
ab67cba
21d0914
 
 
 
ab67cba
21d0914
 
 
ab67cba
 
4826424
28cacc0
 
 
 
b1a3d75
8342117
5cfef7b
 
28cacc0
 
b1a3d75
1432359
 
 
 
b1a3d75
1432359
 
 
 
 
 
b1a3d75
1432359
 
b1a3d75
1432359
28cacc0
 
 
9a8d128
e4bb786
ab67cba
 
 
 
 
21d0914
ab67cba
21d0914
ab67cba
 
21d0914
 
 
 
 
 
 
 
ab67cba
 
8cc4282
fbb031a
e4bb786
9a8d128
e4bb786
c36801a
 
d13683f
c36801a
 
 
 
 
 
 
 
4826424
e4bb786
 
9a8d128
ebb5018
 
7df09b2
89a83c4
 
ebb5018
 
9a8d128
ebb5018
 
 
 
 
 
6afadee
ebb5018
 
 
89a83c4
 
ebb5018
 
 
 
 
 
 
 
89a83c4
 
ebb5018
 
 
 
 
 
cfd2b25
ebb5018
 
 
 
 
 
 
 
 
89a83c4
ebb5018
89a83c4
ebb5018
 
 
 
cfd2b25
9a8d128
 
 
 
 
 
 
 
 
 
 
4826424
9a8d128
 
cfd2b25
9a8d128
 
4826424
9a8d128
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
---
license: apache-2.0
pipeline_tag: image-text-to-text
library_name: transformers
tags:
  - multimodal
  - video-understanding
  - streaming
  - llava-onevision
---

<div align="center">

# LLaVA-OneVision-2.5-4B-Instruct

<p align="center"><a href="https://github.com/EvolvingLMMs-Lab/LLaVA-OneVision-2.5"><img style="display:inline-block; margin:0 2px; vertical-align:middle;" alt="GitHub" src="https://img.shields.io/badge/GitHub-Code-181717?logo=github"></a> <img style="display:inline-block; margin:0 2px; vertical-align:middle;" alt="Project page: coming soon" src="https://img.shields.io/badge/Project%20Page-Coming%20soon-2a78d6"> <img style="display:inline-block; margin:0 2px; vertical-align:middle;" alt="Technical report: coming soon" src="https://img.shields.io/badge/Technical%20Report-Coming%20soon-b31b1b"> <img style="display:inline-block; margin:0 2px; vertical-align:middle;" alt="License" src="https://img.shields.io/badge/License-Apache--2.0-1baf7a"></p>

**English** | [中文](README_CN.md)

</div>

LLaVA-OneVision-2.5-4B-Instruct is a 4B vision-language model for single-image, multi-image and video input. Beyond the usual offline tasks, it is trained for **streaming** video: frames arrive one at a time, and at every step the model decides whether to stay silent or speak. The same weights and the same chat template serve both modes.

## Highlights

- **Offline and streaming in one model.** `apply_chat_template(..., streaming=True)` switches mode; eight protocol tokens carry the per-frame decision to stay silent, respond or caption. Nothing else about the input changes.
- **Codec-aligned video.** Besides uniform frame sampling, *codec mode* uses the encoder's bit-cost to pack the informative regions of a video into a handful of canvases.
- **9× spatial compression.** A patch-16 vision tower with 3×3 merging gives one visual token per 48×48 pixels, so long videos fit comfortably in the 262k context.

## Performance

### Video

<table style="width:100%; display:table;">
<thead><tr>
<th align="left" style="width:28%">Benchmark</th>
<th align="center" style="width:24%">OV2.5-4B (codec)</th>
<th align="center" style="width:24%">OV2.5-4B (frames)</th>
<th align="center" style="width:24%">Qwen3.5-4B</th>
</tr></thead>
<tbody>
<tr><td colspan="4" align="left"><b>General video understanding</b></td></tr>
<tr><td align="left">VideoMME (no subtitles)</td><td align="center"><b>71.9</b></td><td align="center">69.7</td><td align="center">71.7</td></tr>
<tr><td align="left">VideoMME (subtitles)</td><td align="center">74.7</td><td align="center">75.2</td><td align="center"><b>75.9</b></td></tr>
<tr><td align="left">MotionBench</td><td align="center"><b>64.2</b> <sup>TC128×313,600</sup></td><td align="center">62.4 <sup>128f×153,664</sup></td><td align="center">60.1 <sup>128f×153,664</sup></td></tr>
<tr><td align="left">TOMATO</td><td align="center">36.0 <sup>TC16×153,664</sup></td><td align="center"><b>39.2</b> <sup>16f×153,664</sup></td><td align="center">32.4 <sup>16f×153,664</sup></td></tr>
<tr><td align="left">MVBench</td><td align="center"><b>75.5</b> <sup>TC64×313,600</sup></td><td align="center">72.0 <sup>64f×153,664</sup></td><td align="center">64.0 <sup>64f×153,664</sup></td></tr>
<tr><td align="left">NextQA MC test</td><td align="center"><b>86.4</b> <sup>TC64×313,600</sup></td><td align="center">86.1 <sup>64f×153,664</sup></td><td align="center">80.7 <sup>64f×153,664</sup></td></tr>
<tr><td align="left">TempCompass MC</td><td align="center"><b>79.7</b> <sup>TC64×313,600</sup></td><td align="center">75.8 <sup>64f×153,664</sup></td><td align="center">73.4 <sup>64f×153,664</sup></td></tr>
<tr><td align="left">Video-MME-v2</td><td align="center"><b>17.2</b> <sup>TC64×313,600</sup></td><td align="center">16.4 <sup>64f×330,000</sup></td><td align="center">15.5 <sup>64f×330,000</sup></td></tr>
<tr><td align="left">EgoSchema subset</td><td align="center">79.8 <sup>TC64×313,600</sup></td><td align="center"><b>80.0</b> <sup>64f×153,664</sup></td><td align="center">68.2 <sup>64f×153,664</sup></td></tr>
<tr><td align="left">Video-Index</td><td align="center"><b>23.1</b> <sup>TC512×55,296</sup></td><td align="center">20.0 <sup>1fps, ≤512f×55,296</sup></td><td align="center">19.6 <sup>1fps, ≤512f×55,296</sup></td></tr>
<tr><td colspan="4" align="left"><b>Long video</b></td></tr>
<tr><td align="left">LVBench</td><td align="center">61.6 <sup>TC1024×156,800</sup></td><td align="center"><b>62.0</b> <sup>950f×200,000</sup></td><td align="center">56.5 <sup>2048f×120,000</sup></td></tr>
<tr><td align="left">MLVU dev</td><td align="center"><b>77.1</b> <sup>TC512×313,600</sup></td><td align="center">75.3 <sup>512f×72,900</sup></td><td align="center">73.8 <sup>512f×72,900</sup></td></tr>
<tr><td align="left">LongVideoBench val</td><td align="center"><b>71.1</b> <sup>TC768×235,200</sup></td><td align="center">69.0 <sup>1280f×80,000</sup></td><td align="center">62.7 <sup>700f×300,000</sup></td></tr>
<tr><td align="left">VideoEval-Pro</td><td align="center"><b>64.6</b> <sup>TC768×235,200</sup></td><td align="center">64.4 <sup>950f×200,000</sup></td><td align="center">62.8 <sup>2048f×100,000</sup></td></tr>
<tr><td colspan="4" align="left"><b>Temporal grounding (mIoU)</b></td></tr>
<tr><td align="left">TimeLens ActivityNet</td><td align="center"><b>59.1</b> <sup>TC128×313,600</sup></td><td align="center">58.8 <sup>2048f×409,600, fps=4</sup></td><td align="center">53.8 <sup>2048f×409,600, fps=4</sup></td></tr>
<tr><td align="left">TimeLens Charades</td><td align="center"><b>61.3</b> <sup>TC128×313,600</sup></td><td align="center">60.6 <sup>2048f×409,600, fps=4</sup></td><td align="center">48.1 <sup>2048f×409,600, fps=4</sup></td></tr>
<tr><td align="left">TimeLens QVHighlights</td><td align="center"><b>70.3</b> <sup>TC128×313,600</sup></td><td align="center">68.4 <sup>2048f×409,600, fps=4</sup></td><td align="center">67.5 <sup>2048f×409,600, fps=4</sup></td></tr>
</tbody>
</table>

### Streaming video

<table style="width:100%; display:table;">
<thead><tr>
<th align="left" style="width:40%">Benchmark</th>
<th align="center" style="width:20%">OV2.5-4B<br>(codec, 24 fps)</th>
<th align="center" style="width:20%">MOSS-VL-Realtime 11B<br>(1 fps)</th>
<th align="center" style="width:20%">JoyAI-VL-Interaction 8B<br>(1 fps)</th>
</tr></thead>
<tbody>
<tr><td colspan="4" align="left"><b>OVO-Bench</b></td></tr>
<tr><td align="left">Real-Time Visual Perception (RTVP)</td><td align="center"><b>81.0</b></td><td align="center">75.9</td><td align="center">76.4</td></tr>
<tr><td align="left">Backward Tracing (BT)</td><td align="center">68.8</td><td align="center"><b>72.6</b></td><td align="center">53.3</td></tr>
<tr><td align="left">Forward Active Responding (FAR)</td><td align="center">60.7</td><td align="center"><b>62.1</b></td><td align="center">54.6</td></tr>
<tr><td align="left">Overall</td><td align="center"><b>70.2</b></td><td align="center"><b>70.2</b></td><td align="center">61.4</td></tr>
<tr><td colspan="4" align="left"><b>StreamingBench</b></td></tr>
<tr><td align="left">Real-Time Visual Understanding (RTVU)</td><td align="center"><b>85.3</b></td><td align="center">82.9</td><td align="center">83.2</td></tr>
<tr><td align="left">Misleading Context Understanding (MCU)</td><td align="center">36.8</td><td align="center">--</td><td align="center"><b>37.2</b></td></tr>
<tr><td align="left">Anomaly Context Understanding (ACU)</td><td align="center"><b>67.6</b></td><td align="center">--</td><td align="center">51.6</td></tr>
<tr><td align="left">Sequential Question Answering (SQA)</td><td align="center"><b>54.8</b></td><td align="center">50.4</td><td align="center">53.6</td></tr>
<tr><td align="left">Proactive Output (PO)</td><td align="center"><b>63.6</b></td><td align="center">60.0</td><td align="center">39.6</td></tr>
<tr><td align="left">Contextual Understanding (CU)</td><td align="center">55.7</td><td align="center"><b>56.4</b></td><td align="center">45.5</td></tr>
<tr><td colspan="4" align="left"><b>Proactive and interactive</b></td></tr>
<tr><td align="left">OmniMMI: Proactive Alerting (PA)</td><td align="center"><b>68.5</b></td><td align="center">66.0</td><td align="center">13.5</td></tr>
<tr><td align="left">ProactiveVideoQA: PAUC (ω=0.5)</td><td align="center">33.1</td><td align="center"><b>47.2</b></td><td align="center">37.0</td></tr>
<tr><td align="left">InteractionBench: Total</td><td align="center">38.6</td><td align="center">--</td><td align="center">--</td></tr>
<tr><td align="left">StreamArena: Proactive Interaction (Pro)</td><td align="center"><b>25.5</b></td><td align="center">11.8</td><td align="center">9.4</td></tr>
</tbody>
</table>

### Image

<table style="width:100%; display:table;">
<thead><tr>
<th align="left" style="width:24%">General perception and reading</th>
<th align="center" style="width:13%">OV2.5-4B</th>
<th align="center" style="width:13%">Qwen3.5-4B</th>
<th align="left" style="width:24%">Grounding and spatial</th>
<th align="center" style="width:13%">OV2.5-4B</th>
<th align="center" style="width:13%">Qwen3.5-4B</th>
</tr></thead>
<tbody>
<tr><td align="left">MMStar</td><td align="center">63.9</td><td align="center"><b>66.9</b></td><td align="left">RefCOCO val (Acc@0.5)</td><td align="center"><b>92.6</b></td><td align="center">89.1</td></tr>
<tr><td align="left">MMBench-EN dev</td><td align="center">88.2</td><td align="center"><b>88.8</b></td><td align="left">RefCOCOg val (Acc@0.5)</td><td align="center"><b>88.9</b></td><td align="center">87.7</td></tr>
<tr><td align="left">RealWorldQA</td><td align="center">73.9</td><td align="center"><b>74.4</b></td><td align="left">RefSpatial-Bench</td><td align="center"><b>62.1</b></td><td align="center">29.1</td></tr>
<tr><td align="left">AI2D</td><td align="center">82.2</td><td align="center"><b>82.4</b></td><td align="left">CrossPoint</td><td align="center"><b>80.5</b></td><td align="center">33.7</td></tr>
<tr><td align="left">BLINK</td><td align="center"><b>67.1</b></td><td align="center">63.6</td><td align="left">CV-Bench 2D</td><td align="center"><b>83.3</b></td><td align="center">80.7</td></tr>
<tr><td align="left">V*-Bench</td><td align="center"><b>89.5</b></td><td align="center">81.7</td><td align="left">CV-Bench 3D</td><td align="center"><b>94.5</b></td><td align="center">92.0</td></tr>
<tr><td align="left">OCRBench</td><td align="center">79.8</td><td align="center"><b>85.2</b></td><td align="left">EmbSpatial</td><td align="center"><b>83.0</b></td><td align="center">74.7</td></tr>
<tr><td align="left">DocVQA val</td><td align="center">92.9</td><td align="center"><b>95.2</b></td><td align="left">MMSI-Bench</td><td align="center"><b>33.3</b></td><td align="center">31.4</td></tr>
</tbody>
</table>

<sub>Compared with Qwen3.5-4B, thinking disabled. **Bold** is the best score in each row; `--` means not available. The superscript on each video score is the setting that produced it: frames × pixels per frame, or for codec, canvases (TC) × pixels per canvas. VideoMME is the mean over the short, medium and long splits. Each side reports its best score over the settings tried, from single runs. The image table shows selected benchmarks; full results, settings and protocol will be given in the technical report.</sub>

## Model Overview

<table style="width:100%; display:table;">
<tbody>
<tr><td align="left" style="width:28%"><b>Type</b></td><td align="left">instruction-tuned vision-language model, LLaVA-OneVision-2.5 architecture</td></tr>
<tr><td align="left" style="width:28%"><b>Parameters</b></td><td align="left">5.25B total (4B language model plus vision tower and adapter)</td></tr>
<tr><td align="left" style="width:28%"><b>Language side</b></td><td align="left">32 layers, hidden size 2560, FFN 9216, 16 attention heads / 4 KV heads, linear attention with one full-attention layer every 4</td></tr>
<tr><td align="left" style="width:28%"><b>Vision side</b></td><td align="left">24 layers, hidden size 1024, <code>patch_size=16</code>, <code>spatial_merge_size=3</code>, attention within a frame</td></tr>
<tr><td align="left" style="width:28%"><b>Vocabulary</b></td><td align="left">248320, including the 8 streaming protocol tokens</td></tr>
<tr><td align="left" style="width:28%"><b>Context length</b></td><td align="left">262144</td></tr>
<tr><td align="left" style="width:28%"><b>Weights</b></td><td align="left">bfloat16, 3 safetensors shards, about 9.9 GB</td></tr>
</tbody>
</table>

## Quickstart

The modeling code ships with the weights, so `trust_remote_code=True` is required.

```bash
pip install "transformers>=5.7.0" accelerate torch torchvision
pip install flash-attn --no-build-isolation   # optional, recommended
pip install decord                            # frame-sampling video path only
```

### Image

```python
import torch
from PIL import Image
from transformers import AutoProcessor, AutoModelForImageTextToText

MODEL = "lmms-lab-encoder/LLaVA-OneVision-2.5-4B-Instruct"

processor = AutoProcessor.from_pretrained(MODEL, trust_remote_code=True)
model = AutoModelForImageTextToText.from_pretrained(
    MODEL, trust_remote_code=True, dtype=torch.bfloat16,
    attn_implementation="flash_attention_2",   # "sdpa" without flash-attn
    device_map="auto",
).eval()

messages = [{"role": "user", "content": [
    {"type": "image"},
    {"type": "text", "text": "Describe this image in detail."},
]}]
text = processor.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
inputs = processor(text=text, images=[Image.open("example.jpg").convert("RGB")],
                   return_tensors="pt").to(model.device)

with torch.inference_mode():
    out = model.generate(**inputs, max_new_tokens=512, do_sample=False)
print(processor.decode(out[0][inputs["input_ids"].shape[1]:], skip_special_tokens=True))
```

### Video

```python
messages = [{"role": "user", "content": [
    {"type": "video"},
    {"type": "text", "text": "What is happening in this video?"},
]}]
text = processor.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)

inputs = processor(
    text=text, videos=["example.mp4"],
    max_frames=64,
    min_pixels=153664, max_pixels=153664,   # set equal to fix the per-frame budget
    return_tensors="pt",
).to(model.device)
```

For codec mode, install `codec-video-prep` and pass `video_backend="codec"`:

```bash
pip install -i https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple \
            "codec-video-prep==0.3.0"
codec-video-prep-doctor
```

```python
inputs = processor(text=text, videos=["example.mp4"],
                   video_backend="codec", return_tensors="pt").to(model.device)
```

### Streaming

The checkpoint already supports streaming: pass `streaming=True` to `apply_chat_template`. The runtime library for real-time online inference is coming soon.

## License

Apache-2.0.