Contextual Flow Matching for High-quality Visual Content Generation
Abstract
Visual generation requires learning spatial relationships at multiple granularities, from coherent regional structure to local variation. Velocity predictions trained with standard Flow Matching contain errors at all spatial frequencies, but its pointwise objective does not explicitly organize these relationships into distinct learning tasks. We propose Contextual Flow Matching (CtxFM), which organizes the existing velocity target across spatial granularity and network depth. Aggregate supervision gives intermediate predictions a regional task, while Differential supervision guides local changes at the final output. Together with standard FM, they form a jointly trained coarse-to-fine hierarchy without an external teacher or changes to sampling. Our analysis explains how spatial operators shape the residual metric. On ImageNet 256 × 256, our CtxFM improves SiT-XL/2 from the published 17.20 FID reference to 12.04 at 80 epochs, and reaches 7.97 at 300 epochs versus 8.26 for the 1,400-epoch reference. Component studies examine task content and placement, and improvements extend to LightningDiT and pixel-space JiT. These results highlight the value of organizing an existing generative target into complementary spatial tasks across depth.