Mage-VL:微软用视频编解码器的思路重写了多模态模型——4B 参数,视频理解超越 Qwen3-VL-4B

Tech-Experiment
🇨🇳 中文

视频理解模型有一个反常识的问题:它们很会做难题(离线推理、复杂 VQA),但对于”有没有进球”这种人类 0.1 秒就能判断的事情,它们又慢又贵。

这就是微软 Mage-VL 论文里提到的 Moravec 悖论——AI 擅长对人类困难的任务,却在人类轻松的感知任务上失灵。

Mage-VL 的解法来自一个意想不到的地方:视频编解码器


一、核心问题:均匀采样是个坏主意

现有的视频多模态模型做法基本一样:从视频里均匀抽帧,把每一帧压成一排 patch token,送进 LLM。

问题是:视频里大多数帧没有新信息。镜头静止时,第 30 帧和第 31 帧几乎完全一样;背景从不变化,但它占用了大量 token。结果是上下文窗口塞满了冗余,模型处理速度慢,长视频根本塞不进去。

编解码器工程师 40 年前就解决了这个问题:把帧分成 I 帧(关键帧,完整编码)P 帧(预测帧,只编码变化部分)

Mage-VL 把这个逻辑搬进了视觉编码器。


二、Mage-ViT:从零训练的 Codec-ViT

Mage-ViT 是 Mage-VL 的视觉编码器,完全从零训练(不依赖 CLIP/SigLIP 初始化),工作逻辑:

I 帧 → 保留所有 16×16 patch(完整空间信息)
P 帧 → 只保留运动向量和残差能量高的 patch(真正有新内容的区域)

结果:视觉 token 减少超过 75%,同等准确率下推理速度最高快 3.5×

视觉位置用 3D RoPE(时间 4:空间 6:6 比例) 编码,anchor 帧保持完整空间网格,P 帧 patch 在同一时空坐标系里精确定位。

训练数据只需要 5.6 亿无标注图片 + 1 亿无标注视频帧,就匹敌了用数十亿图文对训练的 SigLIP2——这是论文七条核心发现中的第一条。

兼容性设计上,Mage-ViT 对编解码器无感知:传统 H.264/HEVC(走运动向量+残差能量)和神经编解码器 DCVC-RT(走学习到的码率图)都能接,不需要改架构或重新训练。


三、整体架构:两个系统,一个模型

Mage-VL 的完整系统只有一个 checkpoint,但包含两套处理机制:

System 2(慢思考):离线推理

Mage-ViT 输出的稀疏 token → 两层 MLP 投影 → Qwen3-4B-Instruct-2507 因果解码器。

整个推理链统一接受图片、短视频、长视频和超长视频。唯一真正预训练的组件就是 Qwen3-4B,视觉侧全部从零训练。

System 1(快反应):主动流式感知

这是 Mage-VL 最独特的能力。一个轻量级的**认知门控(Cognition Gate)**持续监视视频流,对每个滚动编解码器窗口预测一个 p_speak 分数:

每个编解码器窗口 → System 1 gate → p_speak ≥ τ ? 触发 → System 2 解码 | 保持沉默

足球比赛里,门控在进球前一直沉默,进球瞬间开口说”进球了”。这个机制让模型实现事件驱动的主动评论,而不是每几秒说一次废话。

在 SoccerNet 流式感知评测上,Mage-VL-4B 的 TimVal/F1/ROC-AUC/PR-AUC 全面领先(包括专门在 SoccerNet 上训练的 StreamMind)。


四、训练:五阶段,一个统一模型

微软用了五阶段渐进式有监督课程,没有 RL 后训练,最终产出一个模型覆盖所有能力:

阶段数据目的
1~3.5亿图片描述 + 420万短视频描述多模态对齐
2~5400万图片指令 + 340万视频描述指令微调 + 短时序理解
3中长视频(LLaVA-Video、TimeLens 等)扩展时序视野
435万超长视频(最多 768 帧)长上下文编解码器适配
5~330万流式样本(仅训练门控,冻结其他参数)主动流式感知对齐

AI4AI 数据管道:论文里一个有意思的细节——密集重新标注用了一个 GPT-5 评分器 + Copilot 编程 Agent 的闭环。GPT-5 按评分准则给标注打分,Copilot Agent 根据反馈同时优化 prompt 和渲染代码(比如时间戳叠加方式)。这套管道提升了所有 OCR/图表/感知 benchmark,并衍生出了 SkillOpt-Lite。


五、性能:4B 打 15B

关键数字(与 Qwen3-VL-4B、Phi-4-Reasoning-Vision-15B 对比):

视频理解(Mage-VL 全面领先 Qwen3-VL-4B)

BenchmarkMage-VL-4BQwen3-VL-4BPhi-4-R-V-15B
VideoMME64.059.755.3
LongVideoBench61.357.751.2
MLVU-dev68.761.551.8
VideoEval-Pro45.220.716.8
Timelens-QVHighlight57.434.911.6
VSI-Bench(空间推理)64.353.325.5

图片理解(与 Qwen3-VL-4B 持平)

BenchmarkMage-VL-4BQwen3-VL-4B
DocVQA-val95.1494.69
MMStar67.3262.04
CrossPoint(空间)80.0026.90
EmbSpatial82.6777.50

最值得关注的是 CrossPoint +53.1(80.00 vs 26.90)——这是 3D 空间推理任务,视频动态训练对静态空间理解有意外的迁移效果(论文第5条发现:运动-空间协同)。

在线流式感知(OVO-Bench)

模型RT-AvgOverall
Qwen3-VL-4B(离线)72.863.00
Mage-VL-4B79.8464.00
HERMES-7B69.059.20

Mage-VL-4B 在实时感知任务上以 4B 规模超过了所有 7-9B 的流式专用模型。


六、七条核心发现

论文蒸馏出七条可复用的经验:

  1. 数据高效的 tokenizer:5.6亿图片训练的 Mage-ViT 匹敌数十亿对训练的 SigLIP2
  2. 变分辨率预训练单调提升:token 预算越大,效果越好;定分辨率编码器会饱和或退化
  3. 编解码器 token 化设定了更优的准确率-效率前沿:最高 3.5× 推理加速
  4. 显式 VideoQA SFT 是冗余的:密集视频描述 + 标准图片 SFT 足以获得强零样本 VideoQA 能力
  5. 运动-空间协同:视频动态训练大幅提升静态 2D/3D 空间推理
  6. AI4AI 数据管道:GPT-5 评分 + Agent 代码优化的闭环系统性提升标注质量
  7. Zero-Vision SFT 用于多模态 RL:跳过视觉 SFT、用纯文本推理 SFT,解锁更强的多模态 RL——计算效率更高

七、在 Mac 上使用

已有两个社区实现:

MLX Python(推荐,M4/16GB 可跑)

rsravanreddy/Mage-VL-MLX——完整的 MLX port,4-bit 量化约 3.1GB 显存,M4/16GB 上图片推理 30.6 tok/s,视频推理 11.2 tok/s。

# 安装
pip install mlx-vlm

# 图片推理
python generate.py --image photo.jpg --prompt "描述这张图片"

# 视频推理(8 帧)
python generate.py --video video.mp4 --num-frames 8 --prompt "发生了什么"

Swift/MLXEngine(M5 Max 实测)

xocialize/mage-vl-swift——Swift 实现,通过 imageAnalysisvideoAnalysis 接口统一访问,48/48 token 与 PyTorch 参考实现精确一致。M5 Max 上:图片峰值 11.7GB,16 帧视频峰值 23GB,解码速度 49.2 tok/s。

通过 Transformers(PyTorch,官方)

from transformers import AutoModelForCausalLM, AutoProcessor

model = AutoModelForCausalLM.from_pretrained(
    "microsoft/Mage-VL",
    trust_remote_code=True,
    torch_dtype="auto",
    device_map="auto"
).eval()

processor = AutoProcessor.from_pretrained("microsoft/Mage-VL", trust_remote_code=True)

资源

资源地址
HuggingFace 模型huggingface.co/microsoft/Mage-VL
HuggingFace ViThuggingface.co/microsoft/Mage-ViT
GitHub 代码库github.com/microsoft/Mage
项目主页microsoft.github.io/Mage
论文arXiv:2607.24904
MLX Python portgithub.com/rsravanreddy/Mage-VL-MLX
Swift/MLX portgithub.com/xocialize/mage-vl-swift
发布日期2026-07-29
许可证Apache 2.0

小结

Mage-VL 做了一件在大模型时代不常见的事:借鉴了 40 年视频压缩工程的核心思想,而不是用更多数据和更大模型硬砸。

把这个思路用到视觉编码器上的结果:同等 4B 参数规模,视频理解大幅领先 Qwen3-VL-4B,同时以 3.5× 的速度优势让长视频推理在消费级硬件上真正可行。

主动流式感知(只在有事发生时才说话)是第二个值得关注的能力——这不是靠多模型管道实现的,而是单一 checkpoint 里的一个门控机制,部署成本和普通 VLM 一样。


🇬🇧 English

Mage-VL: Microsoft Rebuilt Multimodal AI with Video Codec Logic — 4B Params, Beats Qwen3-VL-4B on Video

Microsoft published Mage-VL on July 29, 2026. The core insight sounds almost obvious in retrospect: video codecs have been solving the “most frames don’t contain new information” problem for 40 years. Why not use that same logic in the visual encoder?


The Problem: Uniform Frame Sampling Is Wasteful

Most video multimodal models work the same way: sample frames uniformly, flatten each into a grid of patch tokens, feed into the LLM. The problem: in most videos, consecutive frames are nearly identical. Static background, slow camera movement — the context window fills with redundancy, inference is slow, and long videos don’t fit at all.

Codec engineers solved this in the 1980s: split frames into I-frames (full keyframes) and P-frames (predicted frames encoding only the delta). Mage-VL applies exactly this logic to visual encoding.


Mage-ViT: A From-Scratch Codec-ViT

Mage-ViT is Mage-VL’s visual encoder, trained entirely from scratch (no CLIP/SigLIP initialization):

  • I-frames: keep all 16×16 patches
  • P-frames: keep only patches where motion vectors and residual energy are high — the regions where something actually changed

Result: over 75% fewer visual tokens, up to 3.5× wall-clock inference speedup at matched accuracy.

Position encoding uses 3D RoPE (temporal 4 : spatial 6:6) to maintain consistent spatio-temporal coordinates across the sparse token set.

Training efficiency: 560M unlabeled images + 100M unlabeled video frames — no image-text pairs required — and it matches SigLIP2 pretrained on billions of image-text pairs. This is the first of seven key empirical findings the paper reports.

Codec-agnostic by design: the same interface accepts traditional H.264/HEVC (via motion vectors + residual energy) or neural codec DCVC-RT (via its learned rate map) — no architecture change, no retraining.


Architecture: Two Systems, One Checkpoint

System 2 (slow, offline): Mage-ViT sparse tokens → 2-layer MLP projector → Qwen3-4B-Instruct-2507 causal decoder. Same unified path for images, short video, long video, ultra-long video.

System 1 (fast, streaming): A lightweight cognition gate watches each rolling codec window and outputs a per-window p_speak score. When p_speak ≥ τ, the gate opens and the decoder generates a response. Otherwise: silence.

In a soccer broadcast, the gate stays silent through 89 minutes of possession play, then speaks the moment a goal is scored — no multi-agent pipeline, no constant narration, just event-triggered response from a single frozen model.


Performance: 4B Beating 15B

Video understanding (vs Qwen3-VL-4B, same LLM backbone, only the visual encoder differs):

BenchmarkMage-VL-4BQwen3-VL-4BPhi-4-R-V-15B
VideoMME64.059.755.3
VideoEval-Pro45.220.716.8
QVHighlight57.434.911.6
VSI-Bench64.353.325.5
CrossPoint80.026.947.7

Image understanding stays on par with Qwen3-VL-4B (same backbone, same LLM — the ViT swap has negligible static-image cost).

Online streaming (OVO-Bench): Mage-VL-4B Overall 64.00, beating every dedicated streaming model at 7-9B scale.


Seven Key Findings

  1. Codec-ViT from scratch on 560M images matches billion-pair SigLIP2
  2. Variable-resolution pretraining improves monotonically with token budget
  3. Codec tokenization sets a better accuracy–efficiency frontier (3.5× speedup)
  4. Explicit VideoQA SFT is redundant — dense video captions + standard image SFT suffice
  5. Dynamic video training improves static 2D/3D spatial reasoning (motion-spatial synergy)
  6. AI4AI data pipeline (GPT-5 rubric scorer + Copilot coding agent) systematically lifts caption quality
  7. Zero-Vision SFT for multimodal RL: skip visual SFT, use pure-text reasoning SFT → stronger RL, better compute efficiency

Using on Mac

Two community ports are already live:

MLX Python (rsravanreddy/Mage-VL-MLX): 4-bit, ~3.1GB weights, 30.6 tok/s image decode / 11.2 tok/s video decode on M4/16GB.

Swift/MLXEngine (xocialize/mage-vl-swift): imageAnalysis + videoAnalysis APIs, 48/48 token parity with PyTorch reference. M5 Max: image peak 11.7GB, 16-frame video peak 23GB, 49.2 tok/s decode.

Official PyTorch (via Transformers):

from transformers import AutoModelForCausalLM, AutoProcessor
model = AutoModelForCausalLM.from_pretrained(
    "microsoft/Mage-VL", trust_remote_code=True, torch_dtype="auto", device_map="auto"
).eval()

Resources

  • HuggingFace: huggingface.co/microsoft/Mage-VL (80 ❤️)
  • GitHub: github.com/microsoft/Mage
  • Project page: microsoft.github.io/Mage
  • Paper: arXiv:2607.24904 (published July 29, 2026)
  • License: Apache 2.0

💬 评论与讨论

使用 GitHub 账号登录后发表评论