TL;DR
ContextMaster introduces a unified framework for Interactive Multi-Shot Video Creation (IMVC), allowing users to seamlessly generate, reference, and edit videos across an evolving narrative history. By combining a fixed-budget sparse context routing mechanism with a two-stage privileged context distillation pipeline, it maintains long-term visual consistency and high task fulfillment while running at a blazing 16 FPS on a single GPU.
What Problem Does This Paper Address?
While modern video diffusion models excel at isolated tasks—like generating a clip from text, following an image reference, or editing an existing video—they typically treat these operations as one-off tasks over fixed inputs. Real-world video production, however, is iterative and multi-shot. Creators need to generate a new shot, maintain character identity from a reference image, or edit a previous shot, all while keeping the entire video history visually consistent.
The core challenge in this stateful, multi-turn setting is the exploding computational cost. As the video history grows, performing dense attention across all previous frames at every denoising step becomes prohibitively expensive. Existing streaming or rolling-window approaches bound this cost but discard long-term history, leading to character drift or narrative breaks across shots.
Methods
ContextMaster formalizes this problem as Interactive Multi-Shot Video Creation (IMVC) and solves it using three core architectural and training innovations:
- Role-Aware Rotary Position Embeddings (RoPE): To prevent the model from confusing different types of visual inputs, the authors introduce phase offsets into the temporal coordinates. This allows a single transformer block to explicitly differentiate between reference images, historical shots, source videos (for editing), and the target frames currently being denoised.
- Cacheable Fixed-Budget Context & ConstraintSink: The model isolates the clean context (history, references, sources) from target noise, allowing its Key-Value (KV) states to be prefilled just once per round. To keep inference costs constant, target queries use block-sparse attention limited to a fixed budget ($B$ blocks). Crucially, a mechanism called ConstraintSink mandates that critical structural constraints—like the reference image identity and temporally aligned source frames—are always visible within this budget, while the remaining capacity dynamically retrieves content-relevant historical blocks.
- Privileged Context Distillation (PCD): Operating with a sparse context budget and few denoising steps introduces errors. To fix this, the authors employ a two-stage distillation strategy:
- Stage 1 (Privileged Consistency Distillation): A dense, full-context teacher model guides a sparse, few-step student model, enforcing consistency across noise levels.
- Stage 2 (Distribution Matching Distillation - DMD): The student is refined on its own autoregressive rollouts to sharpen visual details and minimize error accumulation over long sequences.
Datasets
- Training Data: The model is initialized from Wan2.1-T2V-1.3B and trained on public datasets including HuMo, Kiwi-Edit, and Ditto-1M to establish baseline single-shot capabilities. This is augmented with an internal dataset of 1 million multi-shot videos to train the model on sequential shot transitions.
- Evaluation Benchmarks: The authors curated specific evaluation sets for each primitive task: 100 multi-shot prompts for Text-to-Multi-Shot Video (T2MV), 50 reference-conditioned cases for Reference-to-Multi-Shot Video (R2MV), and 50 multi-shot source videos for Video-to-Multi-Shot Video Editing (V2MV).
Key Insights and Ideas
- Hard Constraints Over Pure Retrieval: Standard similarity-based Top-$k$ routing fails for video editing and identity preservation because local frame similarities can easily wash out distant but critical reference tokens. Forcing structural anchors into the attention matrix via
ConstraintSinkis essential for maintaining identity and layout alignment. - Guidance Absorption: By distilling a classifier-free guided (CFG) teacher into a student that only evaluates conditional text, the student effectively "absorbs" the guidance. This eliminates the need for an unconditional forward pass at inference time, doubling the generation speed.
- The Power of Two-Stage Distillation: Consistency distillation is excellent for stabilizing the flow map and ensuring cross-shot identity, but it tends to smooth out details. Following it up with distribution matching (DMD) acts as a perceptual refiner, bringing back fine textures and sharp details.
Key Results
ContextMaster achieves state-of-the-art performance across all three primitive video tasks while maintaining interactive speeds:
- Efficiency: The model achieves 16.74 FPS on a single NVIDIA H200 GPU using a 4-step denoising trajectory, significantly outperforming specialized real-time streaming baselines like ShotStream and LiveEdit.
- Quality & Consistency: Quantitative evaluations using VBench and ViCLIP show that ContextMaster leads in text alignment (TA) and Inter-Shot consistency (0.836 vs. ShotStream's 0.808 in T2MV).
- Ablation Studies: Context budget testing revealed that 6 Frame Equivalents (FE) represents the optimal sweet spot; increasing the budget to 8 FE yielded diminishing returns in quality while degrading throughput.
Limitations and Future Work
Despite bounding the target-to-context read cost, ContextMaster still requires the context branch to perform a bidirectional prefill over the full accumulated history to construct its initial KV cache. As a result, inference throughput experiences a slight, gradual decay of approximately 0.4 FPS per additional shot added to the session history. The authors note that future work will focus on developing persistent per-shot caches and highly compact shot summaries to achieve true constant-time history prefilling.
Summary updated