Do Understanding and Generation Fight? A Diagnostic Study of DPO for Unified Multimodal Models

Paper: arXiv:2603.17044

1. Motivation(研究动机)

现有 unified multimodal model 的对齐困境

这篇论文研究的不是“如何再提出一个新的 unified multimodal model”,而是一个更诊断性的问题:像 Janus-Pro 这类模型用同一个 LLM backbone 同时服务 image understanding 与 image generation,如果用 DPO 做 preference alignment,这两个能力会不会互相拖累?这个问题重要,是因为 unified model 的卖点正是共享参数:理解路径看图回答问题,生成路径根据文本输出 VQ visual tokens,二者最终都要更新同一组 backbone 参数;如果偏好优化在共享参数上产生相互干扰,那么“统一”本身就会带来 alignment tax。

此前工作通常只在一个 modality 或一个方向上做 DPO:要么改善 multimodal understanding,要么改善 image generation。论文指出,尚未系统检查过“同一个 Janus-Pro backbone 上同时对齐理解和生成”会发生什么。直觉上,人们可能预期多任务 DPO 能让模型一边更懂图、一边更会画图;但如果两个任务的 gradient 方向冲突、或者尺度严重不匹配,多任务更新就可能被其中一个任务主导。

本文要解决的具体问题

论文把问题拆成三个可检验假设:第一,generation-only DPO 能否单独提升 Janus-Pro 的生成 CLIPScore;第二,understanding-only DPO 与 generation-only DPO 同时训练时,是否存在方向冲突或 magnitude imbalance;第三,常见的 multi-task 修正(PCGrad、GradNorm-style weighting、length-normalized weighting、Rewarded Soups、Separate LoRA)能否消除这种干扰。这里的目标不是追求 SOTA,而是用一组 controlled experiments 找出 DPO 在 VQ-based unified model 上失败或成功的机制。

这个问题值得研究的原因在于,如果 DPO 可以同时对齐两条路径,那么 unified model 可以用更少的参数和更一致的偏好信号同时服务理解与生成;如果失败,后续研究就应避免把 offline token-level DPO 直接套在 VQ autoregressive image generation 上,而要转向 online RL、continuous representation 或 task-specific adapters。

2. Idea(核心思想)

本文的核心 insight 是:understanding 与 generation 的主要问题不是“gradient 方向相反”,而是“gradient 近似正交但尺度极不平衡”。在 Janus-Pro 中,understanding response 通常只有约 个 text tokens,而 generation 需要预测 个 VQ tokens;generation DPO gradient 因 token count 被放大到 understanding gradient 的约 ,于是 naive joint DPO 的共享 backbone 更新几乎由 generation loss 决定。

关键创新在于把 multi-task DPO 当作一个诊断实验,而不是单纯调参:作者同时测量方向 cosine、magnitude ratio、per-layer cosine、training dynamics、KL divergence 与多种 generation metrics,最后发现 generation DPO 本身几乎学不动,loss 收敛到 ,说明 chosen/rejected VQ sequences 在 token-level log-probability margin 上几乎不可区分。

与 PCGrad 这类“冲突方向修正”方法不同,本文发现真实的 failure mode 是 magnitude imbalance 与 VQ tokenization bottleneck。PCGrad 只在 时投影冲突分量,但这里的 cosine 基本为 ,所以 PCGrad 没有什么可投影;更有效的诊断是用 这类 magnitude/length balancing 保住 understanding signal,但它仍不能解决 generation DPO 的根本失效。

3. Method(方法)

3.1 Overall framework:Janus-Pro 的两条路径与共享参数

Figure 1 解读:Janus-Pro 的 understanding path 用 SigLIP encoder 把 input image 转成 visual tokens,再由 shared LLM backbone 生成 text response;generation path 则从 text prompt 出发,经同一个 shared LLM backbone 预测 个 VQ tokens,再由 VQ-VAE decoder 还原图像。蓝色路径的输出长度约 tokens,橙色路径固定为 VQ tokens,因此在同一个 LoRA-augmented backbone 上做 DPO 时,generation gradient 的范数天然远大于 understanding gradient

模型使用 Janus-Pro-7B 与 Janus-Pro-1B。两者都共享 DeepSeek-LLM backbone,并使用 decoupled visual encoders:understanding 侧为 SigLIP-Large-Patch16-384,generation 侧为 VQ-VAE tokenizer,codebook size 为 。实验只训练 LLM backbone 上的 LoRA adapters(rank 、dropout ,目标模块为 ),visual encoders 冻结,generation head 保持可训练。这样的设置把干扰定位到 shared backbone,而不是视觉编码器本身。

3.2 DPO objective:分别定义理解与生成偏好

标准 DPO 使用 preference triples ,其中 是 preferred output, 是 rejected output: $ \Delta_\theta(x,y_w,y_l) = \log\frac{{\pi_\theta(y_w\mid x)}}{{\pi_{{\text{{ref}}}}(y_w\mid x)}}

  • \log\frac{{\pi_\theta(y_l\mid x)}}{{\pi_{{\text{{ref}}}}(y_l\mid x)}}. x=(\boldsymbol I,q)y=(y_1,\ldots,y_T) \log\pi_\theta(y\mid\boldsymbol I,q) =\sum_{{t=1}}^T \log p_\theta(y_t\mid y_{{<t}},\boldsymbol I,q). xy=(v_1,\ldots,v_N) \log\pi_\theta(y\mid x) =\sum_{{t=1}}^N \log p_\theta(v_t\mid v_{{<t}},x),\quad N=576. 5760\ln 2$,即“模型分不出 chosen/rejected”。

3.3 Multi-task DPO 与 gradient diagnostics

多任务 DPO 的 naive 写法是: $ \mathcal L_{{\text{{joint}}}}(\theta) = \alpha\mathcal L_{{\text{{DPO}}}}^U(\theta)

  • (1-\alpha)\mathcal L_{{\text{{DPO}}}}^G(\theta), UG\theta_S \boldsymbol g_U = \nabla_{{\theta_S}}\mathcal L_{{\text{{DPO}}}}^U,\quad \boldsymbol g_G = \nabla_{{\theta_S}}\mathcal L_{{\text{{DPO}}}}^G. \cos(\boldsymbol g_U,\boldsymbol g_G) =\frac{{\boldsymbol g_U\cdot\boldsymbol g_G}}{{|\boldsymbol g_U|,|\boldsymbol g_G|}}, \rho=\frac{{|\boldsymbol g_U|}}{{|\boldsymbol g_G|}}. \cos\approx0\rho\ll1\boldsymbol g_G \frac{{|\boldsymbol g_U+\boldsymbol g_G|-|\boldsymbol g_G|}}{{|\boldsymbol g_G|}} \approx \frac12\rho^2. \rho=0.1\arctan(0.1)\approx5.7^\circ$。

Figure 2 解读:左图显示 Janus-Pro-7B 上 个 mini-batches 的 inter-task cosine 分布,均值为 batches 为负,几乎就是高维正交向量的行为;右图显示 的均值只有 ,也就是 generation gradient 约为 understanding gradient 的 。因此,主导干扰的不是“理解和生成朝相反方向推”,而是“生成的步子太大,把理解信号淹没”。

3.4 Magnitude-balanced DPO

基于上述诊断,作者测试三类 magnitude correction。动态版本仿照 GradNorm,每隔 steps 重新估计 task gradient norm,并设置: 于是: balanced loss 为: 时,,直观上是在放大被淹没的 understanding signal。论文还测试了两个静态近似:length-normalized 使用 ;fixed-weight 使用训练中动态权重收敛到的

Figure 3 解读:训练过程验证了 magnitude imbalance 不是初始化时的偶然现象。top-left 的 cosine 在 steps 中持续围绕 波动;bottom-left 的动态权重在 step 跳到约 ,到 step 接近 并稳定;top-right 的 task-specific DPO losses 显示 generation loss 方差更高,和 discrete VQ token similarity 有关;bottom-right 是 combined loss。这解释了为什么 length-normalized 与 fixed-weight 能接近动态加权:它们都近似补偿了 vs. tokens 的长度差。

3.5 Diagnostic baseline suite

论文比较的训练策略与 post-hoc 方法如下:

类型方法诊断假设
Single-task DPOUnderstanding-only / Generation-only单独看每个任务能否被 DPO 对齐,以及是否存在 single-task alignment tax
Multi-task DPONaive Joint, 如果两个 loss 同等加权,观察哪个任务主导共享参数
Conflict-resolutionPCGrad若问题是 negative cosine,则投影冲突梯度应有效
Magnitude balancingGrad-Weighted, Length-Normalized, Fixed-Weight若问题是范数不平衡,则重新加权应保住弱梯度任务
Post-hocRewarded Soups分别训练两个 LoRA,再用 插值
OracleSeparate LoRA非部署友好的上界:理解用 understanding LoRA,生成用 generation LoRA

3.6 论文级伪代码(未找到 released code)

代码搜索未找到开源实现;以下伪代码是根据论文公式、实验设置与附录抽象出的论文级流程,不是 released code 的逐行映射。

import torch
import torch.nn.functional as F
 
 
def dpo_loss(policy_logp_w, policy_logp_l, ref_logp_w, ref_logp_l, beta=0.1):
    delta = (policy_logp_w - ref_logp_w) - (policy_logp_l - ref_logp_l)
    return -F.logsigmoid(beta * delta).mean()
def multitask_dpo_loss(loss_u, loss_g, alpha=0.5):
    return alpha * loss_u + (1.0 - alpha) * loss_g
def gradient_diagnostics(loss_u, loss_g, shared_lora_params):
    gu = torch.autograd.grad(loss_u, shared_lora_params, retain_graph=True)
    gg = torch.autograd.grad(loss_g, shared_lora_params, retain_graph=True)
    gu = torch.cat([g.flatten() for g in gu if g is not None])
    gg = torch.cat([g.flatten() for g in gg if g is not None])
    cosine = F.cosine_similarity(gu, gg, dim=0)
    rho = gu.norm() / (gg.norm() + 1e-12)
    return cosine.item(), rho.item()
def grad_weighted_balanced_loss(loss_u, loss_g, norm_u, norm_g):
    wu = norm_g / (norm_u + norm_g + 1e-12)
    wg = norm_u / (norm_u + norm_g + 1e-12)
    return wu * loss_u + wg * loss_g, wu, wg
def pcgrad_merge(gu, gg):
    # Paper uses PCGrad as a diagnostic baseline: only negative cosine is projected.
    dot = torch.dot(gu, gg)
    if dot < 0:
        gu = gu - dot / (gg.norm() ** 2 + 1e-12) * gg
        gg = gg - dot / (gu.norm() ** 2 + 1e-12) * gu
    return gu + gg

3.7 Code-to-paper mapping

代码搜索未找到开源实现。检索范围包括 arXiv abstract/PDF/source 中的 URL、GitHub repo/code search、题名与 arXiv ID 搜索,以及作者/Janus-Pro/DPO 关键词搜索;只找到论文页面、第三方论文索引与 Janus/UnifiedReward 等非本文实现。因此本文没有可锚定的 github_ref,也无法验证 released code 与论文公式是否存在差异。

Paper ConceptSource FileKey Class/Function
DPO objective for understanding/generation代码搜索未找到开源实现论文 §3.1 公式;上方为论文级伪代码
Gradient cosine and magnitude ratio diagnostics代码搜索未找到开源实现论文 §3.2 / §4.2;上方为论文级伪代码
Grad-Weighted / Length-Normalized / Fixed-Weight balancing代码搜索未找到开源实现论文 §3.3 / §4.3;上方为论文级伪代码
PCGrad / Rewarded Soups / Separate LoRA baselines代码搜索未找到开源实现论文 §3.4;未提供 released implementation

论文公式与 released code 实现差异:代码搜索未找到开源实现,因此没有 released code 可比对;笔记中的公式与伪代码均以论文正文和附录为准。

4. Experimental Setup(实验设置)

4.1 Datasets 与 preference construction

  • Base data:COCO val2017。
  • Understanding preferences pairs。作者为 COCO val2017 images 构造 diverse VQA questions,覆盖 object identification、counting、spatial relationships、attributes、scene description。每个 image-question pair 用 Janus-Pro-7B 在不同 prompt formulations / temperature 下生成两个 responses,再按与 COCO ground-truth captions 的 entity overlap 打分;得分 margin 小于 的 pair 被过滤。
  • Generation preferences real-vs-generated pairs。从约 个 COCO captions 出发,用 caption 作为 prompt,让 Janus-Pro-7B 生成图像;chosen image 是真实 COCO photograph,rejected image 是模型生成图像,并用 CLIP-ViT-B/32 验证真实图像 text-image similarity 更高。过滤后留下 valid pairs。
  • Distribution-gap ablation:作者额外构造 model-vs-model generation pairs( / pairs),用于排除“真实图 vs 生成图”分布差异导致 DPO 失败的解释。

4.2 Baselines 与 metrics

维度指标说明
UnderstandingVQA content overlap per seed, 分,按回答中正确提到的 COCO caption entities 计分,并惩罚 degenerate short outputs
GenerationCLIPScoreCLIP-ViT-L/14, generated images,temperature near-deterministic decoding;数据构造用 ViT-B/32,避免 circular evaluation
HallucinationPOPE-style accuracy/F1 valid yes/no responses per condition;F1 在所有条件下为 ,因为 Janus-Pro 系统性回答 “no”
Supplementary generationFID / PickScore / LPIPS diversityFID 对比 generated images 与 random COCO validation photographs;PickScore 用 PickScore-v1;LPIPS diversity 在 images 中采样 pairs
Supplementary understandingVQAv2 accuracyVQAv2 validation questions,standard soft-accuracy

4.3 Training config

  • LoRA:rank ,dropout ;target modules 为
  • Optimizer:AdamW,learning rate ,cosine LR schedule,weight decay ,gradient clip norm
  • DPO training steps,batch size ;DPO temperature default;dynamic weights 每 steps 重算。
  • Model / hardware:Janus-Pro-7B 使用 DeepSeek-LLM-7B backbone,在 NVIDIA H100 80GB 上训练;Janus-Pro-1B 使用 DeepSeek-LLM-1.3B backbone,在 NVIDIA A100 40GB 上训练。
  • 为什么 batch size 是 1:论文说明这是为了 per-sample gradient analysis;generation 的 -token sequences 也限制了更大 batch。

5. Experimental Results(实验结果)

5.1 Main results:generation 几乎无法被 DPO 改善

Method7B VQA (Δ)7B CLIPScore (Δ)1B VQA (Δ)1B CLIPScore (Δ)
Base Model2.49026.8702.56525.099
Understanding-only2.753±0.04 (+0.26)26.819±0.03 (−0.05)2.945±0.04 (+0.38)24.851±0.05 (−0.25)
Generation-only2.498±0.02 (+0.01)26.741±0.04 (−0.13)2.556±0.02 (−0.01)24.130±0.05 (−0.97)
Naive Joint ()2.485±0.02 (−0.01)26.928±0.04 (+0.06)2.713±0.03 (+0.15)24.643±0.05 (−0.46)
PCGrad2.508±0.02 (+0.02)26.716±0.04 (−0.15)2.698±0.03 (+0.13)24.618±0.05 (−0.48)
Grad-Weighted2.504±0.02 (+0.01)27.021±0.04 (+0.15)2.748±0.03 (+0.18)24.390±0.05 (−0.71)
Length-Normalized2.532±0.02 (+0.04)26.691±0.04 (−0.18)2.738±0.03 (+0.17)24.410±0.05 (−0.69)
Fixed-Weight ()2.523±0.02 (+0.03)26.739±0.03 (−0.13)2.725±0.03 (+0.16)24.445±0.05 (−0.65)
Rewarded Soups ()2.481±0.02 (−0.01)26.128±0.04*2.597±0.02 (+0.03)24.621±0.05*
Separate LoRA2.753±0.04 (+0.26)26.741±0.04 (−0.13)2.945±0.04 (+0.38)24.130±0.05 (−0.97)

* 表示 Rewarded Soups 的 CLIPScore 用 stochastic generation(,temperature ),不应直接和 deterministic decoding baselines 比较。

最重要的结果是负面的:Janus-Pro-7B 上没有任何方法显著提升 generation CLIPScore,所有 generation delta 的 effect size 都很小,论文给出 all ;1B 上更严重,所有方法都降低 generation,降幅从 。Understanding-only DPO 是唯一清楚有效的单任务改进:7B VQA 从 ,Welch’s ,但该显著性不通过 9 methods 3 metrics 的 Bonferroni threshold。

5.2 Gradient evidence:正交 + 尺度不平衡

Figure 4 解读:per-layer analysis 覆盖 Janus-Pro-7B 的 个 transformer layers。lora_A 的 cosine 因 LoRA 初始化( Kaiming uniform)在早期近似为 ;有意义的梯度主要流过 lora_B,而 lora_B 各层 cosine 也只在 之间波动,没有系统性正/负冲突。这支持“不是某几层强冲突,而是全层面近似正交”的解释。

Null-hypothesis calibration 进一步说明 inter-task cosine 不是噪声测量失败:Janus-Pro-7B 上 inter-task vs. 的 mean/std/n 为 ;intra-understanding 为 ,intra-generation 为 。Welch tests 显示 intra-task cosines 显著高于 inter-task value(),说明同一任务内部确实有 coherent subspace,而理解与生成之间接近结构性正交。

Magnitude ratio 更关键:7B 的 (std ),对应 generation gradient 约 大;1B 的 (std ),对应约 大。论文把这个归因于 VQ token count asymmetry:generation 固定 tokens,understanding response 只有约 tokens。

5.3 Training dynamics 与 Pareto frontier

Figure 5 解读:Pareto frontier 把方法放在 VQA vs. CLIPScore 平面上。所有方法在 CLIPScore 方向都挤在窄区间内,只有 understanding 轴发生明显移动;Separate LoRA 作为 oracle 能把 understanding-only 的 VQA 改进保留下来,但 generation 仍没有提升。这说明本文不是找到一个“trade-off frontier 上的更好点”,而是发现 generation 维度几乎不可移动。

Training loss 也支持同一结论。最终 DPO loss 为:Understanding-only (强收敛),Generation-only ,Naive Joint ,Grad-Weighted ,PCGrad ,Length-Normalized ,Fixed-Weight 。更低的 combined loss 没有转化为 CLIPScore 提升,说明 generation loss landscape 与 VQ-based image quality preference 不一致。

5.4 Ablations:不是数据构造、β、LoRA 容量能轻易解释

  • β sensitivity:Grad-Weighted 在 下的 VQA/CLIPScore/POPE 分别为: / / / / / / / / 。CLIPScore 差异都在噪声范围内, 的 VQA 最高但仍只是
  • Extended generation metrics:Base / Und-only / Gen-only / Grad-Weighted 的 FID 分别为 ,PickScore 为 ,LPIPS diversity 为 。这些指标共同说明生成质量与多样性几乎不变。
  • VQAv2:Base ,Und-only ,Gen-only ,Naive Joint ,PCGrad ,Grad-Weighted ,Length-Norm ,Fixed-Weight 。标准 VQA accuracy 只显示小幅趋势,主文的 content-overlap VQA 对详细回答更敏感。
  • Model-vs-model / data scaling:real-vs-generated pairs 的 generation-only CLIPScore 为 );model-vs-model pairs 为 );MvM pairs 为 )。这排除了“真实图 vs 生成图分布差异”作为唯一原因,也说明 pairs 范围内增加数据不能改变 null result。
  • KL divergence:Understanding-only DPO 在 step nats/sequence( nats/token,平均 tokens),Generation-only 只有 nats/sequence( nats/token, tokens)。这表明 LoRA 有能力移动 policy,但 generation preference signal 太弱,导致 adapter 几乎不动。

5.5 Length confound 与 understanding 改进的含义

作者担心 VQA content-overlap 改进只是回答变长带来的,于是做 length-free evaluation。Base model 的 standard VQA / length-free VQA / avg words 为 ;Und-only DPO 为 。也就是说 standard VQA 中,约 是 length-free content quality,约 words 解释剩余部分。论文报告 cross-method length-VQA correlation 为 ,Und-only 内部 response length 与 score 的 Pearson ,说明长度与信息量纠缠,但不是全部收益。

5.6 作者结论与局限

论文的 practical recommendations 很直接:第一,如果只想改善 Janus-Pro 的 understanding,understanding-only DPO 相对安全,7B 上 VQA 且 CLIPScore 只变 ;第二,如果必须 multi-task,可用解析权重 保护 understanding signal;第三,对 VQ-based autoregressive generation,offline DPO 不足以改善生成,online RL 或 continuous-representation architectures 更有希望。

局限也很重要:本文只研究 Janus-Pro family,Chameleon、BLIP3-o 等架构是否同样如此仍需验证;LoRA rank 固定为 ,full fine-tuning 或更高 rank 可能改变 gradient dynamics;generation DPO loss 收敛到 暗示即使 pairs 也可能受 per-token indistinguishability 限制,但这尚未实证;本文只测试 DPO,IPO、KTO 等 offline preference methods 可能有不同 loss landscape;gradient analysis 使用 batch size ;generation 证据主要由 CLIPScore、FID、PickScore、LPIPS corroborate,仍缺 human evaluation。