counterflow
CounterFlow: Target-Conditioned Flow Matching for Visual Counterfactuals
Sevellec, Paul, Fromont, Elisa, Gaudel, Romaric, Roze, Laurence, Viallard, Paul, Houeix, Laetitia
On the one hand, in generative modeling, diffusion models currently dominate the landscape for high-quality image, video, and audio synthesis (Rombach et al., 2022; Ho et al., 2022; Liu et al., 2023a). However, they are also well-known for their slow training times and their stochastic sampling paths. To address these limitations, Lipman et al. (2023); Albergo and Vanden-Eijnden (2023); Liu et al. (2023b) introduced Conditional Flow Matching (CFM). CFM is a generative modeling framework based on Continuous Normalizing Flows (CNFs) that uses standard regression objectives for training. Moreover, instead of relying on diffusion processes, CFM generates examples by integrating the CNF's ODE along deterministic trajectories. On the other hand, the generative models' ability to generate complex data distributions and thus to produce realistic examples is particularly appealing for eXplainable Artificial Intelligence (XAI, Dwivedi et al., 2023), where one aims to produce counterfactual explanations (Wachter et al., 2017), i.e., examples (i) close to a given input, (ii) plausible, and (iii) that change the model's prediction. Unlike adversarial examples that rely on imperceptible noise to fool the classifier, counterfactual examples expose meaningful changes, helping users to trust the model while enabling developers to debug it. Our work leverages CFM to create counterfactual explanations: rather than generating images from random noise, our approach transports an input sample toward a counterfactual conditioned on a user-defined target class, while jointly optimizing for plausibility and proximity; see Figure 1.
CounterFlow: A Two-Phase Inference-Time Sampling for Counterfactual Video Foley Generation
Lee, Gyubin, Lee, Junwon, Nam, Juhan
We investigate Counterfactual Video Foley Generation, which aims to adopt a sound-source identity that contradicts the visual evidence while remaining temporally synchronized to a silent video. Existing Video&Text-to-Audio (VT2A) models struggle with this, often remaining anchored to the visually implied sound source when video and text contents disagree. We present ConterFlow, an inference-time dual-phase sampling scheme for pretrained flow-matching VT2A models. Phase 1 builds a video-derived temporal structure while suppressing the visually implied source; Phase 2 drops video conditioning to focus entirely on shaping audio timbre toward the target prompt. ConterFlow substantially improves counterfactual Video Foley generation compared to naive negative prompting and state-of-the-art baselines. To evaluate replacement quality, we propose a metric leveraging a text-audio co-embedding space to measure both target-prompt evidence and residual visually implied source leakage. Video demonstrations and code are available at https://gyubin-lee.github.io/counterflow-demo/