Unified Multimodal Models as Auto-Encoders

Paper: arXiv:2509.09666 Code: PKU-YuanGroup/UAE Code reference: main @ 78b3a8f5 (2025-09-12)

1. Motivation(研究动机)

Unified Multimodal Model(UMM)的目标是让同一个系统同时支持 image-to-text understanding(I2T)和 text-to-image generation(T2I),但论文指出,许多现有方法只是把两个能力放进同一架构中,并没有证明两者能互相增强。理解侧通常优化 caption/VQA/AR text loss,生成侧优化 diffusion 或 image-token loss;当 diffusion-based generative objective 直接耦合到理解表示时,还可能破坏 understanding capability 和 learned representations。因此 Janus-Pro、BLIP3-o、UniWorld、MetaQuery 等路线往往倾向于模块解耦或任务分开训练,导致“unification”退化成两个大模块并排共存。

本文要解决的具体问题是:理解与生成能否在同一个闭环中形成互惠,而不是只共享参数或接口? 作者把 I2T 看作 encoder,把 T2I 看作 decoder,让输入图像 先被压缩成文本语义 ,再由生成模块从 重构图像 。如果 encoder 真正理解图像,它输出的文本应该保留主体、属性、关系、布局、风格和遮挡等重构所需信息;如果 decoder 真正理解文本,它应该能忠实恢复这些结构。

这个问题重要在于它给“统一模型”提供了一个可度量标准:不是分别在 caption benchmark 和 T2I benchmark 上得分,而是看 中的语义能否守恒。一旦这个重构闭环成立,理解侧会被迫产生更密集、更准确、更对生成友好的表示,生成侧也会被迫消费这些长文本语义,从而同时改善 fine-grained visual perception 和 complex instruction-following generation。

Figure 1 解读:图中把文本放在 auto-encoder bottleneck 的位置。上半部分强调 encoder 若漏掉细节,decoder 便无法重构;下半部分展示 RL 步数增加后,理解模块输出更丰富文本,生成模块也更能遵循复杂指令。它说明本文的“统一”不是简单架构拼接,而是通过 reconstruction similarity 建立跨模态反馈。

2. Idea(核心思想)

核心洞察是:文本可以作为连接视觉理解与视觉生成的中间 latent representation,而重构质量可以直接定义这个 latent 是否足够好。 传统 caption loss 只要求文本像标注,T2I loss 只要求图像符合 prompt;UAE 则要求 caption 必须能让 decoder 把原图的语义重构回来。

Unified-GRPO 是这个洞察的 RL post-training 实现。它用 reconstructive reward jointly optimize encoder/decoder:encoder 生成更完整的 caption 会提高重构 reward,decoder 更忠实地消费 caption 也会提高 reward。最终,两者在同一个 reward 中 co-evolve。

与普通 T2I RLHF 不同,本文 reward 不是审美偏好或 prompt-image alignment,而是原图与重构图之间的 semantic consistency。与 Janus-Pro、BAGEL、UniWorld 等 UMM 相比,UAE 的区别也不只是 backbone,而是把 unified model 变成一个可优化、可评测的 auto-encoding loop。

3. Method(方法)

3.1 Auto-Encoder 视角:

给定图像 ,理解模块先生成文本语义: 随后生成模块根据 或由最后一层 hidden state 得到的 condition 重构图像: 论文明确给出的 reconstruction reward 是 CLIP embedding 的 cosine similarity: 作者在附录解释为什么不用 MSE:I2T2I pipeline 只要求语义保持,不要求逐像素复制。MSE 会惩罚光照、纹理、风格等不影响语义的低层差异;CLIP 更适合作为“对象、关系、属性是否被保留”的 reward model。

Figure 2 解读:workflow 展示了 reconstruction objective 如何把 understanding 和 generation 串成闭环。输入图像被编码成文本 / hidden semantics,decoder 再生成重构图,reward 由原图与重构图的语义相似度给出。图右侧训练动态对应论文的 multimodal “aha moment”:reward 上升时 caption length 也增长,说明模型不是被显式要求写长描述,而是因为更完整的描述更利于重构。

3.2 Unified-GRPO 在 UMM-1 与 UMM-2 上的形式

论文区分两类主流 UMM。UMM-1 使用 AR model 做 understanding,并把语言先验交给 diffusion transformer(MM-DiT)做 image generation,例如 UniWorld、MetaQuery。此时 LLM 是 policy,diffusion transformer 冻结并作为 reward environment 的一部分。对同一输入图像 ,旧 policy 采样 个 caption ;每个 caption 的最后 hidden state 经 projector 得到 ,再生成

论文显式写出的 GRPO token-level probability ratio 为: GRPO 的组内 advantage / clipped surrogate 由原始 GRPO 论文定义;本文主文不展开完整 objective,而是强调每个 trajectory 对应一个 caption sequence,reward 来自后续 diffusion reconstruction。

UMM-2 使用同一个 AR backbone 同时做 I2T 和 T2I,例如 Janus-Pro、X-Omni。此时 decoder 不再是 diffusion,而是 autoregressive image-token generation path;闭环仍是 ,reward 仍为 。这说明 Unified-GRPO 是 text-mediated reconstruction 原则,而不是只适用于 SD3 / MM-DiT 的工程技巧。

Figure 3 解读:左侧 UMM-1 中,AR model 负责编码图像并产生 text/prompt latent,MM-DiT 解码为图像;右侧 UMM-2 中,同一 AR backbone 同时处理文本和图像 token。矩形内部的 text/image 表示 latent tokens,外部表示原始数据。Unified-GRPO 的作用点是 LLM backbone,使其学会输出能被生成路径验证的语义表示。

3.3 数据、冻结策略与训练超参

RL 阶段数据包含 1,000 张真实摄影图片,覆盖 portrait、architecture、nature、street photography 等场景,并混入 Echo-4o 的 photorealistic synthetic subset,强调 compositional quality、visual clarity 和 semantic richness。Unified-Bench 评测则从 LAION-5B 随机采样 100 张图片,不按内容或 aesthetic score 过滤。

训练时只 fine-tune LLM module,冻结 visual encoder/decoder 等其他模块。附录给出的理由是:解冻 MLLM 的 visual encoder(ViT)会造成重构图 structural collapse、semantic inconsistency 和 image quality degradation,因此所有实验中保持 ViT 冻结。reward module 由冻结 diffusion decoder 与预训练 CLIP 组成,纯 inference 模式下计算生成图与输入图的相似度。

训练设置:learning rate ,batch size 1;每个 prompt 采样 4 张图估计 GRPO policy gradient;KL coefficient ;LLM temperature 1.0。需要特别注意:这些数值来自论文附录,而不是 released launch script;公开仓库截至 main@78b3a8f5 尚未发布 Unified-GRPO training code、SFT training code 或训练数据。

Figure 4 解读:图中展示了解冻 ViT 后的失败案例:两只南瓜、一根蜡烛等语义细节丢失,生成结果结构退化。它支撑了冻结 visual encoder 的设计选择:否则 RL reward 可能把视觉表征本身推坏,导致闭环 reward 不再可信。

Figure 5 解读:左侧 reward 随 RL 训练稳步上升,右侧 caption length 同步增长。由于训练没有显式加入“写更长 caption”的监督,这说明 reconstruction reward 隐式鼓励 LLM 输出更多对图像重构有用的信息。

3.4 Unified-Bench:评测统一性

Unified-Bench 的 Protocol-1 从 100 张 LAION-5B source images 出发,让模型先生成 caption,再用 caption 生成 reconstruction,然后用 CLIP、LongCLIP、DINO-v2、DINO-v3 计算 source/reconstruction similarity,汇总为 Unified-Score。Protocol-2 使用 Claude-4.1、GPT-4o、Grok-4、o4-mini 做 pairwise judge,比较 UAE caption 与 baseline caption 哪个更适合图像重构,指标为 winning rate。

这个 benchmark 的关键是它不单独评价 caption 是否像人工标注,也不单独评价生成图是否漂亮,而是评价“理解输出是否足够支撑生成”。这比传统 VQA、GenEval、FID 等单向指标更贴近 UMM 的统一性。

Figure 6 解读:重构对比展示了 caption bottleneck 的效果。UAE 的中间文本通常保留主体类别、颜色、数量、姿态、背景与遮挡,decoder 因而能生成更接近源图的结果;较弱 caption 会让 decoder 只能依赖先验补全,造成身份或属性漂移。

Figure 7 解读:案例中的小黑狗、黄色 beanie、眼镜、背景与光照都需要被 caption 保留才能重构。论文指出基线常见错误包括 category drift、attribute omission/swap、under-specified scenes;UAE 则能枚举 species、apparel type/color、eyewear、pose、occlusion 与 background style。

3.5 论文公式与 released code 实现差异

论文公式与 released code 实现差异:公开仓库 PKU-YuanGroup/UAEmain@78b3a8f5 只发布了 inference code、model checkpoints 与 Unified-Bench evaluation code;README TODO 明确写着 unified-GRPO training code、SFT training code、RL/SFT training data 尚未发布。因此训练算法的 GRPO optimizer、sampling loop、真实 launch config 无法从 released code 复核;笔记中的训练伪代码是 paper-faithful skeleton,而不是可执行源码摘录。released code 可以核对的部分是 Qwen2.5-VL-3B + projector + SD3.5 的 inference wiring,以及 CLIP/LongCLIP/DINO 的 Unified-Bench 评测。

Code reference: main @ 78b3a8f5 (2025-09-12) — pseudocode and mapping based on this commit

Released inference:image → caption

@torch.no_grad()
def uae_image_to_text(processor, llm_model, image_path, device="cuda"):
    image = Image.open(image_path).convert("RGB")
    messages = [{
        "role": "user",
        "content": [
            {"type": "image", "image": image},
            {"type": "text", "text": "Describe this image in detail."},
        ],
    }]
    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(device)
    output_ids = llm_model.generate(
        **inputs, max_new_tokens=512, do_sample=True, temperature=0.7,
    )
    new_tokens = output_ids[:, inputs.input_ids.shape[1]:]
    return processor.batch_decode(new_tokens, skip_special_tokens=True)[0]

Released inference:text → SD3.5 image

@torch.no_grad()
def uae_text_to_image(processor, uae_model, sd3_pipe, pooled_prompt_embeds, text, seed=42):
    generator = torch.Generator(device="cuda").manual_seed(seed)
    negative_ids = encode_as_generate_role(
        processor, "Generate a random, low quality, ugly, blur, bad and anime, cartoon image."
    )
    positive_ids = encode_as_generate_role(processor, text)
    input_ids, attention_mask = pad_pair(negative_ids, positive_ids)
    negative_prompt_embeds, prompt_embeds = uae_model.get_projected_embeddings(
        input_ids=input_ids,
        attention_mask=attention_mask,
        output_hidden_states=True,
    ).chunk(2, dim=0)
    return sd3_pipe(
        prompt_embeds=prompt_embeds,
        negative_prompt_embeds=negative_prompt_embeds,
        pooled_prompt_embeds=pooled_prompt_embeds,
        negative_pooled_prompt_embeds=pooled_prompt_embeds,
        height=1024,
        width=1024,
        num_inference_steps=40,
        guidance_scale=5.0,
        generator=generator,
    ).images[0]

Paper-faithful Unified-GRPO skeleton(training code 未发布)

def unified_grpo_step(policy_llm, frozen_decoder, frozen_clip, images, old_policy):
    all_rewards, new_logps, old_logps = [], [], []
    for image in images:
        samples = sample_group(policy_llm, image, group_size=4, temperature=1.0)
        for caption, new_lp, old_lp in samples:
            condition = project_last_hidden_state(policy_llm, image, caption)
            recon = frozen_decoder(condition)
            reward = cosine(frozen_clip(image), frozen_clip(recon))
            all_rewards.append(reward)
            new_logps.append(new_lp)
            old_logps.append(old_lp)
 
    rewards = torch.stack(all_rewards)
    advantage = (rewards - rewards.mean()) / (rewards.std() + 1e-6)
    ratio = torch.exp(torch.stack(new_logps) - torch.stack(old_logps))
    clipped = torch.clamp(ratio, 1 - eps, 1 + eps) * advantage
    loss = -torch.min(ratio * advantage, clipped).mean()
    loss = loss + 1e-6 * kl_to_reference(policy_llm)
    return loss, rewards.mean()

Unified-Bench evaluation

def unified_bench_score(image_dir, ref_dir):
    calculator = ImageSimilarityCalculator(
        model_types=["clip", "longclip", "dinov2", "dinov3"]
    )
    scores = calculator.calculate_folder_similarity(
        image_path=image_dir,
        ref_image_path=ref_dir,
        output_file="results.json",
    )
    averages = {}
    for model_name, per_image in scores.items():
        valid = [score for score in per_image.values() if score is not None]
        averages[model_name] = sum(valid) / len(valid)
    return averages, sum(averages.values()) / len(averages)
Paper ConceptSource FileKey Class/Function
Model loading and LoRA wiringdemo.pyload_models, set_lora
I2T caption inferencedemo.pygen_prompt, generate_from_input
T2I image generationdemo.pyget_prompt_embeds, gen_image
Qwen2.5-VL projector for SD3 conditioninguae/models/modeling_longcontext.pyQwen2_5_VLWithLongContext.get_projected_embeddings
Reconstruction wrapperuae/models/modeling_longcontext_rec.pyComposedModelLongContext.forward, sd_gen
SD3 prompt embedding utilitiesuae/utils/denoiser_prompt_embeds.pyencode_prompt
Unified-Bench similarity evaluationUnified-Bench/Score_i2i.pyImageSimilarityCalculator.calculate_folder_similarity
CLIP / DINO / LongCLIP backendsUnified-Bench/CLIP.py, DINO_v2.py, DINO_v3.py, LongCLIP.pyScore_Cal
Unified-GRPO trainingREADME TODOnot released at 78b3a8f5

3.6 Qualitative figures

Figure 8 解读:复杂长上下文生成样例展示了 UAE 对多对象、多属性和长 prompt 的遵循能力。它对应 GenEval++ / DPG-Bench 中 attribute binding 与 relation handling 的提升。

Figure 9 解读:GenEval++ 样例集中考察多对象、多数量、颜色、位置组合。UAE 的优势来自更密集的语义条件与 decoder 对这些条件的利用。

Figure 10 解读:理解侧 qualitative examples 表明 RL 后 caption 更细粒度,尤其更愿意列出小物体、颜色、空间关系和上下文。这解释了 MMT-Bench fine-grained 子任务的大幅提升。

Figure 11 解读:1024×1024 visualization 展示最终生成质量。该图是纵向 composite,因此按自适应推荐宽度保持紧凑,避免在阅读笔记中被过度放大。

Figure 12 解读:image-text-image 重构样例展示了文本 bottleneck 的可解释性:文本中出现的主体与属性更容易被重构,未出现的细节会被 generator prior 随机补全。

Figure 13 解读:第二组重构样例进一步说明语义保真而非像素复制。只要文本覆盖对象、关系和布局,重构图可以风格变化但语义保持。

Figure 14 解读:第三组样例强调评价目标是 source / reconstruction 的语义相似,而不是完全一致的摄影细节。

4. Experimental Setup(实验设置)

  • Datasets:RL stage data 为 1,000 张精选真实摄影图像,另有 Echo-4o photorealistic synthetic subset;Unified-Bench 从 LAION-5B 随机采样 100 张 evaluation images;generation 评测使用 GenEval、GenEval++、DPG-Bench;understanding 评测使用 MMT-Bench,并在 ablation 中报告 MMB、MMMU。
  • Baselines:Janus-Pro、BLIP3-o 4B/8B、UniWorld-V1、OmniGen2、BAGEL、Show-o、GPT-4o-Image、Qwen-2.5-VL-3B/7B,以及 MMT-Bench 中的 InternVL-Chat-v1.2-34B、Qwen-VL-Plus、GPT-4V、GeminiProVision、DeepSeek-VL-7B、Claude3V-Haiku、ShareGPT4V-7B、LLaVA-v1.5-7B。
  • Metrics:Unified-Score 用 CLIP/LongCLIP/DINO-v2/DINO-v3 similarity;Protocol-2 用 Claude-4.1/GPT-4o/Grok-4/o4-mini pairwise winning rate;GenEval/GenEval++ 测 object/count/color/position/compositional following;DPG-Bench 测 Global/Entity/Attribute/Relation/Other;MMT-Bench 用 accuracy。
  • Training config:模型为 Qwen-2.5-VL-3B + SD-3.5 Large 8B 风格的 UMM;Unified-GRPO 使用 LR 、batch size 1、每 prompt 4 samples、KL coefficient 、temperature 1.0。released repo 无训练 launcher,以上来自论文附录。

5. Experimental Results(实验结果)

5.1 Ablation:Unified-GRPO 同时提升 generation 与 unification

ModelMMBMMMUGenEvalDPGBenchUnified-Score
UniWorld83.558.684.081.279.0
UniWorld w/ Ours84.858.289.086.486.1
Δ+1.3-0.4+5.0+5.2+7.1
Janus-Pro79.241.080.084.282.8
Janus-Pro w/ Ours80.341.684.388.989.1
Δ+1.1+0.6+4.3+4.7+6.3

两类 UMM 上都出现相同趋势:generation 和 Unified-Score 大幅提升,understanding 基本保持或小幅提升。UniWorld 的 MMMU -0.4 表明该方法不是无代价地提升所有 reasoning 任务,而是主要改善与视觉细节和重构相关的能力。

5.2 Unified-Bench Protocol-1

MethodCLIPLongCLIPDINO-v2DINO-v3Overall
GPT-4o-Image90.4294.3781.7477.2785.95
BAGEL88.9793.3578.5573.0583.48
BLIP-3o84.8490.2468.3162.8676.56
Janus-Pro88.7293.4578.3070.6182.77
OmniGen288.3693.1177.7074.0783.31
Show-o80.1886.7558.2051.5169.16
UniWorld-V185.4991.5372.1266.8378.99
UAE90.5094.3581.9877.5486.09

UAE Overall 86.09,高于 GPT-4o-Image 85.95,并在 CLIP、DINO-v2、DINO-v3 上最高;LongCLIP 94.35 与 GPT-4o-Image 94.37 基本持平。这说明 UAE 的中间文本不仅对语言-图像语义有用,也保留了 DINO 能捕捉到的布局与视觉结构。

5.3 Protocol-2:caption 对重构是否友好

OpponentParamClaude-4.1GPT-4oGrok-4o4-miniAvg
GPT-4o-47.489.430.621.247.2
BAGEL7B57.792.958.348.264.3
OmniGen23B67.997.663.556.571.4
Show-o1.3B97.8100.089.891.094.7
Qwen-2.5-VL-3B3B76.399.067.063.076.3
Qwen-2.5-VL-7B7B68.899.062.056.071.5

UAE caption 对开源/统一模型多数有明显优势,但对 GPT-4o 的 Avg 为 47.2,说明强商业 captioner 在 judge preference 上仍可竞争。这个结果也说明“长 caption”本身不是目标,关键是是否重构友好。

5.4 T2I generation:GenEval、GenEval++、DPG-Bench

MethodSingleTwoCountingColorsPositionColor attr.Overall
Janus-Pro0.990.890.590.900.790.660.80
UniWorld-V10.990.930.790.890.490.700.80
OmniGen21.000.950.640.880.550.760.80
BAGEL0.990.940.810.880.640.630.82
UAE1.000.890.840.900.710.790.86
UAE1.000.970.820.950.730.840.89

GenEval 中 UAE 不用 rewriter 已达 Overall 0.86;Counting 0.84、Color attribution 0.79,分别显示对数量和颜色绑定的改进。使用 LLM rewriter 后 UAE Overall 0.89。

MethodColorCountColor/CountColor/PosPos/CountPos/SizeMulti-CountOverall
Janus-Pro0.4500.3000.1250.3000.0750.3500.1250.246
BLIP3-o 8B0.2500.2500.1250.6000.1250.5750.2250.307
OmniGen20.5500.4250.2000.2750.1250.2500.4500.325
BAGEL0.3250.6000.2500.3250.2500.4750.3750.371
UAE0.5500.5250.5500.5500.4500.4000.4000.475

GenEval++ 更难,UAE Overall 0.475,超过 BAGEL 0.371 与 OmniGen2 0.325;Color/Count 和 Color/Pos 均为 0.550,说明组合属性约束是主要收益点。

MethodGlobalEntityAttributeRelationOtherOverall
UniWorld-V183.6488.3988.4489.2787.2281.38
OmniGen288.8188.8390.1889.3790.2783.57
BAGEL88.9490.3791.2990.8288.6785.07
UAE83.1191.4391.4992.0784.3284.74

DPG-Bench 中 UAE 在 Entity、Attribute、Relation 三项最高,Overall 84.74 仅次于 BAGEL 85.07。它说明 UAE 的强项不是全局 aesthetic,而是实体、属性、关系的 faithful grounding。

5.5 Understanding:fine-grained perception 大幅增强,但 OCR/DU 下降

MMT-Bench 高层任务中,Qwen-2.5-VL-3B baseline Overall 56.3,Ours 56.5。提升集中在 Loc +7.0、PLP +5.8、VI +9.2、VR +1.4、Count +1.9;但 OCR -6.2、DU -11.6、IR -6.2、3D -2.5。作者认为这与图像生成模型难以 faithfully render text 有关,text-rich reconstruction reward 可能误导 encoder。

fine-grained visual perception 子任务中,baseline Overall 32.5,Ours 56.9,提升 +24.4;Small Object Detection 从 5.0 到 45.0(+40),Person Re-ID 从 15.0 到 75.0(+60),Transparent Object Detection 从 15.0 到 45.0(+30)。这组结果最直接支持“generation helps understanding”:为了让 decoder 重构细节,encoder 必须学会捕捉小物体、透明物体、身份与几何属性。

5.6 限制与结论

主要限制(limitations)是 OCR / Document Understanding / text-rich scenes:当前 image generation model 对文字渲染仍弱,导致重构 reward 对文字相关语义不可靠。工程上,公开仓库尚未释放 Unified-GRPO 训练代码和训练数据,因此只能复现实验推理与 Unified-Bench 评测,不能完整复现 RL post-training。

整体结论:UAE 通过 text-mediated reconstructive auto-encoder 把理解与生成连接到同一 reward 中,证明二者可以在 fine-grained perception、complex instruction following 和 unified reconstruction score 上形成互惠;但方法收益仍受生成器文本渲染和训练代码开放程度限制。