Live2Diff: Live Stream Translation via Uni-directional Attention in Video Diffusion Models

## Abstract

Abstract Large Language Models have shown remarkable efficacy in generating streaming data such as text and audio, thanks to their temporally uni-directional attention mechanism, which models correlations between the current token and previous tokens.
However, video streaming remains much less explored, despite a growing need for live video processing.
State-of-the-art video diffusion models leverage bi -directional temporal attention to model the correlations between the current frame and all the surrounding (i.e. including future ) frames, which hinders them from processing streaming videos.
To address this problem, we present Live2Diff , the first attempt at designing a video diffusion model with uni-directional temporal attention, specifically targeting live streaming video translation.
Compared to previous works, our approach ensures temporal consistency and smoothness by correlating the current frame with its predecessors and a few initial warmup frames, without any future frames.
Additionally, we use a highly efficient denoising scheme featuring a K ⁢ V 𝐾 𝑉 K{}V{} italic_K italic_V -cache mechanism and pipelining, to facilitate streaming video translation at interactive framerates.
Extensive experiments demonstrate the effectiveness of the proposed attention mechanism and pipeline, outperforming previous methods in terms of temporal smoothness and/or efficiency.

## 1 Introduction

Large Language Models (LLMs) have recently been very successful in natural language processing and various other domains [, , , , ].
At the core of LLMs is the autoregressive next-token prediction, seamlessly enabling real-time streaming data generation.
Such a mechanism processes data continuously as it streams in, bypassing the need for batch storage and delayed processing.
This token prediction mode has been widely used in many applications such as dialog systems [, ], text-to-speech [, ], audio generation [, , ], etc.
Despite the recent success of this streamed generation of sequential data like text and audio, it has not been fully explored for another very common sequential data type: videos.
However, generating videos in a streaming manner is clearly worth investigating given the growing practical demand, particularly in live video processing, where the original input frames need to be translated into a target style on the fly.

Motivated by this, we study next-frame-prediction for producing streaming videos, with streaming video-to-video translation as the target application.
Most existing video diffusion models exploit temporal self-attention modeling in a *bi*-directional manner,
where the models are trained on sequences of input frames to capture the pairwise correlations between all frames in a sequence [, , , , , ]. Despite some promising results, these models have limitations for streaming video. Early frames in a sequence rely on information from later frames, and vice versa for those at the end, which impedes efficient real-time processing of each frame as it streams in.

To address this issue, we redesign the attention mechanism of video diffusion models for streaming video translation, ensuring both high efficacy and temporal consistency. First, we make temporal self-attention *uni*-directional via an attention mask, akin to attention in LLMs [, ].
This removes the dependency of early frames on later frames in both training and inference,
making the model applicable to streaming videos.
However, ensuring both high inference efficiency and performance on long video streams using unidirectional attention is non-trivial.
An approach is to use dense attention with all previous frames for next-frame prediction. However, it increases time complexity and decreases performance when the video length exceeds the attention window size used during training.
Another option is to limit temporal self-attention to a smaller fixed window size during inference.
Unfortunately, unlike the sufficient context attention from user input tokens
in LLM [, , ], it is difficult to generate satisfactory frames with limited context attention at the beginning of the video stream, which further results in artifacts in later frames.
To tackle this, we introduce warmup area in the unidirectional attention mask, which incorporates bi-directional self-attention modeling to compensate for the limited context attention at the beginning of the stream. During inference, we include the attention from a few warmup frames at the start of the stream to the current frame. Such a tailored attention design ensures both stream processing efficacy and temporal consistency modeling.

Building upon our tailored attention mechanism, we present Live2Diff, a pipeline that processes LIVE video streams by a uni-directional video DIFFUSION model while ensuring high efficacy and temporal consistency.
First, our attention modeling mechanism removes the influence of later frames on previous frames, allowing for the reuse of $K$ and $V$ maps from previously generated frames. This eliminates the need for recomputation when processing subsequent frames. We carefully designed a $K{}V{}$-cache feature in the diffusion pipeline to cache and reuse K/V maps, resulting in significant computation time savings.
Second, we further include a lightweight depth prior in the input, ensuring structural consistency with the conditioning stream.
Finally, Live2Diff uses the batch denoising strategy to further improve stream processing efficacy, achieving 16FPS for $512\times 512$ videos on an RTX 4090 GPU.
We conduct extensive experiments to validate the superiority of Live2Diff in terms of temporal smoothness and/or efficiency. We summarize our main contributions as follows,

- •
To the best of our knowledge, we are the first to incorporate uni-directional temporal attention modeling into video diffusion models for video stream translation.
- •
We introduce a new pipeline Live2Diff, which aims at achieving live stream video translation with both high efficacy (16FPS on an RTX 4090 GPU) and temporal consistency.
- •
We conduct extensive experiments including both quantitative and qualitative evaluation to verify the effectiveness of Live2Diff.

Figure: Figure 1: We visualize different types of temporal self-attention when the number of frames ($F=8$) exceeds the length of the context window ($L=4$). The $j$-th cell of the $i$-th row is highlighted if the output for frame $i$ may contain information from frame $j$. The red square delineates the attention mask used during training. (a) shows temporal self-attention in current video diffusion models, which is bi-directional within the context window without overlap between chunks. (b) uses a sliding window with overlap $L_{s}$ (three subsequent positions of which are highlighted in different colors, for clarity) and fuses the output of overlap regions. (c) denotes the uni-directional attention widely used in LLMs. (d) shows the attention proposed by our method. We set the initial $L_{w}$ frames as warmup frames and apply bi-directional attention to them, while using uni-directional attention for the subsequent frames. The initial warmup frames also contribute to the output for all future frames.
Refer to caption: x1.png

## 2 Related Work

Attention.
LLMs [, , , ] owe their success largely to the remarkable efficacy of the attention mechanism []. In order to support the auto-regressive prediction of the next token, they use a uni-directional (or “masked”) attention mechanism, restricting the model to learning the dependence of *later* tokens on *earlier* ones, but no dependence of earlier tokens on later ones.
However, for tasks with very long token sequences, relating the current token to all previous tokens becomes intractable.
To address this, StreamingLLM [] proposes to relate the current token to several initial tokens and a number of most recent tokens, which improves efficiency in handling long tokens.
While such kind of uni-directional attention is widely used in generating text and audio, video generation has not yet followed this trend: Bi-directional attention without masks is commonly used in video diffusion models [, , , ] to generate video chunks.
In this work, we study the use of uni-directional temporal attention in video diffusion models.
While our method draws inspiration from StreamingLLM, it is the first time that such a design is studied in the video domain.

Video Diffusion Models.
The multitude of possible conditioning modalities has made diffusion models the basis for image editing approaches [, ], as well as video generation models [, , ]. For example, AnimateDiff [] extends StableDiffusion by a so-called “motion module”, enabling the denoising of entire video chunks based on temporal self-attention [].
FreeNoise [] is a method based on pretrained video diffusion models (e.g. AnimateDiff []) for long video generation.
This method carefully selects and schedules the latent noise for every time step in order to improve temporal smoothness. However, FreeNoise, according to their experiments section produces frames at under 3FPS on an NVIDIA A100 GPU, which is not acceptable in the kinds of live streaming scenarios that we aim at (see Section 1). FlowVid [] and Rerender [] produce frames at even lower rates, albeit with acceptably smooth results.

Accelerating Diffusion Models.
Some recent diffusion-based methods [, , , ] have prioritized low latency and/or high throughput: (Latent) consistency models (LCMs) [, ] have reduced the number of denoising steps from 50 (the default in StableDiffusion) to as low as 4, leading to large speed ups without too much loss in quality. This principle has even been combined with the use of low-rank matrices for fine-tuning [], allowing further speedup. A work that very specifically targets the streaming frame-by-frame translation setting is StreamDiffusion []: Not only is this technique utilizing the aforementioned low-rank-adapted LCMs, but also it denoises video frames in a “pipelined” manner for the streaming scenario, i.e. the batch of images to be denoised can contain different levels of remaining noise, allowing new frames to be added to the batch before previous frames in the batch have been completely denoised, which makes optimal use of GPU parallelization.
However, StreamDiffusion renders videos frame-by-frame without any temporal modeling, leading to significant temporal discontinuity, which our method avoids due to the temporal correlations learned during training.

## 3 Method

Our method, Live2Diff (see Fig. 2), takes as input a stream of video frames, along with a matching text prompt. It produces a stream of output video frames, the spatial structure of which is similar to that of the input frames, but the appearance/style of which conforms to a specified target style, captured by DreamBooth [].
To achieve this, we replace the bidirectional temporal attention used in previous approaches by *uni*directional attention (Section 3.3). This allows us to cache $K$ and $V$ maps from previous frames, leading to increased throughput (Section 3.4). Furthermore we accelerate generation by pipelined denoising, i.e. multiple time steps with different levels of residual noise are denoised in parallel. By employing LCM-LoRA[] we can drastically reduce the number of necessary denoising steps, which also helps meet framerate criteria.
We stabilize the spatial structure of frames with lightweight depth injection.

Figure: Figure 2: The overview of Live2Diff. (a) During training, our model takes as inputs $L$ frames of noisy latents $z_{t}^{f:f+L}$ and depth conditioning $y^{f:f+L}$, where $f:f+L$ delimits the frame interval in a video stream, $t$ is the denoising timestep, $\oplus$ denotes point-wise addition. (b) During inference, frame $z^{f+1}$ is incorporated into the processing batch as it streams in, often before earlier frames are fully denoised. This results in a batch that includes frames at various denoising timesteps (e.g., $t_{1}$ and $t_{2}$). We employ a $K{}V{}$-cache mechanism to effectively reuse $K$ and $V$ maps from previous frames, significantly improving inference efficiency while ensuring temporal consistency.
Refer to caption: x2.png

### 3.1 Preliminaries

Diffusion Models.
Diffusion models [, ] aim at undoing the so-called “forward process”, that iteratively adds Gaussian noise to the representation of a sample from a distribution. To achieve this, StableDiffuion [] trains a U-Net [] to estimate the noise component of a noisy latent representation of any given image. By repeatedly estimating remaining noise and removing (some of) this noise from the latent code, a purely Gaussian noise vector can iteratively be denoised to obtain a clean sample as follows: Given a noisy latent code $z_{t}$, the U-Net parametrized by weights $\theta$ computes the estimated noise $\epsilon_{\theta}(z_{t},t,\mathcal{T}(c))$, where $\mathcal{T}(c)$ is the CLIP encoding [] of a conditioning text string $c$. The less noisy latent code $z_{t-1}$ can then be approximated as

$$ $z_{t-1}\approx\lambda\cdot z_{t}+\mu\cdot\epsilon_{\theta}(z_{t},t,\mathcal{T} (c))$ (1) $$

where $\lambda,\mu\in\mathbb{R}$ are constants derived from the noise schedule of the forward process [].
The U-Net is trained by sampling images $x$ from the training distribution, mapping them to latent codes $z_{0}=\mathcal{E}(x)$ and then adding varying amounts of Gaussian noise to obtain $z_{t}$, such that the U-Net output can be supervised by $L1$ distance to the known noise. Like in StableDiffusion, we use this as our main loss, but with $x$ holding not single images, but chunks of consecutive video frames.

Bidirectional Attention in Video Generation.
Several video diffusion models [, , , ] use temporal self-attention layers to improve temporal smoothness of the output, essentially encouraging the model to learn temporal correlations.
A temporal self-attention layer computes its output as

$$ $f_{\text{out}}:=\operatorname{softmax}\left(\frac{QK^{\top}}{\sqrt{C}}\right)\cdot V$ (2) $$

where $Q:=\mathcal{W}_{Q}\cdot f_{\text{in}}$, $K:=\mathcal{W}_{K}\cdot f_{\text{in}}$, and $V:=\mathcal{W}_{V}\cdot f_{\text{in}}$ are linear projections of the input features$f_{\text{in}}$ and $C$ is the number of feature channels.
AnimateDiff adds sinusoidal position encoding to $f_{\text{in}}$ before computing Eq. 2, to give the layer access to the temporal position of each feature vector.
Note that $f_{\text{in}}$ contains information about an entire chunk of frames, as does $f_{\text{out}}$.
Since previous works use such temporal attention layers without masking [], $f_{\text{out}}$ can thus base its information about a particular frame on frames before and *after* that frame. Exploiting temporal correlations in this bidirectional way helps produce temporally smooth output, but is counter-productive for the streaming setting, as a prefix of $f_{\text{out}}$ will often need to be computed before the full $f_{\text{in}}$ is even available.
In FreeNoise [] this “direct” bidirectionality was constrained in the sense that only frames from a “temporal neighborhood” can influence each other *directly* (see Fig. 1 (b)), but since the U-Net contains multiple temporal attention layers and because denoising requires multiple U-Net applications, the distance over which information can be transferred backwards in time is still considerable. Fig. 3 (b) and (c) show the artifacts of using this attention mode for streaming.

Figure: Figure 3: The X-T slice shows how the pixel values at the same X-coordinate change over time T. The position of the horizontal lines in the video corresponds to the X-coordinate positions visualized in the X-T slice. The color of each line represents the time in the X-T plot. Red dashed boxes denote regions suffering from flickering and structural inconsistency, while blue boxes indicate areas where these issues are resolved. Flickering and gradual change in the background region can be observed in (b), (c) and (d), which use the first three attention modes illustrated in Fig. 1 respectively. In case (e), with the last attention mode from Fig. 1 (see also Section 3.3, background flickering is reduced. The depth conditioning in (f) improves structure consistency further.
Refer to caption: x3.png

### 3.2 Input & Structural prior

Following AnimateDiff[], we insert temporal self-attention modules (TSA) in-between the StableDiffusion[] U-Net layers, see Fig. 2.
In order to condition our generated video on the input video similarly to SDEdit [] we add a certain amount of Gaussian noise to the input frames.
The strength of this noise is chosen such that the high level spatial structure of the image is still recognizable, but the appearance information is largely erased at finer scales. This requires the denoising U-Net to fill in appearance information according to the target style.
To facilitate the preservation of spatial structure we use an additional depth input: We use MiDas [, ] for frame-wise depth estimation. The depth frames are then encoded by StableDiffusion’s encoder $\mathcal{E}$, with the results being fed into a lightweight convolutional module $E^{cond}$ (see Fig. 2).
Finally, we add the output of the conditional module to the first convolution layer and pass it through the U-Net.
We found this explicit structural prior to help the transferred video maintain better structural consistency with the source video.
Evidence can be found in Fig. 3 and Section 4.

### 3.3 Uni-directional Temporal Self-Attention with Warmup

To turn bi-directional attention, as shown in Fig. 1 (a), in which each frame inside a chunk can be based on information from all other time steps in the chunk, into uni-directional attention, where each frame can only depend on *earlier* frames, we use masked attention [, ].
Fig. 1 (c) presents a solution using the uni-directional attention mask commonly used in LLM[, , , ].
However, as shown in red dashed box in Fig. 3 (d), the spatial structure of the first frame’s output is inconsistent with the input, and the character identity differs from subsequent frames. Flickering in the background region can be observed in the X-T slice as well. We believe that the reason for this attention mode being less effective for video transfer than for LLMs is rooted in the fact that in LLMs, attention operations rely on user prompts as initial tokens for uni-directional attention, while in video transfer such initial tokens first need to be generated by the model.

This is why we choose the attention mask in Fig. 1 (d): We apply bi-directional attention in the corner case of the first $L_{w}$ “warmup” frames, and unidirectional attention afterwards.
In Fig. 3 (e) we observe that the flickering issue in the red dashed region has been resolved.
The remaining structure inconsistencies between the red and blue dashed regions compared to the input are resolved by the structural prior (see Section 3.2).

Figure: Figure 4: (a) - (c) depict the usage of our $K{}V{}$-cache for the first steps of a stream, with $L_{w}=T=2$. The colors of the squares indicate which frame they belong to. $Q,K,V$ are the matrices used in Eq. 2, with subscripts indicating which denoising step they are used in and superscripts indicating which frame they belong to. Each row belongs to one of the two denoising steps. Red arrows are overwrite operations. For a step by step walkthrough see Section 3.4.
Refer to caption: x4.png

### 3.4 High Efficiency Inference Pipeline

$K{}V{}$-cache. As described in Section 3.3 our warmup-based temporal self-attention makes sure that when we compute the attention for a certain frame, the attention for all previous frames has already been computed. This means that those parts of the matrices $K$ and $V$ in Eq. 2 that concern the previous frames do not need to be computed again, but can be retrieved from a cache, our $K{}V{}$-cache. Note that the diffusion U-Net has multiple temporal attention layers, and that the U-Net needs to be applied $T$ times in order to fully denoise a frame. This means that for every combination of layer and denoising step, we keep a separate $K{}V{}$-cache.
More details in Section A.2.

Warmup stage.
At the start of the stream, we feed $L_{w}$ frames into the U-Net and denoise them completely, with bidirectional attention as introduced in Section 3.3. This gives us the $K$ and $V$ matrices highlighted in green in Fig. 4. They are used for *all* future frames for temporal consistency.

Pipelined denoising. Similarly to StreamDiffusion [], we denoise frames in a pipelined manner, i.e. as soon as the next input frame becomes available, we add it to the batch of frames to be denoised, even though it may contain a much higher amount of noise than previous frames in the batch that have already undergone multiple denoising steps. This way we utilize our GPU capacity most efficiently, increasing throughput.

Fig. 4 illustrates the bookkeeping in our $K{}V{}$-cache for the simple case $L_{w}=T=2$, just after warmup: In the first step, to process the red feature vector, temporal self attention according to Eq. 2 is computed only using the green $K$ and $V$ maps and the red one. The $K$ and $V$ for the input token are then written into the cache (red arrow) and one denoising step can be computed. In the second step, the orange frame arrives, which in addition to the green warmup tokens we also correlate with the previously cached $K$ and $V$ for the red frame. In parallel with the first denoising step for the orange frame, we compute the second denoising step for the red frame. Now all caches are filled, for the third step, in which the blue input frame arrives.

### 3.5 Training

To train our model we use data collected from Shutterstock [], resized to resolution $256\times 256$. We choose $L=16$ and $L_{w}=8$.
We train our model as follows: We initialize the weights of our temporal self-attention modules with the weights from AnimateDiff and fine-tune them for 3000 iterations using our uni-directional attention (Section 3.3). Then we add $E^{cond}$ (Section 3.2), with the last layer initialized with zeros [] and train all weights jointly for 6000 iterations.
We use the Adam [] optimizer with a learning rate of $1e-4$ and train on batches of 4 samples per GPU, on 8 GPUs. Accumulation of 32 gradients leads to an effective batch size of 1024.

## 4 Results

### 4.1 Evaluation Setup

Dataset.
We evaluate on the DAVIS-2017 [] dataset, which contains 90 object-centric videos.
We resize all frames to $512\times 768$ via bilinear interpolation and use CogVLM [] to caption the middle frame of each video clip.
To specify the target style, we add the corresponding trigger words of DreamBooth and LoRA as suffix. For more information about the prompts, see Section A.3.

Metrics.
We evaluate three aspects of the generated videos: *structure consistency* (Output frames should have similar spatial structure as input frames), *temporal smoothness* (no sudden jumps in the motion) and *inference latency*.
We measure *structure consistency* as the mean squared difference between the depth maps estimated [] for the input and output frames.
As in previous work [, , ] we measure *temporal smoothness* by CLIP score [], i.e. by the cosine similarity of the CLIP embeddings of pairs of adjacent frames. In addition we compute the so-called “warp error” [] for pairs of adjacent frames, i.e. we compute the optical flow [] between the frames and then warp the predecessor frame accordingly, to compute a weighted MSE between the warping result and the successor.
We also conduct a user study to evaluate *structure consistency* and *temporal smoothness*: Each participant is given triplets of videos (original input video, result from our method, result from a random different method) and is asked to identify the result with the best quality. Then we calculate the rate of our method winning compared to other methods. A higher win-rate indicates that users perceive our method to be better in the corresponding evaluation direction. Please refers to Section A.3 for detailed information.
We measure *inference speed* as the total amount of time it takes each method to process an input stream of 100 frames at resolution $512\times 512$, on a consumer GPU (NVIDIA RTX 4090).

### 4.2 Comparisons

We compare our method to three previous works, all based on StableDiffusion [] and compatible with DreamBooth [] and LoRA []:
StreamDiffusion[] applies SDEdit on a frame-by-frame basis. The same noise vector is used for all the frames, to improve consistency and smoothness. To achieve interactive framerates, StreamDiffusion uses LCM-LoRA[] and Tiny-VAE[], with the latent consistency model scheduling []. We apply the same acceleration techniques in our method.
Rerender[] first inverts input key frames into noisy latent codes. During denoising, temporal coherence and spatial structure stabilization are achieved by using cross-frame attention, flow-based warping and ControlNet []. We select all frames as key frames for the purposes of our evaluation, but otherwise use the default settings.
FreeNoise [] does not natively support an input video as conditioning, but by adding a sufficient amount of noise to the input, similar to our method and SDEdit, we can nevertheless use it for our video-to-video translation task.
The amount of noise we add is equivalent to half of the entire denoising process.
FreeNoise uses a technique called window-based attention fusion, that (similar to bidirectional temporal attention) leads to frames incorporating information from future frames. This actually makes it unsuitable for the streaming setting, which we mitigate by giving FreeNoise access to *all* frames, not expecting to receive the first output frames after we have given the last input frames. In this sense we are giving FreeNoise a considerable advantage.
Qualitative Comparison.
Fig. 5 compares outputs of all methods: While part (a) shows two consecutive output frames, part (b) shows frames that are further apart.
StreamDiffusion[] exhibits strong flickering in the background (red box in (a)). When foreground and background are difficult to distinguish (box and shelf in (a), dog and table in (b)), works other than ours struggle to produce satisfactory results:
StreamDiffusion generates inconsistent results with low quality.
Rerender generates strong artifacts in the first frame (see (a)) and propagates them to later frames.
FreeNoise fails to adhere to the input frame and generates elements unrelated to prompt and input.
In contrast, our method leverages depth information to ensure the structural accuracy of the generated results (e.g. the box in Fig. 5 (a)) and maintains consistency over longer duration (dog in Fig. 5 (b)).

Quantitative Comparison.
In Table 1 we evaluate structure consistency and temporal smoothness:
While our method outperforms the others in structure consistency, we observe that FreeNoise achieves a better CLIP score and warp error for temporal smoothness. This is not surprising, as the way that time steps are correlated in FreeNoise allows information to flow bidirectionally along the temporal axis, which, unlike for all other methods, required FreeNoise to be given access to *all* frames at once (see first paragraph of Section 4.2). This is an unfair advantage to FreeNoise, violating some assumptions of the streaming scenario, as it allows FreeNoise to correlate its output frames to input frames that would likely not be available at the time the output frame needs to be produced.
In our user study, all our win rates are way above 50% for both structural consistency and temporal smoothness, confirming that our results are the most convincing.
StreamDiffusion[] scores second-best in structure consistency, likely because it applies only a moderate amount of noise to its input, but this limits its ability to conform with the target style (see also Fig. 5).
Table 1 also compares inference latencies, i.e. the average time that goes by between receiving an input frame and producing the corresponding output frame. As is to be expected for a method that first consumes all the frames before producing any output, FreeNoise has by far the largest latency, which makes it unusable for the live streaming scenario. Only StreamDiffusion has a better latency than our method, which we attribute to it making a different tradeoff between performance and quality. This is confirmed by the MSE , CLIP scores, warp error, as well as the user study results, that consistently indicate higher output quality for our method.

**Table 1: To compare our method to previous work, we averaged scores over 90 sequences from the DAVIS-2017 [] dataset. Our method scores highest in Depth MSE and second in terms of temporal smoothness. However, because FreeNoise is actually unable to produce output frames before having seen a number of future input frames, we had to give it an unfair advantage by having it consume *all* input frames before producing its first output frame, leading to extreme latency and explaining why it can achieve better temporal smoothness than all other methods. More details of the metrics in Section 4.1. Our user study win rates confirm that our method produces the best quality for both aspects (i.e. all win rates over 50%). Only StreamDiffusion, which puts more emphasis on speed than on output quality (see also Fig. 5) can beat our method in terms of latency.**
| Method | Structure Consistency | Temporal Smoothness | Latency |  |  |  |
| --- | --- | --- | --- | --- | --- | --- |
| Depth | Ours | CLIP | Warp | Ours |  |  |
| $\downarrow$ MSE $\downarrow$ | $\downarrow$ Win Rate $\uparrow$ | $\uparrow$ Score $\uparrow$ | $\downarrow$ Error $\downarrow$ | $\downarrow$ Win Rate $\uparrow$ |  |  |
| StreamDiffusion | 1.72 | 70.4% | 94.35 | 0.1994 | 79.1% | 0.03s ($\pm 0.01$) |
| Rerender | 5.50 | 86.7% | 95.05 | 0.1327 | 86.7% | 7.72s ($\pm 0.18$) |
| FreeNoise | 1.94 | 80.5% | 96.49 | 0.0809 | 80.5% | 58.67s ($\pm 0.08$) |
| Ours | 1.12 | - | 95.77 | 0.0967 | - | 0.06s ($\pm 0.02$) |

Figure: Figure 5: We compare the output quality of our method to a number of previous approaches: (a) shows temporally adjacent frames, while (b) shows frames temporally further apart. While our method preserves the spatial structure of the input well, producing the desired output styles, previous methods tend to change even the semantic content of the frames. See more discussions in Section 4.2
Refer to caption: x5.png

Figure: Figure 6: In this ablation study, model (a) was trained with an attention mask like in Fig. 1 (c). Models (b) and (c) were trained with the attention masks like in Fig. 1 (d), but in (b) we filled the warmup slots (see Fig. 4) with further close-by predecessor frames instead of initial frames of the stream. Only (d), our full method, uses the depth prior. The models mostly agree on Frame 1, but all ablated versions deviate from the spatial structure of the input for later frames. More analysis in Section 4.3.
Refer to caption: x6.png

### 4.3 Ablation Study

We include quality and quantity results of model with different setting in Fig. 6 and Table 2.
We employ a noise strength of 0.5 for more apparent comparison.
The model (a), which uses uni-directional attention (see Fig. 1 (c)) fails to be consistent with the input from the first frame.
Columns (b), (c) and (d) are trained with our uni-directional attention with warmup (red square of Fig. 1 (d)). But the model in (b) fills the warmup area with further predecessor frames instead of initial frames (see also Fig. 4).
This does improve the output for the first frame (as the predecessor frames happen to be initial), but leads to deviation from the spatial structure of the input in later frames.

**Table 2: Ablation study of the model design. Our full method (D) achieves the optimal in both structure consistency and temporal smoothness warp error. As is to be expected, training with warmup, but filling the warmup area with immediate predecessor frames at test time (B) makes quality worse, but using the warmup area correctly (C) does lead to slight improvements over no warmup at all. The depth prior leads to a strong improvement again (D).**
| Setting | Structure Consistency | Temporal Smoothness |  |  |  |  |
| --- | --- | --- | --- | --- | --- | --- |
|  | Train<br>with warmup | Inference<br>with warmup | Use<br>depth | Depth MSE $\downarrow$ | CLIP Score $\uparrow$ | Warp error $\downarrow$ |
| A | $\times$ | $\times$ | $\times$ | 2.29 | 95.43 | 0.0968 |
| B | ✓ | $\times$ | $\times$ | 2.39 | 95.28 | 0.1125 |
| C | ✓ | ✓ | $\times$ | 2.22 | 95.80 | 0.0966 |
| D | ✓ | ✓ | ✓ | 1.67 | 95.78 | 0.0768 |

In column (c) we do use the warmup area properly, but omit the depth prior.
The identity of the subject is now maintained better, but several details in the background, such as the highlighted table region are still inconsistent with the input.
Only our full method (column (d)) maintains consistency beyond initial frames.
Table 2 confirms these findings: Without the depth prior, configurations A, B and C fail to be structurally consistent with the input.
And with further predecessor frames instead of initial frames in the warmup area at inference time, configuration B does not achieve as much temporal consistency as the others. We also found that removing the warmup cache from configuration D will decrease the temporal smoothness CLIP score by $0.09$.
The depth prior seems to improve both structure consistency and temporal smoothness a lot, although the temporal CLIP score fails to show that in Table 2. We interpret this failure as a consequence of the content of subsequent frames being usually very similar, such that the CLIP embeddings can be similar despite certain abrupt changes, for example in the background, being present.

As reported in Table 3, omitting our $K{}V{}$-cache leads to our method having to re-compute the $K$ and $V$ maps of previous frames multiple times, which dramatically increases the per-frame latency to a degree that is not acceptable in streaming use cases.

**Table 3: Removing the $K{}V{}$-cache from our method drastically increases latency.**
| Method | Latency $\downarrow$ |
| --- | --- |
| wo $K{}V{}$-cache | 20.43 ($\pm 0.068$) |
| Ours | 0.06s ($\pm 0.002$) |

## 5 Conclusion

We have presented Live2Diff, a method to translate video streams to a desired target style at interactive framerates. Based on our novel unidirectional attention approach, that allows us to reduce computational cost by means of our $K{}V{}$-cache, we are able to not only meet the criterion of sufficient framerate, but also outperform previous approaches in terms of consistency with the input video and temporal smoothness. We have thus demonstrated that the unidirectional temporal attention mode, that is an important component of state of the art LLMs, can beneficially be used for the editing of videos as well.
A method like ours could be of great use in a number of video streaming use cases, such as in the recent trend of “Virtual YouTubers”, in which online content producers control stylized virtual avatars and interact with their audience in a live stream.

## Appendix A Appendix / Supplemental material

### A.1 Limitations & Societal impact

Although our method improves upon the state of the art, we sometimes observe flickering in background regions, especially when the camera is moving fast, which we hypothesize to be the result of imperfect depth estimation. Also, editing the video by applying Gaussian noise and then denoising it limits our method to translation tasks in which the output is structurally similar to the input, ruling out, for example, Pose-to-Person conditioning.

Like other editing works our method could in principle be misused to manipulate video data, which weakens the value of such data as a means of verifying that an event in question actually took place. Because of said limitation to structure-preserving transfers this danger is somewhat smaller than for other methods, but given the right kind of target style it could still be used for example to alter the identity of depicted persons.

### A.2 Implementation details of our inference pipeline

In this section, we provide the implementation of our temporal self-attention module with $K{}V{}$-cache. We also describe how we apply streaming inference.

$K{}V{}$-cache.
In model initialization, we pre-compute the shape of the $K{}V{}$-cache for each temporal self-attention module.
For temporal attention with max window size $L$, and input feature size $H\times W\times C$, for $T$ denoising steps, the shape of the $K{}V{}$-cache should be $(T,H\times W,L,C)$, see LABEL:lst:cachesize.

Figure: Listing 1: $K{}V{}$-cache sizing

Previous video diffusion models[, , ] apply absolute positional encoding $\mathtt{PE}$, which is added to the input features before the mapping layers $\mathtt{to_q},\mathtt{to_k},\mathtt{to_v}$, which can be formulated as

$$ $\displaystyle\mathtt{Q}$ $\displaystyle=\mathtt{to_q}(\mathtt{PE}+\mathtt{feat})$ $\displaystyle\mathtt{K}$ $\displaystyle=\mathtt{to_k}(\mathtt{PE}+\mathtt{feat})$ $\displaystyle\mathtt{V}$ $\displaystyle=\mathtt{to_v}(\mathtt{PE}+\mathtt{feat})$ $$

We thus cannot directly cache $\mathtt{K{},V{}}$ since they contain positional information.
Instead, we pre-compute $\mathtt{to_q}(\mathtt{PE}),\mathtt{to_k}(\mathtt{PE}),\mathtt{to_v}(\mathtt
{PE})$ (see LABEL:lst:pecomp), and cache only $\mathtt{to_k}(\mathtt{feat}),\mathtt{to_v}(\mathtt{feat})$.

Figure: Listing 2: We precompute $\mathtt{to_k}(\mathtt{PE}),\mathtt{to_v}(\mathtt{PE})$.

In the warmup stage, we use bi-directional attention over all warmup frames, and cache their $\mathtt{K/V}$, see LABEL:lst:warmup.

Figure: Listing 3: Warmup frames are processed with *bi*-directional attention.

During streaming inference we process up to $T$ samples with different noise levels at once.
For each frame we write to and read from the $K{}V{}$-cache corresponding to its noise level, and add the mapped positional information.
At the beginning of the stream, the length of context window is incrementally approaching the max window size $L$. We pass an attention mask to specify which token should take part in attention. For details see LABEL:lst:attention and LABEL:lst:streaming.

Figure: Listing 4: Our implementation of streaming inference uses the uni-directional attention approach, see Fig. 1 (d).

Figure: Listing 5: During inference we process $T$ frames simultaneously to make full use of GPU parallelization.

**Table 4: Community models used for evaluation. Each model captures a different target style.**
| Models | Trigger Words |
| --- | --- |
| Flat-2D Animerge (^1^11https://civitai.com/models/35960/flat2danimerge) | cartoon style |
| zaum (^2^22https://civitai.com/models/16048/or-disco-elysium-style-lora) | zaum, elysiumchar |
| vangogh (^3^33https://civitai.com/models/91/van-gogh-diffusion) | Starry Night by Van Gogh, lvngvncnt |

Figure: Figure 7: In our user study, the participant is given triplets of videos: The “Reference” is the input video, that videos $1$ and $2$ should be structurally consistent with, in addition to being temporally smooth. For each of these two aspects the user chooses which of the two videos fulfills this aspect best.
Refer to caption: extracted/5725411/figs/ui_only.png

### A.3 Evaluation

Models for evaluation. We use three Dreambooth and LoRA settings for evaluation, the model name and trigger words are shown in Table 4. For the evaluation, we use the trigger word as the prefix of our prompt.

User study.
Our user study involved 15 participants who collectively watched a total of 93 video clips.
The video clips were the same as those used in the quantitative evaluation.
Fig. 7 illustrates the user interface of our user study system:
Participants are shown the input video as reference, as well as an output from our method and an output from one random baseline method. They are asked to select the output with better temporal smoothness and structure consistency to the input. For each baseline method, we compute the win rate of our method as

$$ $\mathtt{ours_win_rate}=1-\frac{\mathtt{baseline_voted}}{\mathtt{baseline_ shown}}$ (3) $$

Data captioning.
We caption the DAVIS dataset with CogVLM[], which is a state-of-the-art visual language model.
For each video clip, we feed the middle frame together with the following prompt:

Figure: Figure 8: Our method translates an input video stream (black boundaries) into an output video stream (blue boundaries) that conforms to a desired target style. Each prompt is composed of the caption obtained for the input video (see Section A.3 followed by target style.
Refer to caption: extracted/5725411/figs/appl-blur.jpg

### A.4 Application

Fig. 8 shows another application of our method, demonstrating its potential in virtual-liver cases.
We transfer the input videos to different styles at 10 - 15 FPS on an NVIDIA RTX 4090.

## Peer Reviews

confidence: 3
contribution: 3
initial_rating: 6
presentation: 4
questions: - How does the model perform on videos with rapid scene changes or fast motion where early warmup frames might become less relevant?
- Are there justifications for using the depth MSE metric to measure structural consistency? The use of an off-the-shelf depth predictor can be an advantage.
soundness: 3
strengths: - The paper is well-motivated, addressing an important practical problem of live video stream translation.
- The proposed unidirectional attention mechanism is a natural solution inspired by successful LLM architectures.
- Clear explanation of the architecture and mechanisms.
- Multiple evaluation metrics and user study results including structural consistency and temporal smoothness.
summary: This paper introduces a novel approach to real-time video style transfer for streaming applications. The key innovation is adapting unidirectional attention mechanisms (similar to those used in Large Language Models) for video diffusion models, allowing frame-by-frame processing without requiring future frames. Additionally, they implemented warmup and KV-cache strategies.
weaknesses: **Limited Analysis of Dynamic Scenes**

- The paper lacks a comprehensive evaluation of videos containing rapid motion or frequent scene changes. The authors are recommended adding comparative experiments between the warmup approach and simple unidirectional attention for several scenarios: videos with fast camera movements, videos with quick scene transitions, and action sequences with rapid object motion. In addition, I'm concerned if the warmup window might become useless or perform worse than simple unidirectional attention when the content is no longer relevant to the first few frames.

**Depth Predictor Integration & Evaluation**

- The current depth Mean Square Error (MSE) metric creates an unfair comparison between methods. To address this limitation, I suggest adding structural similarity metrics between frames that are independent of depth, such as SSIM and LPIPS. Furthermore, evaluations should be conducted both with and without depth conditioning to ensure a more equitable comparison.

**Visual Quality Issues**
- Several visual artifacts are noticeable in the results presented in the supplementary material. I suggest including detailed analyses of these failure cases to better understand the method's limitations and potential areas for improvement.

---

confidence: 4
contribution: 2
initial_rating: 3
presentation: 1
questions: 1. how does your method work in other application scenarios? for example text to video generation
2. "We measure inference speed as the total amount of time it takes each method to process an input stream of 100 frames" --- but this is not the end to end latency at user side?
3. why is depth information so important?  what will happen if the depth is inaccurate?
4. in Figure 5, the results are in different styles, which may lead to unfair comparisons?
soundness: 3
strengths: the problem this paper is working on is important, as streaming and low-latent video processing and generation has broad applications. the approach proposed by this paper makes sense as pipelined processing and temporal relation modeling are both important for decent performance under tight latency constraints.
summary: this paper presents a comprehensive method for streaming video processing, leveraging on a unidirectional attention (with warmup frames and context window) of video frames and pipelined denoising (proposed in streamdiffusion) with kv caching.  for streaming video processing application, depth information is extracted and proved to be very important for good performance.
weaknesses: overall, the writing of this paper is not good (e.g. "Absolute position encoding (i.e., sinusoidal position encoding) to fin before computing Eq. (2), to give the layer access to the temporal position of each feature vector."), and what's more important, the proposed approach lacks technical novelty. 
1. the pipelined denoising is firstly proposed in streamdiffusion.
2. uni-directional attention and kv caching are both common in LLM community. the warmup design also lacks insightful analyses.
3. depth information extraction seems to be highly heuristic and specialized to the video to video application.

---

confidence: 3
contribution: 2
initial_rating: 5
presentation: 3
questions: 1.	Figure 3 and Figure 6 do not demonstrate strong initiatives in using depth priors. Since the baselines may not have depth priors, I am curious about the qualitative comparison between baselines, uni-directional attention with warmup, and uni-directional attention with warmup and depth.
2.	Could you provide the video results of Figure 3? It seems that the full model with Figure 3(f), i.e. full model with depth, has worse temporal consistency than Figure 3(e), i.e. full model without depth, specifically at the regions of human clothes and face. I expect serious jittering artifacts in Figure 3(f).
3.	Could you provide the comparison with more baselines, especially StreamV2V?
4.	It seems to me that all the generated results are very similar to the input videos, and the prompt must align with the input videos. Is it possible for Live2Diff to do other editing tasks besides style transfer, for example, changing the color of human clothes?
5. See weakness.
soundness: 2
strengths: 1.	The paper is well-written and easy-to-understand.
2.	The proposed method achieves high efficacy (16 FPS on single RTX4090) for streaming video translation.
3.	The ablation experiments are well-studied and demonstrate the necessity of each component in Live2Diff.
summary: The paper proposes Live2Diff, a video diffusion model that utilizes uni-directional temporal attention as well as additional warmup and depth information for streaming video translation. In specific, the uni-directional attention is conditioned on a sliding window of a few preceding frames, and the warmup contains attention from a small number of frames at the beginning of the video. To achieve real-time inference, Live2Diff uses three techniques: First, it replaces vanilla diffusion models with LCM-LoRA to reduce the number of denoising steps. Second, it uses a KV-cache during the implementation to avoid redundant computation. Third, it designs a pipelined denoising approach to accelerate model inference. In the experiments, the author(s) compare Live2Diff with three video translation methods, including StreamDiffusion, Rerender, and FreeNoise, and demonstrate that Live2Diff achieves higher CLIP scores and lower warp error while requiring lower latency.
weaknesses: 1.	I have some doubts about the novelty in this paper. In specific, just like the authors mentioned, several works have adopted an autoregressive way for long video generation, e.g. ART-V, SEINE, Gen-L-Video, Reuse and Diffuse. The idea of incorporating a small number of frames in the beginning is also not new [1]. The author(s) claim their major contributions of proposing uni-directional attention with warmup. However, it seems naive to me that the author(s) simply replace bidirectional attentions with uni-directional attentions because of the problem setting, where the target frame shall not have seen the later frames and can only use the information from preceding frames. Regarding warmup, it can be seen in Table 2 that warmup does not provide significant improvements. (Row A, B, and C have similar values.) Instead, the improvement comes from using additional depth priors instead of model architecture. 
2.	The selected baselines are somehow outdated. Similar work, such as StreamV2V (Open source, Arxiv, May 2024), that also targets real-time streaming video should be included for comparison. State-of-the-art video translation methods, like CoDeF and FlowVid, which may have better temporal consistency, editing performance, but lower throughput, should also be compared. In specific, StreamV2V lies in exactly the same scope as the paper, and they compare with both CoDeF and FlowVid, both of which outperform the selected baselines, i.e. Rerender and FreeNoise, with much better temporal consistency.
3.	The literature review is not complete enough. There are several missing methods for video processing. To my best knowledge, existing methods can mainly be classified into four categories: propagation-based, representation-based, canonical-based, and attention-based. These methods use different strategies to improve temporal consistency, like propagation across frames [2,3], video deformation [4,5], transferring video to canonical space [6,7], or using attention mechanisms. It is acceptable that the paper only focuses on attention-based methods, which is much closer to the scope, but there are still many missing approaches that use diffusion models for video generation/editing. Some of them are zero-shot methods that do not require model training, e.g. Controlvideo, Tokenflow, Control-A-Video,  VideoControlnet, Text2video-zero. Some of them further enhance temporal consistency with cross-attention, e.g. Tune-A-Video, Text2Video-Zero, FateZero, Vid2Vid-Zero. Some works propose training for video editing, e.g. Imagen Video, Make-A-Video. In short, I suggest the author(s) provide more comprehensive literature review in Section 2.
4.	The temporal consistency is bad in some examples demonstrated. (Comparison 1, 2, 3, 6) To my knowledge, this is because the backgrounds in these examples contain more 'high-frequency' details. In other words, they are more complicated, compared to other 'dancing human' videos in indoor scenes with simple background. Since the paper has incorporated the depth priors, is it possible to first differentiate the static (background) and dynamic objects (human subjects, for example) in the video, and then do a simple masking techniques to avoid temporal inconsistency in the static background?


[1] W Harvey et al., Flexible Diffusion Modeling of Long Videos, NeurIPS 2022.

[2] O Jamriška, Stylizing video by example. ACM TOG 2019.

[3] X Wang et al., Learning Correspondence From the Cycle-Consistency of Time, CVPR 2019.

[4] V Ye et al., Deformable Sprites for Unsupervised Video Decomposition, CVPR 2022.

[5] Y Kasten et al., Layered neural atlases for consistent video editing, ACM TOG 2021.

[6] H Ouyang et al., CoDeF: Content Deformation Fields for Temporally Consistent Video Processing, CVPR 2024

[7] T Chen et al., NaRCan: Natural Refined Canonical Image with Integration of Diffusion Prior for Video Editing, NeurIPS 2024.