π All Training & Model Code is Open-Sourced!
4
15 commits
3 linked in READMEs
updated Feb 3, 2026
Hongyuan Tao1, Bencheng Liao1, Shaoyu Chen2, Haoran Yin2, Qian Zhang2, Wenyu Liu1, Xinggang Wang1,βοΈ
1Huazhong University of Science and Technology, 2Horizon Robotics
(βοΈ) corresponding author: xgwang@hust.edu.cn
InfiniteVL is a novel linear-complexity Vision-Language Model (VLM) architecture designed to overcome the computational bottlenecks of traditional Transformers in processing unlimited multimodal streams.
By synergizing Sliding Window Attention (SWA) for fine-grained local perception and Gated DeltaNet for efficient long-term memory, InfiniteVL achieves a "best of both worlds" balance. It delivers competitive performance on standard benchmarks (comparable to Qwen2.5-VL) while enabling constant-memory inference and high-throughput streaming.
Dec. 10th, 2025: We release the InfiniteVL model weights and inference code! Please check Model Zoo.Dec. 10th, 2025: We release our paper on Arxiv.
InfiniteVL adopts a hybrid architecture that synergizes the efficiency of linear attention with the precision of window-based attention. The model comprises a Vision Encoder (adapted from Qwen2.5-VL), a Projection MLP, and a Decoder-only LLM Backbone.
Hybrid Block Design: The LLM backbone consists of 9 Hybrid Blocks. Within each block, we strategically interleave:
Constant Memory Footprint: Unlike traditional Transformers where the Key-Value (KV) cache grows linearly with sequence length ($O(N)$), the Gated DeltaNet layers compress history into a fixed-size memory state (e.g., $16 \times 128 \times 256$). This enables constant memory usage and constant inference latency, even when processing unlimited input streams.
Seamless Integration: By combining SWA and Gated DeltaNet, InfiniteVL achieves the "best of both worlds":
To achieve strong multimodal performance with minimal training resources, InfiniteVL employs a three-stage progressive training strategy. This approach allows our linear-complexity model to inherit the vast knowledge of a Transformer teacher before adapting to long-context scenarios.
InfiniteVL is engineered for unlimited-input scenarios. Unlike Transformer-based models where cost grows linearly with history, InfiniteVL maintains constant computational cost and memory usage.
Hardware Setup: All efficiency results are measured on a single NVIDIA RTX 4090 GPU.
InfiniteVL achieves state-of-the-art performance among linear-complexity VLMs. Crucially, thanks to our Hybrid Architecture and High-quality training strategies, it overcomes the traditional weakness of linear models in information-intensive tasks (e.g., OCR, Document Understanding), achieving results comparable to top-tier Transformer VLMs.
Key Takeaways:
We release two versions of InfiniteVL-4B to cater to different application scenarios.
| Model | Stage | Description | Training context Length | Download |
|---|---|---|---|---|
| InfiniteVL-4B | Stage 2 | Best Generalist / Base. The checkpoint directly after Instruction SFT. It delivers the peak foundational performance on standard multimodal benchmarks (e.g., OCR, MMMU, MathVista) and preserves the most robust knowledge. | 8K | π€ Hugging Face |
| InfiniteVL-4B-LongSFT | Stage 3 | Long-Context Adapted. Fine-tuned using only a small amount of long-sequence multimodal data. It successfully activates length generalization for streaming scenarios, though its full potential on extreme contexts is not yet fully exploited. | 32K | π€ Hugging Face |
π‘ Recommendations:
- For Long-Context Inference: Please use the Stage 3 model. It enables stable streaming inference and avoids memory explosion.
- For Training / Fine-tuning: We strongly recommend using the Stage 2 model as your starting point. Since it maintains the strongest general capabilities and hasn't shifted towards the specific long-context distribution, it serves as the best foundation for adaptation to new tasks or domains.
We recommend using Anaconda or Miniconda to manage the environment. The code is tested on Python 3.11 + PyTorch 2.6.0 + CUDA 12.1.
1. Create and activate a virtual environment:
conda create -n infinitevl python=3.11 -y
conda activate infinitevl
2. Install Environment:
The core environments are list as follows:
# --- Core Deep Learning ---
torch==2.6.0
torchvision==0.21.0
torchaudio==2.6.0
transformers==4.57.0
accelerate==1.8.1
# --- Vision & Multimodal ---
qwen-vl-utils==0.0.11
decord==0.6.0
opencv-python==4.11.0.86
pillow==10.4.0
timm==1.0.22
einops==0.8.1
# --- Linear Attention & Kernels (Critical) ---
# Note: These often require specific CUDA environments to build
flash-attn==2.7.4.post1
flash-linear-attention==0.4.0
fla-core==0.4.0
causal-conv1d==1.5.0.post5
triton==3.2.0
import torch
from transformers import AutoModelForCausalLM, AutoProcessor
from qwen_vl_utils import process_vision_info
# Load Model
model_path = "hustvl/InfiniteVL" # Replace with your HF repo ID
model = AutoModelForCausalLM.from_pretrained(
model_path,
torch_dtype=torch.bfloat16,
device_map="auto",
trust_remote_code=True
)
processor = AutoProcessor.from_pretrained(model_path, trust_remote_code=True)
# Prepare Inputs
messages = [
{
"role": "user",
"content": [
{
"type": "image",
"image": "https://qianwen-res.oss-cn-beijing.aliyuncs.com/Qwen-VL/assets/demo.jpeg",
},
{"type": "text", "text": "Describe this image."},
],
}
]
# Process Inputs
text = processor.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
image_inputs, video_inputs = process_vision_info(messages)
inputs = processor(
text=[text],
images=image_inputs,
videos=video_inputs,
padding=True,
return_tensors="pt",
).to(model.device)
# Generate
generated_ids = model.generate(**inputs, max_new_tokens=128)
generated_ids_trimmed = [
out_ids[len(in_ids) :] for in_ids, out_ids in zip(inputs.input_ids, generated_ids)
]
output_text = processor.batch_decode(
generated_ids_trimmed, skip_special_tokens=True, clean_up_tokenization_spaces=False
)
print(output_text[0])
InfiniteVL supports inputting multiple images in a single turn for comparison or storytelling.
messages = [
{
"role": "user",
"content": [
{
"type": "image",
"image": "https://qianwen-res.oss-cn-beijing.aliyuncs.com/Qwen-VL/assets/demo.jpeg",
},
{
"type": "image",
"image": "https://qianwen-res.oss-cn-beijing.aliyuncs.com/Qwen-VL/assets/demo.jpeg",
},
{"type": "text", "text": "What are the similarities between these two images?"},
],
}
]
# Process
text = processor.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
image_inputs, video_inputs = process_vision_info(messages)
inputs = processor(
text=[text],
images=image_inputs,
videos=video_inputs,
padding=True,
return_tensors="pt",
).to(model.device)
# Generate
generated_ids = model.generate(**inputs, max_new_tokens=128)
generated_ids_trimmed = [
out_ids[len(in_ids) :] for in_ids, out_ids in zip(inputs.input_ids, generated_ids)
]
print(processor.batch_decode(generated_ids_trimmed, skip_special_tokens=True)[0])
messages = [
{
"role": "user",
"content": [
{
"type": "video",
"video": "file:///path/to/video.mp4",
"max_pixels": 360 * 420,
"fps": 1.0,
},
{"type": "text", "text": "Describe this video."},
],
}
]
# Process
text = processor.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
image_inputs, video_inputs = process_vision_info(messages)
inputs = processor(
text=[text],
images=image_inputs,
videos=video_inputs,
padding=True,
return_tensors="pt",
).to(model.device)
# Generate
generated_ids = model.generate(**inputs, max_new_tokens=128)
generated_ids_trimmed = [
out_ids[len(in_ids) :] for in_ids, out_ids in zip(inputs.input_ids, generated_ids)
]
print(processor.batch_decode(generated_ids_trimmed, skip_special_tokens=True)[0])
Unlike Transformer-based VLMs where the KV cache grows dynamically, InfiniteVL maintains a constant-size memory state. This unique property allows us to use CUDA Graphs to capture the entire computation graph for both streaming prefill and decoding, eliminating kernel launch overheads and maximizing GPU utilization.
This is the key technology behind our 24 FPS real-time streaming performance.
Unlike Transformer-based VLMs where the KV cache grows dynamically, InfiniteVL maintains a constant-size memory state. This unique property allows us to use CUDA Graphs to capture the entire computation graph for streaming prefill, eliminating kernel launch overheads.
We provide a complete script in examples/demo_streaming_inference.py to demonstrate this capability.
π₯ Simulation Note: This script simulates a real-time streaming scenario by reading a local video file frame-by-frame. It treats the video as a continuous data stream, updating the global linear memory state on-the-fly without retraining.
β οΈ Requirement: This demo relies on the specialized model implementation (supporting
StaticCachePreallocand CUDA Graphs) located in theinfinitevl/infinitevl_streamingdirectory. Please ensure your environment is set up correctly to import these modules.
# Make sure you are in the project root
python examples/demo_streaming_inference.py \
--model_path /path/to/InfiniteVL-4B \
--video_path assets/demo.mp4 \
--fps 30
In addition to streaming prefill, InfiniteVL natively supports CUDA Graph-accelerated decoding. By capturing the decoding step into a static graph, we can achieve extremely low-latency token generation, further enhancing the responsiveness of real-time interactions.
π§ Coming Soon: The code for accelerated decoding is currently being refactored and cleaned up. We are working hard to release it as soon as possible. Please stay tuned!
We provide visualization cases to demonstrate InfiniteVL's robust performance across diverse scenarios, ranging from information-intensive static tasks to ultra-long streaming video understanding.
InfiniteVL effectively overcomes the traditional limitations of linear attention in detailed visual perception. By combining Sliding Window Attention with Gated DeltaNet, it excels at Dense Text Recognition (OCR), Chart Interpretation, and Complex Scene Description, delivering performance comparable to full-attention Transformers.
The core strength of InfiniteVL lies in its ability to maintain coherent memory over unlimited input streams.
The examples below demonstrate a continuous street-view video stream. InfiniteVL maintains a constant memory state and accurately answers questions at various timestamps (e.g., Frame 3100, ~1M tokens processed), recalling specific details like "NBC Studios" text or the color of a pedestrian's bag without forgetting.
If you have any questions, please contact Hongyuan Tao via email (hongyuantao@hust.edu.cn).
If you find InfiniteVL useful for your research or applications, please consider citing our paper:
@article{tao2025infinitevl,
title={InfiniteVL: Synergizing Linear and Sparse Attention for Highly-Efficient, Unlimited-Input Vision-Language Models},
author={Tao, Hongyuan and Liao, Bencheng and Chen, Shaoyu and Yin, Haoran and Zhang, Qian and Liu, Wenyu and Wang, Xinggang},
journal={arXiv preprint},
year={2025}
}
InfiniteVL is built upon the giants of the open-source community. We would like to express our gratitude to:
π All Training & Model Code is Open-Sourced!
4
15 commits
3 linked in READMEs
updated Feb 3, 2026
Hongyuan Tao1, Bencheng Liao1, Shaoyu Chen2, Haoran Yin2, Qian Zhang2, Wenyu Liu1, Xinggang Wang1,βοΈ
1Huazhong University of Science and Technology, 2Horizon Robotics
(βοΈ) corresponding author: xgwang@hust.edu.cn
InfiniteVL is a novel linear-complexity Vision-Language Model (VLM) architecture designed to overcome the computational bottlenecks of traditional Transformers in processing unlimited multimodal streams.
By synergizing Sliding Window Attention (SWA) for fine-grained local perception and Gated DeltaNet for efficient long-term memory, InfiniteVL achieves a "best of both worlds" balance. It delivers competitive performance on standard benchmarks (comparable to Qwen2.5-VL) while enabling constant-memory inference and high-throughput streaming.
Dec. 10th, 2025: We release the InfiniteVL model weights and inference code! Please check Model Zoo.Dec. 10th, 2025: We release our paper on Arxiv.
InfiniteVL adopts a hybrid architecture that synergizes the efficiency of linear attention with the precision of window-based attention. The model comprises a Vision Encoder (adapted from Qwen2.5-VL), a Projection MLP, and a Decoder-only LLM Backbone.
Hybrid Block Design: The LLM backbone consists of 9 Hybrid Blocks. Within each block, we strategically interleave:
Constant Memory Footprint: Unlike traditional Transformers where the Key-Value (KV) cache grows linearly with sequence length ($O(N)$), the Gated DeltaNet layers compress history into a fixed-size memory state (e.g., $16 \times 128 \times 256$). This enables constant memory usage and constant inference latency, even when processing unlimited input streams.
Seamless Integration: By combining SWA and Gated DeltaNet, InfiniteVL achieves the "best of both worlds":
To achieve strong multimodal performance with minimal training resources, InfiniteVL employs a three-stage progressive training strategy. This approach allows our linear-complexity model to inherit the vast knowledge of a Transformer teacher before adapting to long-context scenarios.
InfiniteVL is engineered for unlimited-input scenarios. Unlike Transformer-based models where cost grows linearly with history, InfiniteVL maintains constant computational cost and memory usage.
Hardware Setup: All efficiency results are measured on a single NVIDIA RTX 4090 GPU.
InfiniteVL achieves state-of-the-art performance among linear-complexity VLMs. Crucially, thanks to our Hybrid Architecture and High-quality training strategies, it overcomes the traditional weakness of linear models in information-intensive tasks (e.g., OCR, Document Understanding), achieving results comparable to top-tier Transformer VLMs.
Key Takeaways:
We release two versions of InfiniteVL-4B to cater to different application scenarios.
| Model | Stage | Description | Training context Length | Download |
|---|---|---|---|---|
| InfiniteVL-4B | Stage 2 | Best Generalist / Base. The checkpoint directly after Instruction SFT. It delivers the peak foundational performance on standard multimodal benchmarks (e.g., OCR, MMMU, MathVista) and preserves the most robust knowledge. | 8K | π€ Hugging Face |
| InfiniteVL-4B-LongSFT | Stage 3 | Long-Context Adapted. Fine-tuned using only a small amount of long-sequence multimodal data. It successfully activates length generalization for streaming scenarios, though its full potential on extreme contexts is not yet fully exploited. | 32K | π€ Hugging Face |
π‘ Recommendations:
- For Long-Context Inference: Please use the Stage 3 model. It enables stable streaming inference and avoids memory explosion.
- For Training / Fine-tuning: We strongly recommend using the Stage 2 model as your starting point. Since it maintains the strongest general capabilities and hasn't shifted towards the specific long-context distribution, it serves as the best foundation for adaptation to new tasks or domains.
We recommend using Anaconda or Miniconda to manage the environment. The code is tested on Python 3.11 + PyTorch 2.6.0 + CUDA 12.1.
1. Create and activate a virtual environment:
conda create -n infinitevl python=3.11 -y
conda activate infinitevl
2. Install Environment:
The core environments are list as follows:
# --- Core Deep Learning ---
torch==2.6.0
torchvision==0.21.0
torchaudio==2.6.0
transformers==4.57.0
accelerate==1.8.1
# --- Vision & Multimodal ---
qwen-vl-utils==0.0.11
decord==0.6.0
opencv-python==4.11.0.86
pillow==10.4.0
timm==1.0.22
einops==0.8.1
# --- Linear Attention & Kernels (Critical) ---
# Note: These often require specific CUDA environments to build
flash-attn==2.7.4.post1
flash-linear-attention==0.4.0
fla-core==0.4.0
causal-conv1d==1.5.0.post5
triton==3.2.0
import torch
from transformers import AutoModelForCausalLM, AutoProcessor
from qwen_vl_utils import process_vision_info
# Load Model
model_path = "hustvl/InfiniteVL" # Replace with your HF repo ID
model = AutoModelForCausalLM.from_pretrained(
model_path,
torch_dtype=torch.bfloat16,
device_map="auto",
trust_remote_code=True
)
processor = AutoProcessor.from_pretrained(model_path, trust_remote_code=True)
# Prepare Inputs
messages = [
{
"role": "user",
"content": [
{
"type": "image",
"image": "https://qianwen-res.oss-cn-beijing.aliyuncs.com/Qwen-VL/assets/demo.jpeg",
},
{"type": "text", "text": "Describe this image."},
],
}
]
# Process Inputs
text = processor.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
image_inputs, video_inputs = process_vision_info(messages)
inputs = processor(
text=[text],
images=image_inputs,
videos=video_inputs,
padding=True,
return_tensors="pt",
).to(model.device)
# Generate
generated_ids = model.generate(**inputs, max_new_tokens=128)
generated_ids_trimmed = [
out_ids[len(in_ids) :] for in_ids, out_ids in zip(inputs.input_ids, generated_ids)
]
output_text = processor.batch_decode(
generated_ids_trimmed, skip_special_tokens=True, clean_up_tokenization_spaces=False
)
print(output_text[0])
InfiniteVL supports inputting multiple images in a single turn for comparison or storytelling.
messages = [
{
"role": "user",
"content": [
{
"type": "image",
"image": "https://qianwen-res.oss-cn-beijing.aliyuncs.com/Qwen-VL/assets/demo.jpeg",
},
{
"type": "image",
"image": "https://qianwen-res.oss-cn-beijing.aliyuncs.com/Qwen-VL/assets/demo.jpeg",
},
{"type": "text", "text": "What are the similarities between these two images?"},
],
}
]
# Process
text = processor.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
image_inputs, video_inputs = process_vision_info(messages)
inputs = processor(
text=[text],
images=image_inputs,
videos=video_inputs,
padding=True,
return_tensors="pt",
).to(model.device)
# Generate
generated_ids = model.generate(**inputs, max_new_tokens=128)
generated_ids_trimmed = [
out_ids[len(in_ids) :] for in_ids, out_ids in zip(inputs.input_ids, generated_ids)
]
print(processor.batch_decode(generated_ids_trimmed, skip_special_tokens=True)[0])
messages = [
{
"role": "user",
"content": [
{
"type": "video",
"video": "file:///path/to/video.mp4",
"max_pixels": 360 * 420,
"fps": 1.0,
},
{"type": "text", "text": "Describe this video."},
],
}
]
# Process
text = processor.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
image_inputs, video_inputs = process_vision_info(messages)
inputs = processor(
text=[text],
images=image_inputs,
videos=video_inputs,
padding=True,
return_tensors="pt",
).to(model.device)
# Generate
generated_ids = model.generate(**inputs, max_new_tokens=128)
generated_ids_trimmed = [
out_ids[len(in_ids) :] for in_ids, out_ids in zip(inputs.input_ids, generated_ids)
]
print(processor.batch_decode(generated_ids_trimmed, skip_special_tokens=True)[0])
Unlike Transformer-based VLMs where the KV cache grows dynamically, InfiniteVL maintains a constant-size memory state. This unique property allows us to use CUDA Graphs to capture the entire computation graph for both streaming prefill and decoding, eliminating kernel launch overheads and maximizing GPU utilization.
This is the key technology behind our 24 FPS real-time streaming performance.
Unlike Transformer-based VLMs where the KV cache grows dynamically, InfiniteVL maintains a constant-size memory state. This unique property allows us to use CUDA Graphs to capture the entire computation graph for streaming prefill, eliminating kernel launch overheads.
We provide a complete script in examples/demo_streaming_inference.py to demonstrate this capability.
π₯ Simulation Note: This script simulates a real-time streaming scenario by reading a local video file frame-by-frame. It treats the video as a continuous data stream, updating the global linear memory state on-the-fly without retraining.
β οΈ Requirement: This demo relies on the specialized model implementation (supporting
StaticCachePreallocand CUDA Graphs) located in theinfinitevl/infinitevl_streamingdirectory. Please ensure your environment is set up correctly to import these modules.
# Make sure you are in the project root
python examples/demo_streaming_inference.py \
--model_path /path/to/InfiniteVL-4B \
--video_path assets/demo.mp4 \
--fps 30
In addition to streaming prefill, InfiniteVL natively supports CUDA Graph-accelerated decoding. By capturing the decoding step into a static graph, we can achieve extremely low-latency token generation, further enhancing the responsiveness of real-time interactions.
π§ Coming Soon: The code for accelerated decoding is currently being refactored and cleaned up. We are working hard to release it as soon as possible. Please stay tuned!
We provide visualization cases to demonstrate InfiniteVL's robust performance across diverse scenarios, ranging from information-intensive static tasks to ultra-long streaming video understanding.
InfiniteVL effectively overcomes the traditional limitations of linear attention in detailed visual perception. By combining Sliding Window Attention with Gated DeltaNet, it excels at Dense Text Recognition (OCR), Chart Interpretation, and Complex Scene Description, delivering performance comparable to full-attention Transformers.
The core strength of InfiniteVL lies in its ability to maintain coherent memory over unlimited input streams.
The examples below demonstrate a continuous street-view video stream. InfiniteVL maintains a constant memory state and accurately answers questions at various timestamps (e.g., Frame 3100, ~1M tokens processed), recalling specific details like "NBC Studios" text or the color of a pedestrian's bag without forgetting.
If you have any questions, please contact Hongyuan Tao via email (hongyuantao@hust.edu.cn).
If you find InfiniteVL useful for your research or applications, please consider citing our paper:
@article{tao2025infinitevl,
title={InfiniteVL: Synergizing Linear and Sparse Attention for Highly-Efficient, Unlimited-Input Vision-Language Models},
author={Tao, Hongyuan and Liao, Bencheng and Chen, Shaoyu and Yin, Haoran and Zhang, Qian and Liu, Wenyu and Wang, Xinggang},
journal={arXiv preprint},
year={2025}
}
InfiniteVL is built upon the giants of the open-source community. We would like to express our gratitude to: