Ovis-U1 Technical Report

Paper: arXiv:2506.23044 Code: AIDC-AI/Ovis-U1; AIDC-AI/Ovis-U1-3B Code reference: GitHub main @ 55b7ce25 (2025-12-02); HF model repo main @ cbc005dd (2025-07-03)

1. Motivation (研究动机)

Ovis-U1 关注的问题不是单纯把一个 VLM 和一个 diffusion model 拼起来,而是:一个小参数量 unified model 能否同时做 multimodal understanding、text-to-image generation 和 instruction-based image editing,并且让这些任务在训练中互相增益。论文明确指出两个基础挑战:第一,visual decoder 必须能无缝接上 MLLM 的 text/vision embedding,否则生成侧只能依赖冻结 MLLM 的表征,难以真正统一;第二,理解任务与生成任务如何一起训练,才不会出现 generation 损害 understanding、或 understanding 对 generation 没帮助的负迁移。

现有 unified model 的常见路线有两类局限:一类保留冻结 MLLM,仅在外部接 generation decoder,优点是稳定但理解 backbone 没有被 generation/editing 反馈重新对齐;另一类可以生成图像,但在理解 benchmark 上往往低于对应 MLLM backbone。Ovis-U1 的动机是从 pretrained LLM 出发重新走一套多阶段训练,让视觉编码、adapter、LLM、refiner 和 diffusion decoder 在不同阶段获得明确职责,而不是一次性端到端混训。

这个问题值得做,是因为如果统一训练真的成立,模型就不只是“会三种接口”,而是可以用生成/编辑数据改善视觉-文本对齐、用理解训练改善 generation condition 的语义质量。论文在 Table 10、Table 11 和 Table 12 专门做了这类互相增益实验:unified training 让 OpenCompass 平均分从 63.33 到 64.47;generation stages 让 DPG-Bench 从 Stage1 的 83.81 增至 Stage5 的 85.43。对 unified model 研究来说,这比单项 SOTA 更关键。

2. Idea (核心思想)

核心 insight:Ovis-U1 把“理解”和“生成/编辑”都压到同一个 MLLM 条件空间里,但只在合适阶段训练相应模块;visual encoder/adapter/LLM 负责把输入图文变成语义条件,bidirectional token refiner 把 LLM 最后两层 hidden states 整理成 diffusion decoder 可用的条件,MMDiT visual decoder 再执行 image generation/editing。

关键创新有三点:第一,decoder 不是简单接 CLIP/text encoder,而是接 Ovis-style MLLM hidden states,并用 refiner 学习 token 之间的双向交互;第二,训练是六阶段 curriculum,分离 visual decoder pretraining、adapter/encoder alignment、understanding learning、generation learning 和 generation fine-tuning;第三,论文显式验证了“生成帮助理解”和“理解帮助生成”:generation/editing 数据参与 Stage1–2 对齐提升 understanding,Stage1–3 优化后的 text/image embedding 又提升 Stage4–5 generation。

与 Janus-Pro / BAGEL / OmniGen2 等统一模型相比,Ovis-U1 的差异在于它不追求最大参数量,而是用 2.4B understanding 侧 + 1.2B generation 侧的组合,在 3.6B 总参数下覆盖三类任务;相比直接冻结 MLLM 的 generation model,它把 LLM 和 visual encoder 纳入训练流程,使 generation 任务可以反向改进 visual-text alignment。

3. Method (方法)

3.1 Overall framework

Figure 1 解读:这张图展示 Ovis-U1 的能力范围:同一模型可处理 image understanding、text-to-image generation 和 image editing。它强调的不是三套模型共用入口,而是一个 unified framework 在输入图像、文本 prompt、编辑指令之间切换任务。

Figure 2 解读:左侧是整体架构,输入文本经 text tokenizer,输入图像经 visual encoder + adapter 得到 visual semantic embedding;MLLM 输出既可以通过 text detokenizer 生成文本,也可以经 refiner + visual decoder 生成图像。中间的 visual decoder 使用 MMDiT/flow matching 风格的 double stream / combined stream 结构,把 text/semantic condition、context image latent 和 noise token 一起处理。右侧 refiner 使用两层 Transformer block 与 learnable [CLS] token,让 LLM hidden states 中的局部 token 信息和全局语义先交互,再进入 decoder。

整体路径可以理解为:understanding 任务走 visual encoder → adapter → MLLM → text detokenizer;text-to-image 任务走 prompt → MLLM hidden states → refiner → MMDiT decoder → VAE decoder;image editing 额外把输入图像经 VAE encoder 编成 detailed visual tokens,作为 visual stream 的条件。这样做的关键是让“输入图像的语义理解”和“输出图像的扩散生成”共享 MLLM 条件空间,而不是完全独立。

3.2 Model components

LLM 与 text tokenizer

LLM 使用 Qwen3-1.7B,Table 1 报告 LLM 参数量 1720M。与直接使用现成 MLLM 且冻结不同,Ovis-U1 从 language model 初始化,在 Stage3 对 visual encoder、adapter 和 LLM 进行 understanding learning。论文的直觉是:generation/editing 数据能帮助视觉 encoder/adapter 形成更可生成的视觉-文本对齐,而 understanding learning 又让后续 generation condition 变得语义更准确。

Visual encoder 与 adapter

Visual encoder 初始化自 apple/aimv2-large-patch14-448,参数量 578M;adapter 135M。encoder 被改造成能原生处理任意分辨率:固定位置编码通过插值适配,加入 2D RoPE 增强空间感知,并使用 NaViT-style token packing / variable-length sequence attention 处理不同尺寸图像。adapter 延续 Ovis 的 probabilistic tokenization:pixel shuffle 做空间压缩,linear head + softmax 得到视觉词表上的概率分布,再对 learnable embedding table 求加权平均送入 LLM。

Visual decoder 与 VAE

Visual decoder 是约 1B 的 diffusion Transformer:论文借鉴 FLUX / MMDiT + RoPE,但把层数和 attention heads 从 57/24 缩到 27/16,得到 1046M 参数 decoder。训练目标是 flow matching;VAE 使用 madebyollin/sdxl-vae-fp16-fix,4-channel latent,参数 84M,并在 unified training 中冻结。text-to-image 时,visual semantic embedding 与 text embedding 一起作为 semantic condition;image editing 时,输入图像还会通过 VAE encoder 变成包含细节的 context latent tokens。

Bidirectional token refiner

Refiner 参数量 81M,由两层带 modulation 的 Transformer block 组成。论文发现 LLM 不同层含有不同粒度的信息,因此 refiner 输入不是单层 hidden state,而是最后一层与倒数第二层拼接后的 token features。为了替代 CLIP 的 global feature,Ovis-U1 加入 learnable [CLS] token,让它与 LLM token 一起经过 refiner,聚合全局条件。Table 9 证明这种设计有意义:在约 10M 训练数据上,Last-Layer Features 的 DPG-Bench 只有 80.97,Concatenated Layer Features 恢复到 81.48;在约 50M 数据上,Clip-Free + CLS Token 的 DPG-Bench 达 83.81。

3.3 Six-stage training pipeline

Figure 3 解读:六阶段训练用 snowflake/flame 标明冻结与可训练模块。Stage0 只训练 refiner + decoder 建立基础 T2I;Stage1–2 用 understanding/T2I/editing 数据训练 adapter 与 visual encoder,使视觉-文本 embedding 对齐;Stage3 训练 understanding 侧并随后冻结;Stage4 再训练 refiner + decoder 适配 Stage3 后更好的 embedding;Stage5 加入 T2I + editing 做生成侧 fine-tuning。

StageTrained ParamsTaskSteps (K)Batch SizeLR作用
0refiner + decoderT2I Gen.50010241e-4从随机初始化训练 1B visual decoder,使其能从 LLM embedding 生成图像
1adapterUnd., T2I Gen., Editing1.5181925e-4让随机 adapter 学会连接 visual encoder 与 LLM,多任务数据参与对齐
2visual encoder + adapterUnd., T2I Gen., Editing2.6381921e-4继续对齐视觉/文本 embedding,generation task 帮助跨模态 alignment
3visual encoder + adapter + LLMUnd.2322405e-5学习理解能力,之后冻结以保留 understanding
4refiner + decoderT2I Gen.2752565e-5适配 Stage3 优化后的 text/image embedding,提升生成
5refiner + decoderT2I Gen., Editing3252565e-5加入 editing 数据做最终 generation fine-tuning

这里的“互相帮助”不是口头 claim,而是体现在训练顺序上:Stage1–2 把 generation/editing 放入 encoder/adapter 对齐阶段,用生成任务约束视觉 embedding;Stage4–5 又利用 Stage1–3 得到的更好 text/image embedding 训练 decoder。Table 10 说明前者提升 understanding;Table 11–12 说明后者提升 generation。

3.4 Data composition

Ovis-U1 使用三类数据。Multimodal understanding data 包括 COYO、Wukong、Laion、ShareGPT4V、CC3M,以及内部数据;论文说明有数据清洗 pipeline 用于过滤噪声、提升 caption 质量并调整配比。Text-to-image data 来自 Laion5B 与 JourneyDB:Laion5B 先筛选 aesthetic score > 6 的样本,再由 Qwen 生成详细描述,构成 Laion-aes6。Image+text-to-image data 包含四组:OmniEdit / UltraEdit / SeedEdit 的编辑数据;Subjects200K / SynCD / StyleBooth 的 reference-image generation 数据;MultiGen 20M 的 canny/depth/inpainting/outpainting 等 pixel-level control 数据;以及内部 style-driven、content removal、style translation、de-noise/de-blur、colorization、text rendering 等数据。

3.5 Objectives and inference formulas

论文没有给出完整训练 loss 公式,只明确 visual decoder 使用 flow matching,understanding 侧遵循 Ovis 的语言建模/视觉 token 对齐训练。可将理解侧写成 masked language modeling / next-token objective: 其中视觉 placeholder 展开为 visual token embedding,非文本 label 使用 ignore mask。生成侧论文只说使用 flow matching;released HF inference code 中采样采用 Euler update: text-to-image classifier-free guidance 在 code 中对应: image editing 的 released code 使用双条件 CFG: 其中 是无图无文本条件, 是只有输入图像条件, 是输入图像与编辑指令共同条件。

3.6 Pseudocode from released implementation

Code reference: GitHub main @ 55b7ce25 (2025-12-02); HF model repo main @ cbc005dd (2025-07-03) — pseudocode and mapping based on this code state.

Condition extraction from MLLM hidden states

def build_generation_condition(model, input_ids, pixel_values, grid_thws, attention_mask):
    _, inputs_embeds, labels, attn, img_labels = model.merge_multimodal(
        text_input_ids=input_ids,
        text_attention_masks=attention_mask,
        text_labels=None,
        pixel_values=pixel_values,
        grid_thws=grid_thws,
        left_padding=True,
    )
    outputs = model.llm(
        inputs_embeds=inputs_embeds.detach().to(model.llm.device),
        labels=labels.to(model.llm.device),
        attention_mask=attn.to(model.llm.device),
        output_hidden_states=True,
    )
    cond = torch.cat([outputs.hidden_states[-1], outputs.hidden_states[-2]], dim=-1)
    return {"txt": cond}

Text-to-image sampling

def txt2img(model, prompt_inputs, width=1024, height=1024, steps=50, seed=42, txt_cfg=5.0):
    cond = model.generate_condition(**prompt_inputs)
    uncond = model.generate_condition(**build_blank_image_prompt("<image>\nGenerate an image."))
    image = model.visual_generator.generate_image(
        cond=cond,
        no_both_cond=uncond,
        no_txt_cond=None,
        height=height,
        width=width,
        num_steps=steps,
        seed=seed,
        txt_cfg=txt_cfg,
        img_cfg=1.0,
        output_type="pil",
    )
    return image

Image editing with image/text CFG

def edit_image(model, input_image, instruction, width, height, steps=50, img_cfg=1.5, txt_cfg=6.0):
    vae_pixels, cond_img_ids = model.visual_generator.process_image_aspectratio(input_image, (width, height))[1:]
    no_both_cond = model.generate_condition(**build_blank_image_prompt("<image>\nGenerate an image."))
    no_txt_cond = model.generate_condition(**build_image_only_prompt(input_image, width, height))
    cond = model.generate_condition(**build_instruction_prompt(input_image, instruction, width, height))
    cond["vae_pixel_values"] = vae_pixels.unsqueeze(0).to(model.device)
    return model.generate_img(
        cond=cond,
        no_both_cond=no_both_cond,
        no_txt_cond=no_txt_cond,
        height=height,
        width=width,
        num_steps=steps,
        img_cfg=img_cfg,
        txt_cfg=txt_cfg,
    )

Denoising update in visual generator

def edit_denoise_step(backbone, x, img_ids, txt, txt_ids, img_cond, cond_img_ids, no_both_txt, no_txt_txt, t, t_next, img_cfg, txt_cfg):
    cond_eps = backbone(img=x, img_ids=img_ids, txt=txt, txt_ids=txt_ids,
                        timesteps=t, cond_img=img_cond, cond_img_ids=cond_img_ids)
    no_both_eps = backbone(img=x, img_ids=img_ids, txt=no_both_txt,
                           txt_ids=torch.zeros_like(txt_ids), timesteps=t)
    no_txt_eps = backbone(img=x, img_ids=img_ids, txt=no_txt_txt,
                          txt_ids=torch.zeros_like(txt_ids), timesteps=t,
                          cond_img=img_cond, cond_img_ids=cond_img_ids)
    pred = no_both_eps
    pred = pred + img_cfg * (no_txt_eps - no_both_eps)
    pred = pred + txt_cfg * (cond_eps - no_txt_eps)
    return x + (t_next - t) * pred

3.7 Code-to-paper mapping

Code reference: GitHub main @ 55b7ce25 (2025-12-02); HF model repo main @ cbc005dd (2025-07-03) — mapping based on this commit/snapshot.

Paper ConceptSource FileKey Class/Function
Unified model wrapper / Ovis-U1 architectureHF modeling_ovis_u1.pyOvisU1, merge_multimodal, generate, generate_condition, generate_img
Visual tokenizer / AIMv2 visual encoder pathHF modeling_ovis_u1.py, modeling_aimv2.pyAimv2VisualTokenizer, BaseVisualTokenizer
MMDiT / visual decoder / VAE pathHF modeling_yak.pyYakModel, YakTransformer, generate_image, compute_vae_encodings
Bidirectional token/refiner blocksHF modeling_yak.pyIndividualTokenRefinerBlock, CrossTokenRefinerBlock, IndividualTokenRefiner, SingleTokenRefiner
T2I inference scriptGitHub test_txt_to_img.pypipe_txt2img, build_inputs; uses txt_cfg=5, steps=50, 1024×1024 example
Image editing inference scriptGitHub test_img_edit.pypipe_img_edit; constructs no_both_cond, no_txt_cond, cond and calls generate_img
Image/multi-image/text understanding scriptsGitHub test_img_to_txt.py, test_multi_img_to_txt.py, test_txt_to_txt.pypipe_txt_gen, model.generate

论文公式与 released code 实现差异:论文没有公开训练代码,也没有给出完整 flow-matching loss / optimizer implementation;GitHub repo 主要提供 inference scripts,核心模型实现来自 Hugging Face trust_remote_code 文件。因此本文的 pseudocode 与 code mapping 只能验证 inference-time condition extraction、CFG 和 denoising update,不能验证六阶段训练 loop 的实际数据 mixer、loss weighting、checkpoint schedule。

4. Experimental Setup (实验设置)

Datasets

  • Understanding data:COYO、Wukong、Laion、ShareGPT4V、CC3M,以及内部数据;论文未给每个子集的最终 sample count,但说明有 filtering、caption enhancement 和 data ratio 调整。
  • Text-to-image data:Laion5B 与 JourneyDB;Laion5B 先筛选 aesthetic score > 6,再由 Qwen 生成详细 caption,得到 Laion-aes6。
  • Image+text-to-image / editing data:OmniEdit、UltraEdit、SeedEdit;Subjects200K、SynCD、StyleBooth;MultiGen 20M;以及内部 style-driven、content removal、style translation、de-noise/de-blur、colorization、text rendering 数据。
  • Evaluation data:OpenCompass Multi-modal Academic Benchmarks 的 8 个理解 benchmark;GenEval、DPG-Bench、CLIPScore 的 1K DALL-E 3 prompts;GEdit-Bench 606 image-instruction pairs,ImgEdit 811 image-instruction pairs。

Baselines

理解侧比较 GPT-4o、InternVL2.5-2B、SAIL-VL-2B、InternVL3-2B、Qwen2.5-VL-3B、Ovis2-2B、SAIL-VL-1.5-2B、Ristretto-3B。统一模型/生成编辑侧比较 Janus-Pro、Emu3、BLIP3-o、BAGEL、UniWorld-V1、OmniGen、OmniGen2;image editing 还包括 AnyEdit、Instruct-Pix2Pix、MagicBrush、UltraEdit、Step1X-Edit、ICEdit 等。

Metrics

  • OpenCompass Avg:MMBench、MMStar、MMMU-Val、MathVista-Mini、HallusionAvg、AI2D-Test、OCRBench、MMVet 的平均。
  • GenEval Overall:object/count/color/position/attribute binding 等生成约束的通过率。
  • DPG-Bench Overall:Global、Entity、Attribute、Relation、Other 维度的文本-图像对齐评分。
  • ImgEdit-Bench / GEdit-Bench-EN:由 advanced GPT model 对编辑结果打分,覆盖 add/adjust/extract/replace/remove/style 等编辑类型。

Training config

模型结构来自 Table 1:LLM 1720M(Qwen/Qwen3-1.7B)、visual decoder 1046M、visual encoder 578M(apple/aimv2-large-patch14-448)、adapter 135M、VAE 84M(madebyollin/sdxl-vae-fp16-fix)、refiner 81M,总参数 3644M。训练阶段、steps、batch size、learning rate 如 §3.3 表。论文未详细说明 GPU type/count;released GitHub inference README 仅给出环境:Python 3.10、Torch 2.4.0、Transformers 4.51.3、DeepSpeed 0.15.4。Inference examples 使用 1024×1024、50 steps、seed 42;T2I txt_cfg=5,image editing 默认 img_cfg=1.5txt_cfg=6

5. Experimental Results (实验结果)

5.1 Main comparison across three task families

ModelParamsMMBMMMUMMVetGenEvalDPG-BenchImgEditGEdit-EN
GPT-4o-86.072.976.90.84-4.27.53
BAGEL7B + 7B85.055.367.20.8285.073.206.52
UniWorld-V17B + 12B83.558.667.10.84†81.383.264.85
OmniGen23B + 4B79.153.161.80.86†83.573.446.42
Ovis-U12.4B + 1.2B77.851.166.70.8983.724.006.42

Ovis-U1 的核心卖点是均衡:理解侧不如 GPT-4o/BAGEL,但在 3.6B 参数规模下达到 OpenCompass Avg 69.6;生成侧 GenEval 0.89 高于 BAGEL 0.82 和 UniWorld-V1 0.84†;编辑侧 ImgEdit 4.00 高于 BAGEL 3.20、UniWorld-V1 3.26、OmniGen2 3.44,GEdit-EN 6.42 与 OmniGen2 持平。

5.2 Understanding benchmark

ModelMMBMMSMMMUMathVistaHallusionAI2DOCRBenchMMVetAvg
GPT-4o86.070.272.971.657.086.382.276.975.4
Ristretto-3B80.262.851.367.650.284.284.760.767.7
SAIL-VL-1.5-2B78.562.646.467.050.083.789.158.867.0
Ovis-U177.861.351.169.456.385.688.366.769.6

Ovis-U1 在 OpenCompass Avg 69.6,超过同量级 Ristretto-3B 的 67.7 与 SAIL-VL-1.5-2B 的 67.0;论文强调它只有约 2B 参数直接用于 understanding 侧,因此这个结果支持“小统一模型也可保持较强理解能力”的结论。

5.3 Text-to-image results

GenEval 上 Ovis-U1:Single object 0.98、Two object 0.98、Counting 0.90、Colors 0.92、Position 0.79、Attribute binding 0.75、Overall 0.89。DPG-Bench 上 Ovis-U1:Global 82.37、Entity 90.08、Attribute 88.68、Relation 93.35、Other 85.20、Overall 83.72。它的 GenEval overall 高于 OmniGen2† 的 0.86 与 BAGEL† 的 0.88;DPG-Bench 83.72 略高于 OmniGen2 83.57,但低于 BAGEL 85.07。

Figure 5 解读:这些 T2I qualitative examples 展示模型可以生成 photorealistic、abstract、multi-object、spatial relation 和 attribute binding 场景。结合 GenEval/DPG-Bench 数字看,Ovis-U1 的强项是复杂 prompt 的结构一致性,但论文也承认小模型在 image generation 上仍可能有 artifact/hallucination,未来需要扩大参数量。

5.4 Image editing results

ImgEdit-Bench 上 Ovis-U1:Add 4.13、Adjust 3.62、Extract 2.98、Replace 4.45、Remove 4.06、Background 4.22、Style 4.69、Hybrid 3.45、Action 4.61、Overall 4.00。GEdit-Bench-EN 上 Ovis-U1 的 Avg 6.420;分项包括 Background 7.486、Color 6.879、Material 6.208、Motion 4.790、Portrait 5.981、Style 6.463、Subject Modification 7.491、Subject Change 7.254、Subject Beautification 7.266、Text 4.482、Tone 6.314。

Figure 6 解读:编辑案例覆盖 material replacement、clothing color change、expression change、background replacement、object removal、style transfer、object insertion 等。论文对 Figure 6 的解释是:模型可以执行局部修改,同时尽量保持背景和非目标区域完整;这正对应 image editing 中 image condition 与 text condition 的双 CFG 设计。

5.5 Ablation: refiner and unified training

Figure 4 解读:Figure 4 改变 editing 的 。较高 image CFG 会保留更多输入图像细节,较高 text CFG 会强化编辑指令执行。Table 13 显示 ImgEdit-Bench 在 时 Overall 达 4.13,高于 Table 3 使用统一 CFG 设置时的 4.00。

Refiner ablation(Table 9)显示:T5+CLIP baseline 在约 10M 数据上 CLIPScore 32.19 / DPG 82.32 / GenEval 0.63;只用 Qwen last-layer features 会降到 DPG 80.97;拼接倒数两层恢复到 DPG 81.48;clip-free CLS token 在 50M 数据上可到 DPG 83.81。这个结果支持 refiner 的两个设计:多层 hidden state 拼接比单层更稳,learnable CLS 可以部分替代 CLIP global feature。

“生成帮助理解”的证据来自 Table 10:Baseline 的 OpenCompass Avg 为 63.33,Unified Training 为 64.47,提升 1.14;其中 MMB 75.8→77.0,MMS 55.4→56.9,MathVista 63.0→66.3,MMVet 49.8→52.8。论文解释为 Stage1–2 中 text-to-image 和 editing task 参与 visual encoder alignment,帮助视觉 encoder 与 text embedding 对齐。

“理解帮助生成”的证据来自 Table 11 与 Table 12:DPG-Bench Overall 从 Stage1 83.81 到 Stage4 84.66,再到 Stage5 85.43;Stage4 的提升来自 Stage1–3 对 text/image embedding 的 alignment 后,refiner+decoder 再对齐到更好的 embedding。GenEval 在早期模型上 Stage1 0.67、Stage4 0.70、Stage5 0.69,变化较小且 Stage5 略降,说明 generation 增益主要体现在 DPG-Bench 的细粒度对齐上,非所有 benchmark 单调提升。

5.6 Qualitative understanding and limitations

Figure 7 解读:理解案例显示模型能回答计数、关系、季节推断、异常检测等问题,并给出带原因的自然语言解释。它支撑论文关于 unified training 不必牺牲 understanding 的结论,但这些 qualitative examples 不能替代系统性的 hallucination/robustness 分析。

作者明确提出几个限制/未来方向:第一,小参数 image generation 仍容易出现 artifacts 和 hallucinations,需要扩大模型规模;第二,训练数据 pipeline 还需更多高质量 unified model 数据,尤其是 interleaved image-text content;第三,image editing 需要专门的 visual encoder-decoder 结构来更好保留输入图像细节;第四,Ovis-U1 当前没有 reinforcement learning stage,而 RL 对大模型优化和 human preference alignment 很重要,如何对 unified multimodal model 做 preference alignment 仍是开放问题。