Source-linked AI summary

FLUX.1 Kontext: Flow Matching for In-Context Image Generation and Editing in Latent Space

Black Forest Labs, Stephen Batifol, Andreas Blattmann, Frederic Boesel, Saksham Consul, Cyril Diagne, Tim Dockhorn, Jack English, Zion English, Patrick Esser, Sumith Kulal, Kyle Lacey, Yam Levi, Cheng Li, Dominik Lorenz, Jonas Müller, Dustin Podell, Robin Rombach, Harry Saini, Axel Sauer, Luke Smith

arXiv:2506.15742v2cs.GR

TL;DR

FLUX.1 Kontext addresses the need for faithful, intuitive image editing and limited real-world benchmarks by unifying image generation and editing through flow matching. It delivers state-of-the-art quality and character consistency, faster inference, and a 1,026-pair benchmark for in-context tasks, while excessive multi-turn editing can introduce artifacts.

  • Problem

    Users need intuitive, faithful image editing, while existing benchmarks incompletely capture real-world multimodal usage.

  • Method

    FLUX.1 Kontext is a flow matching model that concatenates context and instruction tokens to support image-driven editing and generation from scratch in one framework.

  • Results

    FLUX.1 Kontext achieves state-of-the-art editing and character consistency, with the fastest latency and up to an order-of-magnitude speed advantage over related models.

  • Takeaways & Limitations

    Fast inference and robust consistency support interactive, multi-turn creative workflows, while KontextBench broadens evaluation across real-world in-context tasks.

  • Takeaways & Limitations

    Excessive multi-turn editing can introduce visual artifacts, and the model may ignore specific prompt requirements.

Abstract

from arXiv · show

We present evaluation results for FLUX.1 Kontext, a generative flow matching model that unifies image generation and editing. The model generates novel output views by incorporating semantic context from text and image inputs. Using a simple sequence concatenation approach, FLUX.1 Kontext handles both local editing and generative in-context tasks within a single unified architecture. Compared to current editing models that exhibit degradation in character consistency and stability across multiple turns, we observe that FLUX.1 Kontext improved preservation of objects and characters, leading to greater robustness in iterative workflows. The model achieves competitive performance with current state-of-the-art systems while delivering significantly faster generation times, enabling interactive applications and rapid prototyping workflows. To validate these improvements, we introduce KontextBench, a comprehensive benchmark with 1026 image-prompt pairs covering five task categories: local editing, global editing, character reference, style reference and text editing. Detailed evaluations show the superior performance of FLUX.1 Kontext in terms of both single-turn quality and multi-turn consistency, setting new standards for unified image processing models.

1 Introduction

FLUX.1 Kontext addresses the need for faithful, natural-language image editing by unifying local editing and generative in-context processing. It emphasizes character preservation across iterative edits, interactive speed, and workflows that support successive refinement.

  • Capabilities: The model supports local editing that changes selected content while preserving surrounding context, and generative editing that reproduces visual concepts in new environments.Generative editing adapts outputs to conditioning context without parameter updates or LoRA training.
  • Iterative applications: The framework supports iterative generation and instruction-driven editing, enabling applications such as storyboard creation and narrative refinement.Reference images can remain consistent while successive edits alter occlusions, location, and weather.
  • Shortcomings of recent approaches: Current image-editing approaches struggle with realistic edit variety, preserving characters and objects across multiple edits, and interactive runtime.Synthetic instruction pairs can limit edit variety and realism, while autoregressive multimodal editors may be too slow for interactive use.
  • Our Solution: FLUX.1 Kontext is a flow-based model designed to match or exceed state-of-the-art black-box quality while addressing these limitations.It uses a velocity-prediction target over concatenated context and instruction tokens.
  • Key offerings: FLUX.1 Kontext preserves characters across multiple iterative edit turns and synthesizes 1024 × 1024 images in 3–5 seconds for text-to-image and image-to-image applications.Fast inference and robust consistency support successive edits with minimal visual drift.

2 FLUX.1

FLUX.1 is a latent-space rectified flow transformer that combines image and text tokens through double-stream and single-stream processing. Its architecture uses fused feed-forward blocks and factorized 3D positional embeddings to improve computational efficiency and represent spatial-temporal coordinates.

  • Architecture: FLUX.1 is a rectified flow transformer trained in the latent space of an image autoencoder.The model uses 16 latent channels and decodes image tokens after processing image and text sequences.
  • Architecture: Double-stream blocks process image and text tokens with separate weights before attention mixes their concatenated representations.The sequences are subsequently concatenated for single-stream processing.
  • Architecture: FLUX.1 applies 38 single-stream blocks to jointly processed image and text tokens, then discards text tokens and decodes the image tokens.This defines the final image-generation path after multimodal token interaction.
  • Efficiency: Fused feed-forward blocks reduce modulation parameters by a factor of 2 and combine attention linear layers with the MLP for more efficient training and inference.The fusion produces larger matrix-vector multiplications and improves GPU utilization.
  • Positional encoding: Factorized 3D Rotary Positional Embeddings index every latent token by space-time coordinates (t, h, w).For single-image inputs, t ≡ 0.

3 FLUX.1 Kontext

FLUX.1 Kontext models image generation and editing jointly by conditioning on text and optional context images. Its architecture uses concatenated latent-token sequences and rectified-flow training, with implementation choices targeting efficient inference and editing workflows.

  • Conditional formulation: FLUX.1 Kontext approximates pθ(x | y, c), where x is the target image, y is an optional context image, and c is a natural-language instruction.The same network handles in-context and local edits when y ≠ ∅ and free text-to-image generation when y = ∅.
  • Token sequence construction: Context image tokens are appended to target image tokens and processed as one visual-stream sequence.Sequence concatenation supports different input/output resolutions and aspect ratios and can extend to multiple context images.
  • Positional encoding: 3D RoPE assigns target tokens time coordinate 0 and context tokens distinct offset coordinates, separating context and target blocks while preserving spatial structure.For multiple context images, the context offset varies by image index.
  • Training objective: The model is trained with a rectified flow-matching loss using a velocity prediction target on concatenated context and instruction tokens.The latent follows z_t = (1 − t)x + tε, with ε sampled from a standard normal distribution.
  • Implementation details: FLUX.1 Kontext [dev] is obtained through guidance distillation into a 12B diffusion transformer, while [pro] uses the flow objective followed by LADD.The [dev] variant focuses exclusively on image-to-image training for edit performance, whereas the [pro] training setup includes image-to-image and text-to-image tasks.
  • Efficiency: Fused feed-forward blocks, Flash Attention 3, selective activation checkpointing, and regional compilation are used to improve training or inference efficiency.Fused blocks reduce feed-forward modulation parameters by a factor of 2 and combine attention linear layers with the MLP.

4 Evaluations & Applications

FLUX.1 Kontext is evaluated on crowd-sourced real-world editing tasks, text-to-image dimensions, latency, and iterative workflows. It performs competitively across tasks while offering fast generation and stronger consistency across successive edits.

  • KontextBench: KontextBench contains 1,026 image-prompt pairs from 108 base images spanning five real-world tasks.The tasks are local editing, global editing, text editing, style reference, and character reference.
  • Image-to-image evaluation: FLUX.1 Kontext [max] and [pro] perform best for local editing, text editing, and general character reference in human evaluations.For global editing and style reference, the models rank second to gpt-image-1 and Gen-4 References, respectively.
  • Efficiency: FLUX.1 Kontext outperforms competing models by up to an order of magnitude in image-editing speed.The evaluation reports the fastest latency among compared APIs.
  • Text-to-image evaluation: FLUX.1 Kontext shows balanced text-to-image performance across prompt following, aesthetics, realism, typography, and inference speed.Performance improves across categories over FLUX1.1 [pro], with further gains from [pro] to [max].
  • Iterative workflows: Successive edits with FLUX.1 Kontext show slower character-identity drift than competing models.The comparison uses AuraFace embedding cosine similarity across edit sequences.
  • Applications: The model supports iterative object and facial-expression edits while preserving specified visual properties such as patterns, lighting, composition, clothing, and background.The examples include changing a vase color after generating it and reorienting a subject before changing her expression.

5 Discussion

FLUX.1 Kontext unifies in-context image generation and editing through sequence concatenation, with evaluations indicating competitive quality, consistency, and speed. Its current implementation remains limited by artifacts, instruction-following failures, and degradation during excessive multi-turn editing.

  • Discussion: FLUX.1 Kontext combines in-context image generation and editing within one flow-matching framework.The framework uses simple sequence concatenation and training recipes.
  • Discussion: Evaluations find FLUX.1 Kontext comparable to proprietary systems while enabling fast, multi-turn creative workflows.The discussion highlights unified processing, character consistency across iterations, and interactive speed.
  • Limitations: Excessive multi-turn editing can introduce artifacts that degrade image quality.The model may also ignore specific prompt requirements, and distillation can affect output fidelity.
  • Future work: Future work includes multiple image inputs, further scaling, lower inference latency, video-domain editing, and reduced multi-turn degradation.The stated goal is to support more fluid content creation and real-time applications.

A.1 Primer on Rectified Flow Matching

The primer constructs forward noising processes in an image autoencoder’s latent space and trains models with conditional flow matching. Rectified flow uses linear coefficients, while timesteps are sampled from a Logit-Normal Distribution.

  • Forward noising operates in the latent space of an image autoencoder, combining data latents with Gaussian noise.
  • The coefficients a_t and b_t define the process’s log signal-to-noise ratio.
  • Models are trained using the conditional flow matching loss.
  • For rectified flow models, a_t = 1 − t and b_t = t.
  • Timesteps are sampled from a Logit-Normal Distribution whose logit transform is Gaussian.

A.2 Expressing shifting of the timestep schedule via the Logit-Normal Distribution

The timestep-schedule shift used in high-resolution synthesis can be represented through the parameters of a Logit-Normal Distribution. With σ = 1.0 and μ = log α, this formulation recovers the previously proposed timestep redistribution.

  • Prior high-resolution synthesis work introduced timestep-sampling shifts, with α = 3.0 reported as best when increasing resolution from 256^2 to 1024^2.
  • For a rectified-flow process with μ = 0 and σ = 1, the log-SNR is characterized by logit(t) ∼ N(0, 1).
  • μ = log 3.0 = 1.0986 and σ = 1.0 correspond to a shift of α = 3.0.
  • The shifted log-SNR can be expressed as a function of shifted timesteps t′, which are obtained by solving the corresponding relation.
  • For σ = 1.0 and μ = log α, the generalized shifting formula recovers the timestep redistribution t′ = αt / [1 + (α − 1)t].

B VAE Evaluation Details

The VAE is evaluated against related models using three reconstruction metrics on 4,096 ImageNet images at 256 × 256 resolution.

  • The VAE comparison uses SSIM, PSNR, and VGG-feature Perceptual Distance.
  • Metrics are computed over 4,096 random ImageNet evaluation images at 256 × 256 resolution.
  • Section 2 reports the mean and standard deviation across the 4,096 inputs.
Loading 2506.15742v2…