编码对齐稀疏性作为多模态智能的基础原则
Codec-Aligned Sparsity as a Foundational Principle for Multimodal Intelligence
https://github.com/user-attachments/assets/f83a6b08-1961-4992-81cf-451ddb5b3391
Hypothesis. Artificial general intelligence is, at its core, a compression problem. Effective compression demands resonance: deep learning scales best when its architecture aligns with the fundamental structure of the data. These are the fundamental principles. Yet, modern vision architectures have strayed from these truths: visual signals are highly redundant, while discriminative information, the surprise, is sparse. Current models process dense pixel grids uniformly, wasting vast compute on static background rather than focusing on the predictive residuals that define motion and meaning. We argue that to solve visual understanding, we must align our architectures with the information-theoretic principles of video, i.e., Codecs.
Method. OneVision-Encoder encodes video by compressing predictive visual structure into semantic meaning. By adopting Codec Patchification, OneVision-Encoder abandons uniform computation to focus exclusively on the 3.1%-25% of regions rich in signal entropy. To unify spatial and temporal reasoning under irregular token layouts, OneVision-Encoder employs a shared 3D RoPE and is trained with a large-scale cluster discrimination objective over more than one million semantic concepts, jointly capturing object permanence and motion dynamics.
Evidence. The results validate our core hypothesis: efficiency and accuracy are not a trade-off; they are positively correlated. By resolving the dichotomy between dense grids and sparse semantics, OneVision-Encoder redefines the performance frontier. When integrated into large multimodal models, it consistently outperforms strong vision backbones such as Qwen3-ViT and SigLIP2 across 16 image, video, and document understanding benchmarks, despite using substantially fewer visual tokens and pretraining data. Notably, on video understanding tasks, OneVision-Encoder achieves an average improvement of 4.1% over Qwen3-ViT. Under attentive probing, it achieves state-of-the-art representation quality, with 17.1% and 8.1% Top-1 accuracy improvements over SigLIP2 and DINOv3, respectively, on Diving-48 under identical patch budgets. These results demonstrate that codec-aligned, patch-level sparsity is not an optimization trick, but a foundational principle for next-generation visual generalists, positioning OneVision-Encoder as a scalable engine for universal multimodal intelligence.
The visualization below illustrates four different video processing pipelines.
1. Original Video: a continuous 64-frame sequence that preserves the complete temporal context.
2. Uniform Frame Sampling: a conventional strategy that selects 4–8 evenly spaced frames; while simple and efficient, it is inherently lossy and fails to capture fine-grained inter-frame motion.
3. Temporal Saliency Detection: a global analysis of all 64 frames to identify regions rich in temporal information, including motion patterns, appearance variations, and semantic events.
4. Codec-Style Patch Extraction: selective extraction of the temporally salient patches in a zigzag order, achieving 75–98% compression while retaining critical temporal dynamics.
Standard contrastive learning methods (e.g., CLIP) are fundamentally constrained by batch size, as negative samples are drawn only from the current batch, typically limited to 32K–64K examples. This restriction yields a narrow and incomplete view of the embedding space, often resulting in suboptimal representation learning. In contrast, our approach maintains a global concept bank comprising 2M clustered centers, allowing each training sample to contrast against a diverse and representative set of negatives independent of batch composition. This global contrasting mechanism leads to more discriminative embeddings and well-separated semantic clusters.
We train the model on a mixed dataset comprising 740K samples from LLaVA-OneVision and 800K samples from LLaVA-Video SFT, proceeding directly to Stage-2 fine-tuning. Following a streamlined native-resolution strategy inspired by LLaVA-OneVision, input frames that match the model’s native resolution are fed directly into the network without tiling or cropping, allowing us to fully evaluate the ViT’s native-resolution modeling capability.
[!NOTE] To reproduce these results, use the
llava_nextfolder contents.
Click to expand reproduction instructions
Navigate to the LLaVA-NeXT directory:
cd llava_nextSetup the environment:
# Using Docker (recommended)
docker build -t ov_encoder_llava:26.01 .
docker run -it --gpus all --ipc host --net host --privileged \
-v "$(pwd)":/workspace/OV-Encoder-Llava \
-w /workspace/OV-Encoder-Llava \
ov_encoder_llava:26.01 bashPrepare training data:
Run Stage-2 fine-tuning:
# Configure the training script with your data paths
bash scripts/sft_ov_encoder.shEvaluate the model:
# For video benchmarks
bash scripts/precompute_codec_patch/preprocess_video_benchmark.sh videomme
TASKS="videomme" bash scripts/eval/eval_ov_encoder.sh
# For image benchmarks
TASKS="ai2d,chartqa,docvqa_val" bash scripts/eval/eval_ov_encoder.shFor detailed documentation on training data format, evaluation setup, and troubleshooting, refer to the LLaVA-NeXT README.
[!IMPORTANT] Transformers Version Compatibility:
- ✅
transformers==4.57.3(Recommended): Works withAutoModel.from_pretrained()- ⚠️
transformers>=5.0.0: Not currently supported. We are actively working on a fix.
Note: This model supports native resolution input. For optimal performance:
- Image: 448×448 resolution (pre-trained)
- Video: 224×224 resolution with 256 tokens per frame (pre-trained)
Use CLIP preprocessing from the model repository.
Click to expand code example
…Click to expand installation and usage code
git clone https://github.com/EvolvingLMMs-Lab/OneVision-Encoder.git
cd OneVision-Encoder
pip install -e .from onevision_encoder import OneVisionEncoderModel, OneVisionEncoderConfig
from transformers import AutoImageProcessor
model = OneVisionEncoderModel.from_pretrained(
"lmms-lab-encoder/onevision-encoder-large",
trust_remote_code=True,
attn_implementation="flash_attention_2"
).to("cuda").eval()
preprocessor = AutoImageProcessor.from_pretrained(
"lmms-lab-encoder/onevision-encoder-large",
trust_remote_code=True
)Add codec-style input documentation for temporal saliency-based patch selection.
You can set up the environment using one of the following two methods:
Click to expand setup commands
conda env create -f environment.yml -n ov_encoder
pip install torch==2.7.0 torchvision==0.22.0 torchaudio==2.7.0 --index-url https://download.pytorch.org/whl/cu118
pip install --extra-index-url https://pypi.nvidia.com --upgrade nvidia-dali-cuda110
pip install -r requirements.txtClick to expand Docker commands
docker build -t onevision-encoder:2601 .
docker run -it --rm --gpus all --ipc host --net host --privileged \
-v "$(pwd)":/workspace/OneVision-Encoder \
-w /workspace/OneVision-Encoder \
onevision-encoder:2601 bashInside the container, install the package in editable mode:
Click to expand install command
pip install -e .Click to expand training command
bash shells/ov_encoder_base_stage1_si.shDownload the Stage-1 checkpoint from HuggingFace:
Click to expand download and training commands
git clone https://huggingface.co/lmms-lab-encoder/onevision-encoder-large-siDownload the pretraining data and prepare the data directory as per the instructions in data/README.md.
More documentation will be added soon.
bash shells/ov_encoder_large_stage2_residual_8gpus.shTraining configurations and hyperparameters will be documented soon. For now, please refer to --help for available options.
To evaluate the OneVision Encoder as a vision backbone for LLaVA-NeXT multimodal models, we use the lmms-eval framework with various vision-language benchmarks.
Navigate to the llava_next directory and follow the setup instructions:
For more details, refer to the LLaVA-NeXT documentation.
Click to expand LLaVA-NeXT evaluation setup
cd llava_next
# Using Docker (recommended)
docker build -t ov_encoder_llava:26.01 .
docker run -it --gpus all --ipc host --net host --privileged \
-v "$(pwd)":/workspace/OV-Encoder-Llava \
-w /workspace/OV-Encoder-Llava \
ov_encoder_llava:26.01 bashFor image benchmarks (ChartQA, DocVQA, AI2D, OCRBench, etc.):
Click to expand evaluation commands
# Evaluate on image benchmarks
TASKS="ai2d,chartqa,docvqa_val" bash scripts/eval/eval_ov_encoder.shFor video benchmarks (VideoMME, MVBench, PerceptionTest, etc.), run each benchmark separately:
Click to expand video evaluation commands
# Preprocess video benchmark (one-time setup)
bash scripts/precompute_codec_patch/preprocess_video_benchmark.sh videomme
# Run evaluation
TASKS="videomme" bash scripts/eval/eval_ov_encoder.shTo evaluate the encoder with uniform frame sampling, first navigate to the evaluation directory:
Click to expand evaluation commands
pip install -e .
cd eval_encoderThen run the following command:
bash shells_eval_ap/eval_ov_encoder_large_16frames.shTo evaluate the encoder with codec-style patch selection, first navigate to the evaluation directory:
Click to expand codec evaluation commands
cd eval_encoderThen run the following command
暂无开放 Issues,或尚未同步最近议题。