1. Motivation (研究动机)

1.1 问题背景

Autoregressive video diffusion 模型(如 Self Forcing)通过 sliding window + KV cache 实现逐帧流式生成,已经能够生成短视频(约 5 秒 / 50-81 帧)。然而,当生成长度远超训练长度时(如从 5s 外推到 60s+),会出现严重的 error accumulation 问题:

  • Fidelity degradation: 颜色漂移、过饱和、纹理模糊
  • Temporal repetition: 内容重复
  • Motion deceleration: 运动逐渐停滞

1.2 现有方案的不足

  1. Self Forcing [Huang et al., 2025]: 使用 FIFO(先进先出)策略管理 KV cache,不区分 token 重要性,容易丢失关键上下文
  2. Training-based 方法(Rolling Forcing, LongLive): 需要额外训练/蒸馏来引入 attention sink,成本高
  3. StreamingLLM-style attention sink: 直接应用到 video diffusion 会导致 fidelity degradation 和 motion stagnation,因为 video diffusion 的 attention sink 行为与 LLM 不同

1.3 关键观察

作者发现预训练的 Self Forcing 模型天然具有 deep attention sink behavior:attention 不仅集中在最初几个 token,还显著关注序列中间位置的 token。这与 StreamingLLM 中只关注前几个 token 的浅层 sink 行为不同。

Figure 4 解读: 该图展示了新生成帧(frame 19-21)对 KV cache 中早期帧(frame 0-18)的 attention weight 分布。上图(L1 H1)和下图(L5 H10)分别展示了不同层和不同 head 的 attention 分布。关键发现是:attention weight 不仅集中在最早的几个 token(position 0-2),还在整个 context window 的中间部分维持了显著的 attention weight,说明中间帧对长视频生成同样重要。这为 Deep Sink(保留约一半 context window 作为 sink)提供了 motivation。

2. Idea (核心思想)

Deep Forcing 提出两个 training-free 的机制来解决 error accumulation:

  1. Deep Sink: 将 sliding window 的约一半(40-60%)分配为持久性 sink token,并通过 Temporal RoPE Adjustment 重新对齐其时间位置编码,稳定全局上下文
  2. Participative Compression (PC): 基于 attention importance 的 KV cache 剪枝,保留在 recent attention 中被频繁使用的 token,删除冗余的历史 token,减少 error accumulation

两者结合实现了 超过 12 倍的长度外推(5s 训练 60s+ 生成),无需任何 fine-tuning。

Figure 2 解读: 对比 Self Forcing 和 Deep Forcing 的 KV cache 管理策略。(a) Self Forcing 采用 FIFO 策略,不区分 token 重要性地驱逐最早的 token,经常丢失关键上下文。(b) Deep Forcing 通过 Deep Sink 保留前部的 sink token,结合 Selective Evict(Participative Compression)选择性地保留重要 token、删除冗余 token,形成 [Deep Sink | Compressed | Recent] 的三段式 cache 结构。

3. Method (方法)

3.1 整体框架

Deep Forcing 在 Self Forcing 基础上修改 KV cache 管理策略,整体框架如下:

Figure 3 解读: (a) Deep Forcing 的整体流程:随着自回归生成的推进,KV cache 的前半部分始终保留为 Deep Sink(蓝色区域),后半部分通过 Participative Compression 进行压缩(绿色区域),最新生成的帧(Recent)始终保留。每次 rolling 时,通过 Temporal RoPE Unification 将 sink token 的时间位置编码重新对齐到当前时间线,保持时间连续性。(b) Participative Compression 的具体流程:计算 Recent query 与 Candidate key 之间的 attention score,聚合后选择 Top-C 最重要的 token 保留,其余驱逐。

3.2 Deep Sink

核心思想

Self Forcing 使用固定大小的 sliding window(如 21 帧),当 cache 满时 FIFO 驱逐最早的帧。Deep Sink 将 cache 分为两部分:

  • Sink region (): 前 帧,始终保留
  • Tail region (): 剩余帧,正常 rolling

Sink 大小 约占 context window 的 40-60%(默认 ,window=21)。

Temporal RoPE Adjustment

直接保留 sink token 会导致巨大的时间位置差异(如 vs ),破坏视频连续性。因此需要动态调整 sink token 的时间维度 RoPE:

  1. 计算时间差 (tail 首帧时间 - sink 末帧时间)
  2. 仅修改 的时间维度 RoPE,保持空间维度不变:

其中 是 RoPE 的时间频率向量, 是逐元素乘法。

# Pseudocode: Deep Sink with Temporal RoPE Adjustment
def deep_sink_forward(kv_cache, new_k, new_v, sink_size, frame_seqlen, freqs):
    """
    管理 KV cache 的 Deep Sink 策略
    Args:
        kv_cache: dict with 'k', 'v' tensors [B, cache_size, H, D]
        new_k, new_v: 新生成帧的 key/value
        sink_size: sink 帧数 S
        frame_seqlen: 每帧的 token 数 (1560 for Wan model)
        freqs: RoPE frequency tensor
    """
    sink_tokens = sink_size * frame_seqlen
    num_new = new_k.shape[1]
    cache_size = kv_cache['k'].shape[1]
    local_end = kv_cache['local_end_index'].item()
 
    # 当 cache 满时,需要 evict
    if num_new + local_end > cache_size:
        num_evicted = num_new + local_end - cache_size
        num_rolled = local_end - num_evicted - sink_tokens
 
        # 保留 sink, roll tail 部分
        # kv_cache['k'][:, :sink_tokens] 不动(sink 部分)
        kv_cache['k'][:, sink_tokens:sink_tokens + num_rolled] = \
            kv_cache['k'][:, sink_tokens + num_evicted:
                           sink_tokens + num_evicted + num_rolled].clone()
 
        # 插入新 token
        local_end_new = local_end + num_new - num_evicted
        kv_cache['k'][:, local_end_new - num_new:local_end_new] = new_k
 
        # === Temporal RoPE Adjustment ===
        # 计算 sink 区域需要的时间偏移
        tail_start_frame = current_start_frame - (local_end_new - sink_tokens) // frame_seqlen
        desired_sink_start = tail_start_frame - sink_size
        delta = desired_sink_start - kv_cache['sink_base_abs_start_frame']
 
        if delta != 0:
            # 仅旋转时间维度的 RoPE
            rope_time_delta_mul_(kv_cache['k'][:, :sink_tokens], freqs, delta)
            kv_cache['sink_base_abs_start_frame'] = desired_sink_start
 
    # 构建 attention window: [sink | tail]
    key_win = torch.cat([
        kv_cache['k'][:, :sink_tokens],       # Deep Sink
        kv_cache['k'][:, tail_start:tail_end]  # Recent tail
    ], dim=1)
 
    return key_win, val_win

代码映射: 上述逻辑对应 wan/modules/causal_model_DS.pyCausalWanSelfAttention.forward() 方法的 KV cache eviction 分支(约 line 238-300),以及 _rope_time_delta_mul_() 函数(line 26-58)。

Figure 5 解读: Sink depth 对生成质量的影响。横轴为 sink 帧数(0-18),左侧纵轴为 Aesthetic Drift(越低越好),右侧纵轴为 Overall Consistency(越高越好)。随着 sink 大小增加到 10-15 帧,Aesthetic Drift 显著降低,Overall Consistency 明显提升。但过大的 sink(如 18 帧)会导致内容重复(early frames 被过度保留)。最优范围为 10-15 帧,约占 sliding window 的 40-60%。

3.3 Participative Compression

核心思想

Deep Sink 只解决了 fidelity degradation 的一部分。当外推到 12 倍以上长度时,KV cache 中仍然积累了大量冗余和质量退化的 token,导致 attention dilution 和 degeneration。

Participative Compression (PC) 在 token 级别进行重要性筛选:

  1. 将 KV cache 分为三个区域:

    • Sink (): 前 帧,始终保留
    • Recent (): 最近 帧,始终保留
    • Candidate (): 中间部分,需要被压缩
  2. 对 Candidate 中的每个 token 计算 importance score:

其中 是 Recent 区域的 query, 是 Candidate 区域的第 个 key。

  1. 选择 Top-C 个最重要的 token 保留:

其中 是压缩后的 budget。

  1. 最终压缩后的 cache 结构:

Temporal RoPE Unification for Top-C

选出的 Top-C token 来自不同时间位置,需要通过 RoPE 调整统一其时间编码:

PC 的触发条件

PC 仅在两个条件同时满足时触发:(1) sliding window 已满;(2) 当前为第一个 diffusion timestep ()。选出的 token 在后续 denoising step 中保持固定。

# Pseudocode: Participative Compression (Algorithm 1 in paper)
def participative_compression(
    kv_cache,           # KV cache [K, V] of size M
    sink_size: int,     # S: sink 帧数
    recent: int,        # R: recent 帧数
    budget: int,        # N: 压缩后 token budget
    timestep: int,      # 当前 diffusion timestep
    first_timestep: int # T: 第一个 timestep
):
    """
    Input: KV cache [K, V] of size M; Sink size S; Recent R; Budget N
    """
    M = kv_cache['local_end_index']
 
    if M < MAX_WINDOW_LENGTH or timestep != first_timestep:
        return kv_cache['k'], kv_cache['v']  # No compression
 
    frame_seqlen = 1560  # tokens per frame
    S_tokens = sink_size * frame_seqlen
    R_tokens = recent * frame_seqlen
 
    # Partition cache into three regions
    I_sink = slice(0, S_tokens)                   # First S frames
    I_rct  = slice(M - R_tokens, M)               # Last R frames
    I_cand = slice(S_tokens, M - R_tokens)        # Candidate tokens
 
    C = budget - S_tokens - R_tokens  # Top-C capacity
 
    if C > 0 and (M - R_tokens - S_tokens) > 0:
        # Compute importance scores (Eq. 7)
        Q_rct = kv_cache['win_q'][:, -R_tokens:]  # Recent queries
        K_cand = kv_cache['k'][:, I_cand]         # Candidate keys
 
        # phi_j = sum_r q_r^T k_j  (aggregated attention score)
        phi = torch.zeros(K_cand.shape[1])
        for j in range(K_cand.shape[1]):
            for r in range(Q_rct.shape[1]):
                phi[j] += Q_rct[0, r] @ K_cand[0, j]
 
        # Select Top-C tokens (Eq. 8)
        _, top_indices = torch.topk(phi, k=C)
        K_top = K_cand[:, top_indices]
        V_top = V_cand[:, top_indices]
 
        # Temporal RoPE Unification for Top-C (Section 4.3)
        delta_top = s_top_desired - s_top_base
        K_top_time = K_top[..., :time_dim]
        K_top_time *= torch.exp(1j * omega_t * delta_top)
 
        # Assemble compressed cache (Eq. 9)
        K_compressed = torch.cat([K_sink, K_top, K_rct], dim=1)
        V_compressed = torch.cat([V_sink, V_top, V_rct], dim=1)
 
        return K_compressed, V_compressed
 
    return kv_cache['k'], kv_cache['v']

代码映射: Participative Compression 的核心实现在 wan/modules/causal_model.py 中:

  • PCConfig 类(line 92-108):定义 PC 的超参数
  • _mkv_select_indices() 函数(line 121-180):基于 attention score 选择 Top-C token
  • _mkv_prune_cache() 函数(line 182-253):执行 cache 剪枝,将选中的 token 移动到 buffer 前部
  • CausalWanSelfAttention.forward() 中 PC 分支(line 440-525):整合 importance score 计算和 cache 压缩

Figure 7 解读: Top-C token selection 的可视化。每个例子展示 Frame 0(原始帧)、Frame 37(中间帧)、和 Frame 82(生成帧,右侧)。黄色高亮区域表示被 Top-C 选中的 token 的空间位置。可以看到,被选中的 token 集中在语义上重要的区域:机器人的身体和背景建筑、章鱼的触手和螃蟹、咖啡杯的圆形结构。这说明 PC 能够有效识别和保留对后续生成具有语义重要性的 token。

3.4 完整算法

论文 Algorithm 1 给出了完整的 Participative Compression with Deep Sink 算法:

# Pseudocode: Complete Deep Forcing Algorithm
def deep_forcing_generate(model, prompt, num_frames, sink_size=10, budget=16, recent=4):
    """
    Deep Forcing: 完整的长视频生成流程
    基于 Self Forcing 的 chunk-wise autoregressive generation
 
    Args:
        model: 预训练的 Self Forcing 模型
        prompt: 文本 prompt
        num_frames: 目标生成帧数
        sink_size: Deep Sink 帧数 (S=10)
        budget: PC 压缩后每帧 token budget (N=16 frames)
        recent: PC 保留的 recent 帧数 (R=4)
    """
    # 初始化 KV cache (per-layer)
    kv_caches = [initialize_kv_cache() for _ in range(num_layers)]
 
    denoising_steps = [1000, 750, 500, 250, 0]  # 4-step diffusion schedule
 
    output_frames = []
    for frame_idx in range(num_frames):
        noise = torch.randn(1, 1, C, H, W)  # 每次生成 1 帧
 
        # Multi-step denoising
        for step_idx, t in enumerate(denoising_steps[:-1]):
            # Forward pass with KV cache
            pred = model(noise, t, kv_caches, current_start=frame_idx)
 
            # Add noise for next step
            t_next = denoising_steps[step_idx + 1]
            noise = scheduler.add_noise(pred, torch.randn_like(pred), t_next)
 
        # Final denoising step
        clean_frame = model(noise, denoising_steps[-1], kv_caches, current_start=frame_idx)
        output_frames.append(clean_frame)
 
        # Re-run with t=0 to update KV cache with clean context
        model(clean_frame, t=0, kv_caches, current_start=frame_idx)
 
        # KV cache management happens inside model.forward():
        # 1. Deep Sink: keep first S frames, FIFO evict in tail
        # 2. Temporal RoPE Adjustment: realign sink positions
        # 3. Participative Compression: at first timestep when cache is full,
        #    select Top-C important tokens from candidates
 
    return decode_vae(output_frames)

代码映射: 完整的 inference pipeline 在 pipeline/causal_inference.pyCausalInferencePipeline.inference() 方法中实现(line 54-283)。核心循环在 Step 3(line 187-251),包括 denoising loop(Step 3.1)、输出记录(Step 3.2)、clean context 更新(Step 3.3)。

Figure 11 (Appendix) 解读: 验证了 PC 的设计决策 — 在不同 diffusion timestep()下,attention pattern 保持高度一致。这意味着在第一个 timestep () 进行 Top-C selection 后,选出的 token 在整个 denoising 过程中都保持 contextually relevant,因此不需要每步重新选择。

4. Experimental Setup (实验设置)

4.1 基础模型与配置

项目设置
Base modelSelf Forcing (chunk-wise, Wan 1.3B)
训练帧数~50 帧 (约 5 秒)
测试帧数30 秒 / 60 秒 (300-840+ 帧)
Denoising steps4 步, schedule {1000, 750, 500, 250, 0}
Deep Sink 10 帧
PC Budget 16 帧的 token 量
PC Recent 4 帧
每帧 token 数1560
Context window21 帧 (sliding window)

4.2 评测

  • VBench-Long: 128 prompts from MovieGen,评估 Overall Consistency、Imaging Quality、Aesthetic Quality、Subject Consistency、Background Consistency、Dynamic Degree、Motion Smoothness
  • User study: 24 人,2AFC protocol,评估 Color Consistency、Dynamic Motion、Subject Consistency、Overall Quality
  • VLM evaluation: Gemini 2.5-Pro 评估 Visual Stability

4.3 Baselines

  • CausVid [Yin et al., 2025](无 attention sink 训练)
  • Self Forcing [Huang et al., 2025](无 attention sink 训练)
  • Rolling Forcing [Liu et al., 2025](有 attention sink 训练)
  • LongLive [Yang et al., 2025](有 attention sink 训练)

5. Experimental Results (实验结果)

5.1 定量结果

Table 1: VBench-Long 30s 和 60s 生成对比

ModelFPSDynamic DegreeMotion Smooth.Overall Consist.Imaging QualityAesthetic QualitySubject Consist.BG Consist.
30 seconds
Rolling Forcing15.7930.7198.7520.9970.5860.2498.1296.91
LongLive18.1645.5598.7620.1669.0761.5197.9796.83
CausVid15.7847.2198.0819.1566.3659.7797.9296.77
Self Forcing15.7836.6298.6320.5068.5859.4497.3496.47
Deep Forcing (Ours)15.7557.5698.2720.5469.3160.6897.3496.48
60 seconds
Rolling Forcing15.7931.3598.6920.6470.2559.7597.9796.76
LongLive18.1643.4998.7520.2969.1161.2997.8596.74
CausVid15.7846.4498.0918.7865.8459.4297.8196.75
Self Forcing15.7831.9898.2118.6366.3356.4596.8296.31
Deep Forcing (Ours)15.7557.1998.2320.3869.2759.8696.9696.32

关键发现:

  • Deep Forcing 在 Dynamic Degree 上大幅领先所有方法(57.56 vs 第二名 47.21),生成更加动态的视频
  • Overall Consistency 与 training-based 方法持平或更优
  • Imaging Quality 超过 Self Forcing 和 CausVid,接近 Rolling Forcing
  • 60 秒生成时优势更加明显,Self Forcing baseline 严重退化而 Deep Forcing 保持稳定

5.2 User Study

Table 2: 用户偏好 Deep Forcing 的比例

vs BaselineColor Consist.Dynamic MotionSubject Consist.Overall Quality
CausVid98.9%95.8%96.8%100%
Self Forcing85.9%86.9%84.8%87.9%
LongLive71.2%83.5%72.2%72.2%
Rolling Forcing76.7%76.7%80.0%78.9%

用户研究显示 Deep Forcing 在所有维度上都显著优于 baselines。

5.3 Visual Stability (VLM Evaluation)

Table 3: Deep Forcing (75.44) 接近 training-based 的 LongLive (78.58) 和 Rolling Forcing (72.6),远超无 attention sink 训练的 Self Forcing (43.94) 和 CausVid (42.84)。

5.4 Ablation Study

Table 4: 组件消融

MethodDynamic DegreeOverall ConsistencyImage Quality
SF (Baseline)36.6220.5068.58
SF + DS48.5820.5468.54
SF + DS + PC (Ours)57.5620.5469.31

每个组件都带来渐进式提升,Deep Sink 主要提升 Dynamic Degree 和 Consistency,PC 进一步提升 Dynamic Degree 和 Image Quality。

Figure 6 解读: 30 秒视频生成的定性消融对比。第一行 Self Forcing (SF):随时间推移出现严重的颜色漂移和过饱和。第二行 SF + Deep Sink:颜色保持更一致,但在 Frame 460 仍有轻微的颜色偏移和纹理模糊。第三行 SF + DS + PC (Deep Forcing):在整个生成过程中保持一致的视觉质量,色彩和细节均无明显退化。

Figure 9 (Appendix) 解读: 三种 attention sink 策略的对比。LongLive Attention Sink(只保留前 3 帧,不调整 RoPE)在 frame 800 出现 fidelity degradation,frame 801 闪烁,frame 802 回滚到早期帧。Rolling Forcing Attention Sink(保留前 3 帧 + Dynamic RoPE)仍在 frame 800-801 出现严重退化。Deep Sink(保留前 10 帧 + Temporal RoPE Adjustment)在整个生成过程中保持稳定的视觉质量。

Figure 10 (Appendix) 解读: 不同 sink 大小在 60 秒视频上的定性对比。Sink 0(无 sink):快速退化,frame 230 开始颜色偏移,frame 690 完全崩溃。Sink 4 和 Sink 9:退化减少但细节仍有损失。Sink 14:退化大幅减少。Sink 18:过度保留导致内容重复。最优范围为 10-15 帧。

5.5 定性结果

Figure 1 解读: Deep Forcing(training-free)与 training-based baselines 的定性对比。上半部分:Deep Forcing vs Rolling Forcing,在东京街头场景中 Deep Forcing 保持一致的视觉质量和细节。下半部分:Deep Forcing vs LongLive,在两只狗奔跑的场景中 Deep Forcing 保持更好的动态运动和一致性。

Figure 8 解读: 30 秒视频的逐帧对比。上半部分(太空人场景):CausVid 出现颜色偏移,Self Forcing 产生条纹伪影,LongLive 和 Rolling Forcing 保持较好但运动较少,Deep Forcing 保持高质量且运动丰富。下半部分(闪电场景):Deep Forcing 在保持主体一致性的同时生成更多动态变化。

Figure 13 (Appendix) 解读: Token selection frequency heatmap,横轴为 token 位置(0-32,760),纵轴为生成过程中的时间。上图为 Gaussian random selection(随机基线),下图为 denoising query-based selection(PC 方法)。Random selection 均匀分布在所有 candidate 上,而 PC 方法高度集中在特定位置,尤其是 sink boundary(position 15,600)附近的 token 被持续选择,说明这些 token 是连接初始上下文和当前生成的语义桥梁。

Figure 12 (Appendix) 解读: Random selection vs Denoising query-based selection 的对比。Random selection 导致严重的场景重复和上下文丢失(随机选择的 anchor 无法保持连贯的上下文信息)。Denoising query-based selection 生成具有更好主体一致性和上下文连贯性的视频。

Figure 14 解读: 这张图展示了用户偏好调查的详细统计结果,与表格中的结论一致,Deep Forcing 在各 baseline 对比中通常获得更高的用户偏好比例。

Figure 15 (Appendix) 解读: 这张图展示了更多 attention head 的可视化分析,进一步支持预训练 Self Forcing 模型中存在 deep attention sink behavior 的观察。

Figure 16 (Appendix) 解读: 这张图展示了额外的定性对比样本之一,用于补充说明 Deep Forcing 在不同场景下的生成质量与稳定性。

Figure 17 (Appendix) 解读: 这张图继续展示额外的定性对比样本,与上一张一起补充说明 Deep Forcing 在多种场景中的稳定生成表现。

5.6 总结

Deep Forcing 的核心贡献在于发现预训练 autoregressive video diffusion 模型中天然存在 deep attention sink behavior,并据此设计了两个 training-free 的 KV cache 管理策略。Deep Sink 通过保留约一半 context window 作为持久 sink + Temporal RoPE Adjustment 解决时间位置不匹配问题;Participative Compression 通过 importance-aware token selection 消除冗余 token、降低 attention dilution。两者结合实现了 12 倍以上的长度外推,在多项指标上匹配甚至超越需要额外训练的方法。该工作证明了 training-free 的 KV cache 管理可以是解决 autoregressive long video generation 中 error accumulation 问题的有效路径。

5.7 局限性

  1. 受限于 frozen backbone 的能力和 bias
  2. 缺乏显式的 long-term memory,在极长序列中出现重复遮挡时可能仍有 gradual drift
  3. 未来方向:引入 hierarchical memory modules,扩展到更广泛的视频生成场景