arXiv:2608.30081cs.LGAug 2026

Manuscript Offprint

arXiv:2608.30081

Tracing Generated Samples to Training-Data Clusters in Flow-Matching Models

Rania Briq, Ohad Fried, Michael Kamp, Stefan Kesselheim

Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.

Rania Briq

Forschungszentrum Jülich Technical University Dortmund r.briq@fz-juelich.de

Ohad Fried

Reichman University

Michael Kamp

Technical University Dortmund Lamarr Institute Institute for AI in Medicine, University Hospital Essen

Stefan Kesselheim

Forschungszentrum Jülich Helmholtz AI University of Cologne

Abstract

Understanding which training samples influence a generated image is an important problem in generative modeling. In flow matching, training samples influence the generated image through the velocity field along the generation trajectory. Removing samples to examine their counterfactual influence changes the velocity field, and the resulting effect on the final image depends on how the change propagates through the trajectory. Consequently, local changes in the velocity field do not necessarily predict the final counterfactual effect.

This work investigates attribution in flow-matching models through a hybrid analytical–learned approach, and uses it to derive trajectory-based attribution scores at the cluster level. We evaluate these attribution scores using independently retrained leave-one-cluster-out (LOCO) models, and compare with several attribution baselines using two different flow-matching latent spaces. Our experiments show that semantic similarity constitutes a strong baseline, while the closed-form trajectory-based attribution is competitive in some metrics without requiring counterfactual retraining or model gradients.

Our results show that attribution in flow matching depends not only on semantic similarity to training samples, but also on the latent representation, trajectory dynamics, and how influence is propagated to the final output.

1 Introduction

Attribution is a central problem in generative modeling, that helps explain generated content and interpret model behavior. It also has societal implications since it can address copyright problems and help mitigate unwanted behavior. The question of attribution can be investigated in multiple ways, for example, determining which training samples resemble a generated output, or determining the counterfactual effect, i.e., answering how removing a set of samples would change the generated image. Here, we study training-data attribution in flow matching (FM) at the level of training-data clusters, by determining the counterfactual effect of removing clusters, and comparing with various baselines that are also based on semantic similarity. We evaluate the various approaches based on how well they predict the magnitude of the counterfactual change.

Flow matching generates samples by integrating a learned velocity field along a trajectory. Data removal affects not only the endpoint, but also the entire flow trajectory and its dynamics. For instance, a large local velocity perturbation does not necessarily imply a large change in the final

Preprint.

output, because the change also depends on how the perturbation is propagated to the endpoint, where changes can cancel out and it becomes computationally expensive to track them. The flow matching formulation has an analytical closed-form (CF) solution of the optimal velocity field [Gao and Li, 2024, Bertrand et al., 2025], which takes the form of a linear combination of contributions from each training sample where a weight factor describes the magnitude of each sample's contribution, therefore its structure provides an ideal way to study attribution and predict the counterfactual effect. The approach evaluates the contribution of clusters to the velocity field along the trained model's trajectory, making it an analytical and model-based hybrid approach. It can dynamically adapt to new clusters, while not requiring any retraining or finetuning.

Our study is partly motivated by the observation that latent flow-matching models are very stable under training-sample removal: only when a semantic group loses its support by dropping its corresponding cluster completely does the generated sample's identity change [Briq et al., 2026]. This indicates that individual samples may have weak influence in isolation, while a cluster has a more distinguishable effect. We accordingly partition the training data into clusters, and for each cluster train a flow-matching model while leaving that cluster out. These leave-one-cluster-out (LOCO) models are then used as counterfactual oracles for evaluating attribution scores.

Our experiments are conducted using two different flow-matching latent representations on the CelebA-HQ dataset [Karras et al., 2018]. The closed-form trajectory-based attribution reflects the whole trajectory and is FM-interpretable. Our observations reveal that attribution in flow matching is not explained by endpoint similarity or local velocity-field perturbations alone. Rather, attribution depends on whole-trajectory dynamics, the counterfactual metric involved (e.g. endpoint-latent deviation or velocity-field perturbation), and the flow-matching latent representation.

Existing methods for attribution include influence functions [Koh and Liang, 2017], which approximate the effect of removing certain training samples on the parameters. Other methods include gradient-based methods such as TracIn [Pruthi et al., 2020, Park et al., 2023]. These methods have also been adapted to diffusion models, including timestep-aware gradient attribution [Georgiev et al., 2023, Xie et al., 2024], influence-function formulations [Zheng et al., 2024, Mlodozieniec et al., 2025]. Related to our cluster-level setting, GUDA [Murata et al., 2026] studies group-level attribution through approximate counterfactual unlearning of the likelihood. Unlike FM-CF, adapting to new clusters requires retraining. Analogously to FM-CF, NDA [Zhao et al., 2026] derives nonparametric patch-level attribution using the analytical optimum of the diffusion objective. In contrast to FM-CF, it is completely model-free and therefore cannot distinguish between the various trained models and their dynamics or training stochasticity.

To summarize, our contributions are as follows. (i) We introduce cluster-level training-data attribution in flow-matching models and propose a cluster-level attribution setting defined by leave-one-cluster-out (LOCO) models. (ii) We derive an attribution approach that combines the analytical FM closed-form solution with the trained model trajectory. (iii) We evaluate against existing attribution baselines such as gradient-based approaches and semantic similarity. An overview of the approach is illustrated in Fig. 1.