--- license: apache-2.0 pipeline_tag: image-text-to-text library_name: transformers tags: - multimodal - video-understanding - streaming - llava-onevision ---
# LLaVA-OneVision-2.5-4B-Instruct

GitHub Project page: coming soon Technical report: coming soon License

**English** | [中文](README_CN.md)
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
Benchmark OV2.5-4B (codec) OV2.5-4B (frames) Qwen3.5-4B
General video understanding
VideoMME (no subtitles)71.969.771.7
VideoMME (subtitles)74.775.275.9
MotionBench64.2 TC128×313,60062.4 128f×153,66460.1 128f×153,664
TOMATO36.0 TC16×153,66439.2 16f×153,66432.4 16f×153,664
MVBench75.5 TC64×313,60072.0 64f×153,66464.0 64f×153,664
NextQA MC test86.4 TC64×313,60086.1 64f×153,66480.7 64f×153,664
TempCompass MC79.7 TC64×313,60075.8 64f×153,66473.4 64f×153,664
Video-MME-v217.2 TC64×313,60016.4 64f×330,00015.5 64f×330,000
EgoSchema subset79.8 TC64×313,60080.0 64f×153,66468.2 64f×153,664
Video-Index23.1 TC512×55,29620.0 1fps, ≤512f×55,29619.6 1fps, ≤512f×55,296
Long video
LVBench61.6 TC1024×156,80062.0 950f×200,00056.5 2048f×120,000
MLVU dev77.1 TC512×313,60075.3 512f×72,90073.8 512f×72,900
LongVideoBench val71.1 TC768×235,20069.0 1280f×80,00062.7 700f×300,000
VideoEval-Pro64.6 TC768×235,20064.4 950f×200,00062.8 2048f×100,000
Temporal grounding (mIoU)
TimeLens ActivityNet59.1 TC128×313,60058.8 2048f×409,600, fps=453.8 2048f×409,600, fps=4
TimeLens Charades61.3 TC128×313,60060.6 2048f×409,600, fps=448.1 2048f×409,600, fps=4
TimeLens QVHighlights70.3 TC128×313,60068.4 2048f×409,600, fps=467.5 2048f×409,600, fps=4
### Streaming video
Benchmark OV2.5-4B
(codec, 24 fps)
MOSS-VL-Realtime 11B
(1 fps)
JoyAI-VL-Interaction 8B
(1 fps)
OVO-Bench
Real-Time Visual Perception (RTVP)81.075.976.4
Backward Tracing (BT)68.872.653.3
Forward Active Responding (FAR)60.762.154.6
Overall70.270.261.4
StreamingBench
Real-Time Visual Understanding (RTVU)85.382.983.2
Misleading Context Understanding (MCU)36.8--37.2
Anomaly Context Understanding (ACU)67.6--51.6
Sequential Question Answering (SQA)54.850.453.6
Proactive Output (PO)63.660.039.6
Contextual Understanding (CU)55.756.445.5
Proactive and interactive
OmniMMI: Proactive Alerting (PA)68.566.013.5
ProactiveVideoQA: PAUC (ω=0.5)33.147.237.0
InteractionBench: Total38.6----
StreamArena: Proactive Interaction (Pro)25.511.89.4
### Image
General perception and reading OV2.5-4B Qwen3.5-4B Grounding and spatial OV2.5-4B Qwen3.5-4B
MMStar63.966.9RefCOCO val (Acc@0.5)92.689.1
MMBench-EN dev88.288.8RefCOCOg val (Acc@0.5)88.987.7
RealWorldQA73.974.4RefSpatial-Bench62.129.1
AI2D82.282.4CrossPoint80.533.7
BLINK67.163.6CV-Bench 2D83.380.7
V*-Bench89.581.7CV-Bench 3D94.592.0
OCRBench79.885.2EmbSpatial83.074.7
DocVQA val92.995.2MMSI-Bench33.331.4
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. ## Model Overview
Typeinstruction-tuned vision-language model, LLaVA-OneVision-2.5 architecture
Parameters5.25B total (4B language model plus vision tower and adapter)
Language side32 layers, hidden size 2560, FFN 9216, 16 attention heads / 4 KV heads, linear attention with one full-attention layer every 4
Vision side24 layers, hidden size 1024, patch_size=16, spatial_merge_size=3, attention within a frame
Vocabulary248320, including the 8 streaming protocol tokens
Context length262144
Weightsbfloat16, 3 safetensors shards, about 9.9 GB
## 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.