Skip to main content
Back

Tencent's WeEdit Fixes AI's Broken Text Editing With 330K Multilingual Training Pairs

A Tencent-Fudan team tackles text-inside-images editing with glyph-guided fine-tuning, multi-objective RL, and a 330K-pair HTML dataset across 15 languages.

Pro

  • WeEdit tackles text-in-image editing with a data pipeline, two-stage training, and multilingual benchmark from Tencent and Fudan.
  • HTML-based synthesis produces 330K pixel-perfect training pairs across 7 operations and 15 languages, plus an unstructured edit-verify loop.
  • Glyph-guided SFT renders target text as spatial prior, letting the MM-DiT model condition on explicit character placement.
  • Multi-objective RL uses four separate VLM-judged rewards: instruction adherence, text clarity, background preservation, relative quality.
  • Beats all open-source models on bilingual and 15-language benchmarks, second only to Gemini-3-Pro-Image (Nano Banana Pro).
  • Weak on reasoning-based edits requiring world knowledge to deduce target text; project at huizhang0812.github.io/WeEdit.

Ask most image editing models to swap the headline in a poster, translate a menu, or rearrange text on a street sign, and you'll typically get back blurry glyphs, hallucinated characters, or a background that mysteriously changes color. A new paper from Tencent's WeChat AI group and Fudan University argues this isn't just a rendering bug, it's a systemic gap in training data, algorithms, and evaluation. Their answer is WeEdit, a full stack for text-centric image editing that combines a synthetic data pipeline, a two-stage training recipe, and a multilingual benchmark.

WeEdit benchmark comparison and editing operation examples

Why text editing breaks general image models

Instruction-based image editing has matured quickly for object manipulation and style transfer, but text-centric editing, which involves modifying, translating, or rearranging textual elements embedded within images, remains largely underexplored. The authors point to three concrete gaps: conventional editing methods lack training paradigms designed for text content modification, there are no large-scale multilingual datasets curated for diverse text-centric operations, and no standardized benchmark exists for systematic comparison.

The failure modes are severe. On the bilingual benchmark introduced in the paper, the best open-source baseline achieves only 4.16 overall instruction adherence, and on Rearrange and Translate tasks all open-source baselines score below 1.8, indicating near-complete failure. Even proprietary systems degrade sharply on non-Latin scripts like Arabic, Thai, and Hindi.

Building 330K training pairs from HTML

The data pipeline is the most transferable idea in the paper. Rather than hand-labeling edits, the authors split source images into two categories and process each differently.

Structured and unstructured data construction pipelines

For screenshots, slides, documents, and infographics, a structured HTML pipeline does the heavy lifting:

  1. A VLM converts the original image into an HTML representation using Tailwind CSS.
  2. BeautifulSoup parses the HTML into a JSON record of text and image elements.
  3. A lightweight VLM (Qwen3-30B-A3B) generates edited text for each operation type.
  4. Edited text is substituted back into the HTML at the exact same positions.
  5. Both source and target HTML are rendered via Playwright, and because the rendering is deterministic and the two HTMLs differ only in target text, the resulting images are pixel-perfect identical in all non-target regions.

That pixel-perfect guarantee matters. It means the model never gets punished for background drift that isn't really there, and the ground truth for non-edited regions is exact rather than approximate. Multilingual coverage comes almost for free: translate the HTML first, then run the same pipeline.

For street signs, packaging, and posters where HTML reconstruction can't capture typography, an unstructured pipeline uses an edit-verify-and-retry loop. A VLM proposes edits, a generative model executes them, and a separate verifier checks instruction adherence, legibility, and background preservation, feeding failures back for retry.

The final dataset spans 330K samples, roughly 160K unstructured and 170K structured pairs, covering 7 operation types and 15 languages: Add, Replace, Delete, Rearrange, Translate, Change Style, and Combined. Translation and replacement together dominate at over 60% of the data.

Glyph images as spatial priors

The training recipe starts with glyph-guided supervised fine-tuning on top of Qwen-Image-Edit-2509 using LoRA with rank 256. The trick: before running the diffusion model, a VLM predicts where the target text should go and what it should say.

Glyph-guided SFT architecture with VLM prediction and MMDiT block

Specifically, Qwen3-VL-235B performs a two-step detect-and-plan procedure: it identifies text regions with bounding boxes and content, then interprets the editing instruction to determine target text content and spatial placement. A glyph image is then rendered as white text on a black background using PIL and Arial, matching the source image dimensions. This glyph image gets encoded through the VAE and concatenated with the noisy latent, giving the diffusion model an explicit spatial map of where characters should land.

Reinforcement learning with four separate rewards

Pixel losses can't tell you whether text is actually legible, so the second stage applies RL using DiffusionNFT as the policy optimizer. Instead of one holistic quality score, WeEdit decomposes reward into four dimensions, each judged by Qwen3-VL-235B:

  • Instruction Adherence: did the correct edit happen at the right location?
  • Text Clarity: are characters crisp, correctly spelled, free of stroke distortion?
  • Background Preservation: are non-target regions untouched?
  • Relative Quality: how does the edit compare against a ground-truth or leading-model reference?

To avoid the sparsity of integer scores, the reward uses logit-weighted continuous scoring: the VLM is prompted to rate on a 0-9 scale, and the reward is computed as the softmax-weighted expected score over the token logits. This captures the model's full confidence distribution rather than collapsing to a single integer.

Results and where it still struggles

On the bilingual benchmark, WeEdit-RL hits 7.47/8.19/9.01 on instruction adherence, text clarity, and background preservation, improving over the Qwen-Image-Edit-2509 base model by +3.98/+2.35/+2.21. It surpasses every open-source model tested and lands second only to Gemini-3-Pro-Image (Nano Banana Pro) among all systems. On the 15-language multilingual benchmark, it scores 6.70/7.10/8.49 overall, showing the HTML pipeline's multilingual coverage translates into real generalization on non-Latin scripts.

The weak spot is reasoning-based editing. On the Reasoning task, which requires deducing the target text from world knowledge before editing (like replacing "2024 NBA Champions" with the correct 2024 Super Bowl champion), WeEdit-RL scores only 2.57 on instruction adherence versus 4.91 for Gemini-3-Pro-Image. This makes sense: the training data doesn't include factual-reasoning edits, so the model can execute placement well but can't infer what to write.

What is actually useful here

If you're building UI localization tools, poster editors, document translation pipelines, or infographic updaters, the practical takeaways are:

  • The HTML-render-edit-render trick is a broadly reusable way to generate pixel-perfect editing supervision without human labeling.
  • Rendered glyph images as spatial priors work well as a condition for MM-DiT style editors, but only when the base model is trained to use them (dropping glyphs on an untrained model gave near-zero gains).
  • Splitting reward into task-specific dimensions and using logit-weighted continuous scores beats a single holistic score.

Code and weights aren't posted in the paper itself, but the authors maintain a project page where releases would appear. The full paper includes qualitative comparisons against Gemini-3-Pro-Image, GPT-Image-1.5, FLUX.2-dev, Qwen-Image-Edit-2509, and others across all eight operation types.