Video-XL-2 supply two efficiency optimization strategy: chunk-based prefill and bi-level kvs decoding. You can flexibly choose them based on your needs.
TODO
[X] Release model weights.
[X] Release the inference code w/o. efficiency optimization.
[X] Release the inference code w. chunk-based prefill.
[ ] Release the inference code w. chunk-based prefill & bi-level kvs decoding.
**Tips: Our inference code still under updating, you could update it by assign "--include '\.py'" in huggingface-cli to only update the inference code, avoid downloading the whole model.
Chunk-based prefill significantly reduces memory demands and response latency by encoding video input in a streaming manner. This advantage becomes particularly noticeable with longer videos.
To enable this mode, you need to set enable_chunk_prefill to True and configure the prefill_config parameters:
chunk_prefill_mode: This defines the mode of chunk-based prefill. We currently support two modes:
streaming: This mode encodes video chunks streamingly.
mask: This mode achieves an equivalent effect using an attention mask. However, due to a lack of underlying optimized operators, the mask mode doesn't offer any efficiency improvements at this time. We recommend using the streaming mode.
chunk_size: This parameter specifies the size of each chunk processed in a single forward pass. The unit for chunk_size is 4 frames (e.g., chunk_size = 4 means processing visual tokens from 4×4 = 16 frames at once). A larger chunk_size will gradually approach full attention, resulting in a higher peak memory usage.
step_size: This controls the step size between chunks. A smaller step_size leads to more continuous information transfer between chunks but may slightly decrease inference speed.
offload: This boolean parameter determines whether to offload the key-value states (KVs) of each chunk to the CPU during forwarding. While this can reduce memory usage, it will also lower the inference speed.
chunk_size_for_vision_tower: For longer video inputs, the vision tower can become a memory bottleneck during forwarding. To mitigate this, we also support a streaming mode for the vision tower, which is controlled by this parameter. The unit for chunk_size_for_vision_tower is 1 frames. And, the value of chunk_size_for_vision_tower must be a multiple of 4.
**Tip: Currently, chunk-based prefill only supports the 'sdpa' attention implementation.*
@article{shu2024video,
title={Video-XL: Extra-Long Vision Language Model for Hour-Scale Video Understanding},
author={Shu, Yan and Zhang, Peitian and Liu, Zheng and Qin, Minghao and Zhou, Junjie and Huang, Tiejun and Zhao, Bo},
journal={arXiv preprint arXiv:2409.14485},
year={2024}
}
@article{liu2025video,
title={Video-XL-Pro: Reconstructive Token Compression for Extremely Long Video Understanding},
author={Liu, Xiangrui and Shu, Yan and Liu, Zheng and Li, Ao and Tian, Yang and Zhao, Bo},
journal={arXiv preprint arXiv:2503.18478},
year={2025}
}
Files
27 files · 16.3 GBWeights 16.3 GB (safetensors). Sizes and sha256 from the signed manifest.