RepoTencent HunyuanTencent Hunyuanpublished Nov 13, 2026seen 5d

Tencent-Hunyuan/Refrain

Python

Open original ↗

Captured source

source ↗
published Nov 13, 2026seen 5dcaptured 4dhttp 200method plain

Tencent-Hunyuan/Refrain

Language: Python

Stars: 3

Forks: 0

Open issues: 0

Created: 2026-11-13T03:55:17Z

Pushed: 2026-11-23T04:09:27Z

Default branch: main

Fork: no

Archived: no

README:

Refrain

Learning Multi-Shot Consistency from Inconsistent References for A²O Video Generation

Any Reference · Any Duration · One Timeline

Hongru Yan1,2,*, Yue Wu2,‡, Jian-Wei Zhang2, Liangbin Xie2,3, Mingzhe Zheng2,4, Shenghua Gao1,†

1The University of Hong Kong 2Tencent 3University of Macau 4The Hong Kong University of Science and Technology

*Work done during internship at Tencent Hunyuan †Corresponding author ‡Project leader

Refrain generates a coherent multi-shot video in a single diffusion pass from any mix of text, image and video references. References are placed on one shared timeline, each shot keeps its requested duration, and references with clashing styles are rendered in one consistent look. The model learns this by reconstructing an unedited video from references that were restyled independently, so it has to remove the style clashes itself. We also release the Refrain Benchmark and Shot-Debiased Consistency (SDC), a cross-shot style metric calibrated on 2.14M real videos. More results are on the project page.

![Refrain teaser: T2V, V2V, TI2V and TIV2V requests on one shared timeline](assets/teaser.jpg)

Highlights

  • Self-supervised reconstruction learning. Reference shots cut from the same source video are

edited independently (lighting, background, style, subject appearance), and the model is trained to recover the unedited source under a shared style prompt. It learns to suppress style conflicts while keeping reference content and motion. DurMix-300K provides these pairs with reference durations that differ from the target shot.

  • Unified sparse conditioning (A²O). One backbone handles T2V, V2V, TI2V and TIV2V. Image and

video references are written onto a shared temporal canvas at their target positions, with no extra conditioning modules. A reference can be shorter or longer than the shot it controls.

  • Shot-Debiased Consistency (SDC). CLIP/DINO similarity mistakes intended cuts (new subject,

new scene) for inconsistency and barely reacts to real style clashes. SDC compares cross-shot style change with what real videos show at the same amount of content change. It detects 78.0% of single-shot style edits at 5% FPR and reaches AUC 0.97 against human judgments on real footage.

Abstract

A comic-book character, a photorealistic cityscape, an oil-painted coffee cup: such stylistically diverse references provide visual guidance across shots and frames, yet generating a coherent multi-shot video that unifies their visual styles while preserving subject identities and scene content remains challenging. Existing methods maintain cross-shot continuity through additional attention control or memory processing. However, they struggle to resolve disparate per-shot styles or handle reference–target duration mismatches within a single framework.

To tackle this, we introduce Refrain, a unified model that learns cross-shot consistency through a self-supervised reconstruction task: reference clips from the same original video are deliberately perturbed with distinct visual edits, challenging the model to recover the unedited source footage under a shared style prompt. In this way, Refrain learns to suppress conflicting stylistic artifacts while faithfully retaining reference content and motion dynamics. Operating on the A²O principle (Any Reference, Any Duration, One Timeline), Refrain maps image and video references onto a shared temporal canvas without auxiliary conditioning modules. For evaluation, experiments show that standard CLIP or DINO metrics frequently overlook stylistic clashes or misinterpret intended narrative cuts as inconsistency. We therefore propose Shot-Debiased Consistency (SDC), which uses an extensive real-video bank to establish a baseline for style variation associated with content changes. By discounting this baseline, SDC evaluates cross-shot style shifts against real-world distributions. We further construct DurMix-300K, a dataset pairing stylistically altered clips of varying lengths with their original video sequences, to train the model. Extensive experiments demonstrate that Refrain achieves state-of-the-art performance in cross-shot consistency, while excelling at shot timing, reference adherence, and text alignment.

Table of Contents

  • [How Refrain Works](#how-refrain-works)
  • [Shot-Debiased Consistency (SDC)](#shot-debiased-consistency-sdc)
  • [Visual Results](#visual-results)
  • [Quantitative Results](#quantitative-results)
  • [Release Status](#release-status)
  • [Installation](#installation)
  • [Checkpoint Preparation](#checkpoint-preparation)
  • [Quickstart](#quickstart)
  • [Key Parameters](#key-parameters)
  • [Repository Layout](#repository-layout)
  • [Acknowledgements](#acknowledgements)
  • [Citation](#citation)

How Refrain Works

![Self-supervised reconstruction with DurMix (A) and joint multi-shot generation on one timeline (B)](assets/method.png)

(A) DurMix-300K: references that disagree on purpose. A coherent multi-shot source video is cut into shots (TransNetV2). The first frame of selected shots is edited with one of 61 instructions (FLUX.1 Kontext: lighting, background, style transfer, subject appearance, …). The clip is optionally cropped or extended to a new length (SkyReels-V3), and the edit is propagated through the clip by a depth-conditioned Wan model. Qwen3-VL and TransNetV2 filter out degraded clips. Each shot is edited *independently*, so the references clash with each other, while the unedited source video remains the reconstruction target.

(B) Refrain: one canvas, one trajectory. All conditions are encoded by the 3D VAE and written onto a reference canvas aligned with the target timeline.

| Component | Role | |---|---| | Reference canvas + occupancy mask | Reference latents sit at their exact target positions; empty slots are generated. An image anchor occupies one latent frame. | | Sparse placement | A reference shorter than its shot fills only part of the shot; a longer one is mapped onto the shot's latent frames by frame selection that keeps its first and last frame. Latents are never interpolated. | | Shot-aware RoPE | Each token carries its shot coordinate plus a...

Excerpt shown — open the source for the full document.