EditText: Structure-Aware Generation and Selective Visual Transport for Fine-Grained Text Editing
Organizations: University of Science and Technology of China, Hefei, China · iFlytek, Hefei, China
Abstract
Fine-grained text editing aims to accurately replace text in a specified region while preserving the source text's font, color, and texture, as well as visual consistency in unedited regions. We present EditText, a unified framework for fine-grained text editing that combines target character generation with visual transport from the source image. The model uses dual-condition Fill inputs: a masked image and a source text style reference, both sharing a spatial reference with the target image. The masked image hides the original text and retains unedited content as a source canvas; the style reference supplies appearance cues that guide new character generation together with the target text. We introduce an Attention Transport framework in which Source Weight describes the attention allocated to a condition and the Spatial Aggregation Kernel describes its internal spatial attention distribution. Accurate transfer of source details depends on attention strength, the retention of details in condition features, and spatially accurate aggregation. For selected non-edit queries, we therefore preserve the total attention weight assigned to the masked image while redistributing its attention toward spatially corresponding neighborhoods, enabling selective visual transport. Multi-stage training, combined with a Glyph-aware Structural Loss on local target character structure, teaches the model to generate accurate text, preserve source text appearance, and retain unedited details. We also introduce TBench, a fine-grained text editing benchmark covering Alphabetic, Logographic, and Arabic numerals, to evaluate character updates, appearance preservation, and the preservation of unedited details. On TBench, EditText achieves state-of-the-art non-edit-region SSIM (0.9769) and full-image LPIPS (0.0460).
Figures & tables
| Text accuracy | Image preservation | Overall quality | |||
|---|---|---|---|---|---|
| Model | OCR | ED | SSIM | LPIPS | LLM |
| FireRed Image Edit | .7200 | .2824 | .8968 | .0765 | 4.005 |
| FireRed Image Edit (4-step) | .6970 | .3034 | .9432 | .0560 | 3.970 |
| Qwen-Image-Edit-2511 | .7121 | .3076 | .9392 | .0598 | 3.939 |
| Qwen-Image-Edit-2511 (8-step) | .6633 | .3447 | .9494 | .0520 | 3.874 |
| Qwen Image Edit Max | .6492 | .3598 | .9072 | .0869 | 3.806 |
| Model | Pass rate | Model | Pass rate |
|---|---|---|---|
| FireRed Image Edit | 45.50% | Seedream 4 | 36.22% |
| FireRed Image Edit (4-step) | 39.47% | Seedream 4.5 | 57.07% |
| Qwen-Image-Edit-2511 (8-step) | 44.22% | Seedream 5 Lite | 44.33% |
| Qwen Image Edit Max | 36.61% | Seedream 5 Pro | 64.21% |
| Qwen Image Edit Plus | 47.74% | Wan Image 2.6 | 43.72% |
| Qwen Image 2 | 34.36% | Nano Banana Pro | 75.00% |
| Configuration | OCR | ED | SSIM | LPIPS | LLM |
|---|---|---|---|---|---|
| Full method | .7000 | .2059 | .9786 | .0452 | 4.125 |
| w/o Stage 1 | .6600 | .2376 | .9789 | .0461 | 3.995 |
| w/o style reference | .6700 | .2500 | .9627 | .0364 | 3.560 |
| w/o glyph loss | .6950 | .2006 | .9753 | .0477 | 3.945 |
| w/o redistribution | .6800 | .2441 | .9231 | .0501 | 3.765 |
| Model | OCR | ED | SSIM | LPIPS | LLM |
|---|---|---|---|---|---|
| Stage 1 | .6650 | .2757 | .9634 | .0353 | 3.4600 |
Appendix figures & tables10 assets
Supplementary material from the paper’s appendix.
Appendix
| Item | Setting |
|---|---|
| Training examples | 500,000 |
| Updated modules | All DiT parameters, 20.4B |
| Epochs / repetitions per epoch | 5 / 1 |
| Training hardware | 4 nodes |
| Global batch size | 64 |
| Maximum training area | pixels |
| Item | Setting |
|---|---|
| Initialization | Stage 1 fine-tuned DiT |
| Training records | 21,061 |
| LoRA rank | 128 |
| Optimizer | bitsandbytes AdamW8bit |
| Learning rate / scheduler | / ConstantLR, no warmup |
| Epochs / repetitions per epoch | 5 / 2 |
| Item | Setting |
|---|---|
| Initialization | Stage 1 fine-tuned DiT |
| Updates | DiT task LoRA |
| Visual conditions | masked image , source text style reference |
| Text condition | Target string |
| Full-image supervision | Flow Matching target velocity |
| Structural supervision | Local structure of predicted clean latents and target latents |
| Item | Setting |
|---|---|
| Backbone | Qwen-Image-Edit-2511 |
| Fine-tuning | DiT LoRA, rank 128 |
| Training records | 21,061 |
| Maximum training area | 3,500,000 pixels |
| Learning rate / scheduler | / ConstantLR |
| Epochs / repetitions per epoch | 5 / 2 |
| Sample | ||||
|---|---|---|---|---|
| Sample 1 | 10.63 | 6.26 | -0.004 | -0.760 |
| Sample 2 | 10.37 | 5.91 | +0.035 | +0.210 |
| Sample 3 | 11.92 | 6.79 | -0.159 | +1.012 |
| Sample 4 | 13.31 | 6.07 | +1.508 | +1.405 |
| Metric | Difference | 95% interval |
|---|---|---|
| OCR | ||
| ED | ||
| Non-edit SSIM | ||
| Full-image LPIPS | ||
| LLM |
| Intervention contrast | Mean difference | 95% CI | Positive differences |
|---|---|---|---|
| Corresponding-key suppression random-key suppression | 90% | ||
| Condition shift of 1 token no shift | 0.01533 | All positive | |
| Condition shift of 2 tokens no shift | 0.01895 | All positive | |
| Condition shift of 4 tokens no shift | 0.02304 | All positive |