Source-linked AI summary
LEGION: Learning to Ground and Explain for Synthetic Image Detection
Hengrui Kang, Siwei Wen, Zichen Wen, Junyan Ye, Weijia Li, Peilin Feng, Baichuan Zhou, Bin Wang, Dahua Lin, Linfeng Zhang, Conghui He
TL;DR
Synthetic-image detection lacks fine-grained interpretability and faces outdated datasets and limited artifact annotations. The paper introduces SynthScars and LEGION, an MLLM framework that detects, localizes, and explains artifacts while guiding image refinement. Experiments report superior performance across benchmarks and show potential for more realistic generation and inpainting, although fully synthetic artifacts remain diverse and leave room for improvement.
Problem
Synthetic-image detection datasets and methods lack realistic coverage, fine-grained annotations, and artifact-level textual interpretability.
Method
SynthScars and LEGION combine high-quality annotated data with MLLM-based artifact detection, localization, explanation, and guided regeneration or inpainting.
Results
LEGION achieves superior performance and strong robustness across multiple benchmarks and evaluation metrics.
Takeaways & Limitations
LEGION’s feedback shows potential for progressively refining artifacts during image generation and inpainting.
Takeaways & Limitations
The diversity and flexibility of fully synthetic artifacts leave room for further improvement.
Abstract
from arXiv · showhide
The rapid advancements in generative technology have emerged as a double-edged sword. While offering powerful tools that enhance convenience, they also pose significant social concerns. As defenders, current synthetic image detection methods often lack artifact-level textual interpretability and are overly focused on image manipulation detection, and current datasets usually suffer from outdated generators and a lack of fine-grained annotations. In this paper, we introduce SynthScars, a high-quality and diverse dataset consisting of 12,236 fully synthetic images with human-expert annotations. It features 4 distinct image content types, 3 categories of artifacts, and fine-grained annotations covering pixel-level segmentation, detailed textual explanations, and artifact category labels. Furthermore, we propose LEGION (LEarning to Ground and explain for Synthetic Image detectiON), a multimodal large language model (MLLM)-based image forgery analysis framework that integrates artifact detection, segmentation, and explanation. Building upon this capability, we further explore LEGION as a controller, integrating it into image refinement pipelines to guide the generation of higher-quality and more realistic images. Extensive experiments show that LEGION outperforms existing methods across multiple benchmarks, particularly surpassing the second-best traditional expert on SynthScars by 3.31% in mIoU and 7.75% in F1 score. Moreover, the refined images generated under its guidance exhibit stronger alignment with human preferences. The code, model, and dataset will be released.
1. Introduction
LEGION addresses limitations in synthetic-image datasets and detection by combining fine-grained artifact analysis with explanatory outputs, then using those outputs to guide image refinement.
- Challenges: Existing datasets rely on outdated, low-quality, or narrow-domain synthetic images, weakening detection of realistic synthetic content.Point annotations also have low positional accuracy, while tampering-oriented contours are less generalizable to localized synthetic artifacts.
- Challenges: Traditional detectors struggle with globally reasoned artifacts and generally lack artifact-level textual interpretability.Examples include violations of physical laws governing lighting and shadows, which low-level structural cues may miss.
- Contributions: SynthScars provides high-quality synthetic images with irregular-polygon artifact masks, classifications, and detailed explanations.The annotations jointly represent artifact locations and their meanings.
- Contributions: LEGION is an MLLM-based framework for artifact localization, explanation generation, and forgery detection, with reported generalization and robustness.The framework uses MLLM prior knowledge, reasoning, and expression capabilities for fully synthetic image analysis.
- Contributions: LEGION also acts as a Controller, using artifact explanations, masks, and region-wise feedback to iteratively refine generated images through regeneration and inpainting.Regeneration refines prompts, while inpainting selectively refines anomalous regions.
2. Related Work
Prior work spans binary detection, artifact localization, MLLM-based interpretation, and conditional refinement, but remains limited in fully synthetic-image analysis and explanation-guided editing.
- Synthetic Image Detection: CNN- and transformer-based detectors often generalize poorly across generators and perturbations and do not produce explanations for anomaly causes.These methods typically frame synthetic-image detection as binary classification using spatial or frequency features.
- Artifact Localization: Artifact-localization methods use gradients, attention maps, or segmentation masks, but often target inpainting or human manipulation rather than AI-generated traces.Fully synthetic artifacts can involve inconsistencies in content, structure, style, and other intrinsic features.
- MLLM-Based Analysis: MLLM benchmarks show potential for interpretable and context-aware synthetic-image detection, while existing systems remain restricted by domain or task coverage.FFAA is limited to facial data and lacks localization, whereas Fakeshield lacks full-synthetic analysis.
- Image Refinement: Conditional generation methods support text-guided regeneration and mask- or edge-conditioned refinement for targeted image editing.ControlNet exemplifies multimodal conditional inputs for more controllable refinement.
- Image Refinement: PAL4Inpaint and PAL4VST use masks for anomalous-region revision but lack textual explanations and may resort to object removal that fails to preserve semantics.LEGION extends this direction by integrating image forgery analysis into the pipeline.
3. SynthScars Dataset
SynthScars is constructed to address outdated content, domain mismatch, imprecise annotations, and contour dependence in existing synthetic-image datasets.
- Dataset Motivation: Existing benchmarks use early GAN outputs that are low-fidelity and easily distinguishable from modern photorealistic generations.The cited comparison includes modern generators such as Stable Diffusion 3.51 and FLUX2.
- Dataset Motivation: Prior datasets exhibit domain mismatch, sparse annotations, and dependence on object contours that do not fit diverse synthetic artifacts.These issues reduce relevance to natural photographic content and subtle or complex manipulations.
- Dataset Construction: SynthScars is built through curation and quality control over samples aggregated from multiple public datasets.The construction pipeline includes source sampling by clustering latent representations from a pretrained ResNet-50.
- Dataset Statistics: SynthScars combines pixel-level masks, textual explanations, and artifact-type labels for every sample, with 100% valid annotations.The dataset is presented as a benchmark for synthetic-image analysis.
4. Method
LEGION is a multimodal, multi-task framework for synthetic-image forgery analysis, combining detection, artifact localization, and explanation generation. It also controls two training-free refinement pipelines that regenerate images or selectively inpaint detected artifact regions.
- LEGION Architecture: LEGION combines a global image encoder, LLM, grounding image encoder, and pixel decoder for multimodal forgery analysis.The framework supports deepfake detection, artifact localization, and explanation generation.
- LEGION Architecture: A CLIP global encoder supplies visual features, while an MLP classifier uses the CLS token to predict real-versus-fake probabilities.The detection task is formulated as binary classification.
- LEGION Architecture: The LLM converts projected image features and a forgery-analysis prompt into textual artifact explanations.A vision-to-language projection layer replaces the image token before generation.
- LEGION Architecture: A specialized <SEG> token links artifact-location descriptions to the pixel decoder, which produces binary pixel-level masks.The language-to-prompt projection transforms <SEG>-related embeddings into the decoder’s feature space.
- Training: LEGION is trained in two independent stages: localization and explanation first, followed by forgery detection classification.The first stage uses segmentation and explanation losses, while the second uses classification cross-entropy.
- Image Refinement Pipeline: Two training-free refinement pipelines use LEGION as a controller: regeneration revises prompts iteratively, while inpainting selectively refines artifact regions.Inpainting uses region-wise location, mask, and explanation feedback and better preserves non-artifact regions than full regeneration.
5. Experiments
Experiments evaluate LEGION for artifact localization, explanation generation, cross-generator detection, and guided image refinement. LEGION generally achieves strong benchmark performance, while its feedback supports iterative regeneration and inpainting.
- 5.2. Localization Evaluation: LEGION achieves state-of-the-art artifact localization across SynthScars, LOKI, and RichHF-18K, although its RichHF-18K F1 is slightly below LISA-v1-7B and TruFor.Compared with traditional experts, it exceeds PAL4VST by 10.65 points in F1 for the Object category on SynthScars.
- 5.2. Localization Evaluation: 10.65 points: LEGION surpasses PAL4VST in Object-category F1 on SynthScars.
- 5.3. Explanation Performance: LEGION outperforms comparison multimodal models on artifact explanation generation across SynthScars and LOKI.ROUGE-L measures surface-level structural alignment, while CSS measures semantic equivalence; both are normalized for comparison in Table 3.
- 5.4. Detection Performance: On UniversalFakeDetect, LEGION achieves the highest accuracy for GANs, CRN, and IMLE, with second-place accuracy on SITD and comparable performance on other generators.The model is trained on ProGAN before cross-generator evaluation.
- Image Refinement: LEGION-guided refinement uses explanations for iterative regeneration and masks plus explanations for region-level inpainting.The regeneration pipeline performs two optimization rounds, while the inpainting pipeline performs three iterations using SDXL.
6. Conclusion
The conclusion presents SynthScars and LEGION as a response to the difficulty of analyzing diverse, globally structured synthetic artifacts. It reports strong robustness and potential for using artifact analysis to guide image generation and inpainting, while acknowledging room for improvement.
- 6. Conclusion: SynthScars contains diverse, high-difficulty artifact instances that are not constrained by local contours and require global understanding.
- 6. Conclusion: LEGION is an MLLM-based framework designed to improve interpretability in fine-grained synthetic image forgery analysis.
- 6. Conclusion: Experiments report superior performance and strong robustness across multiple benchmarks and evaluation metrics.
- 6. Conclusion: LEGION shows strong potential as a controller for guided image generation and inpainting from qualitative and quantitative perspectives.
- 6. Conclusion: The diversity and flexibility of fully synthetic artifacts leave room for further improvement in the dataset and method.
A.3. Data Curation
Data curation filters SynthScars toward high-quality, deceptive, and challenging synthetic images while organizing content and artifacts for fine-grained analysis.
- A.3. Data Curation: A multistage Qwen2-VL-72B-Instruct filtering process removes blurred, compressed, non-photorealistic, and conspicuously synthetic samples.
- A.3. Data Curation: SynthScars covers diverse real-world scenarios and records 26,566 artifact instances across three fine-grained anomaly types.
A.4. Dataset Statistics
SynthScars contains 12,236 fully synthesized images spanning four content categories, with polygon-based annotations for 26,566 artifacts across three anomaly types.
- A.4. Dataset Statistics: 12,236 fully synthesized images are divided into human, object, animal, and scene categories, with 11,236 training and 1,000 test samples.
- A.4. Dataset Statistics: 26,566 artifact instances use irregular polygon masks and are categorized as physics-related, distortion, or structural anomalies.The reported proportions are 6% physics-related, 5% distortion, and 89% structural anomalies.
B. Experimental Details
The experimental design defines three artifact categories and incorporates diverse artifact knowledge into prompting. LEGION also uses semantic text embeddings to represent model outputs.
- Prompt Design: LEGION’s prompt incorporates a Diverse Artifact Prior to guide examination from multiple artifact perspectives.The prior consists of common cases from the three defined artifact types.
- Artifact Definitions: The artifact taxonomy comprises Physics, Structure, and Distortion artifacts.Physics artifacts include physical-law, optical-display, and perspective errors; Structure artifacts include deformation and asymmetry; Distortion artifacts include color, texture, and material errors.
- Text Embedding: The framework transforms outputs into semantic feature space using paraphrase-MiniLM-L6-v2 as its text embedding model.This follows the embedding choice used by Fakeshield.
C. Robustness Study
The robustness study compares LEGION with PAL4VST under JPEG compression, Gaussian noise, and Gaussian blur. LEGION remains stable as interference intensity increases, whereas PAL4VST degrades sharply.
- Robustness Under Perturbations: LEGION remains stable under increasing distortion intensity, while PAL4VST degrades sharply.The comparison covers severe JPEG compression, Gaussian noise, and Gaussian blur on SynthScars.
- Perturbation Effects: Gaussian noise causes the most severe performance degradation, followed by Gaussian blur, while JPEG compression has the least negative effect.These effects are reported for artifact localization on SynthScars.
- Comparison Setup: The study compares LEGION with PAL4VST, identified as the strongest expert model from Table 2.The comparison evaluates artifact localization performance under three distortion types.
E. Limitations and Analysis
The analysis reports strong qualitative artifact localization and explanations, while identifying failures in complex scenes and subtle, small artifacts. The examples include incomplete masks and human-portrait anomalies.
- Data Curation: The curation prompt retains only samples that meet all stated standards for clarity, safety, and realism.The standards reject unclear or distorted images, unsafe content, and stylized or non-realistic images.
- Robustness Analysis: Table 10 describes robustness comparisons under severe JPEG compression, Gaussian noise, and Gaussian blur, with degradation ratios shown in parentheses.The caption indicates that the more robust method is highlighted in green.
- Failure Cases: In complex scenes, predicted masks may incompletely cover anomalies intertwined with intricate background details.Figure 8 presents failure cases with ground-truth masks above corresponding model predictions.
- Failure Cases: LEGION struggles with very subtle artifacts occupying small image areas, especially in human portraits.Reported examples include unequal teeth, eye-light and eyelid anomalies, fused fingers, and mismatched eye appearance.
- Qualitative Results: LEGION produces qualitatively accurate artifact positions and contours with explanations that offer plausible reasons for synthetic appearance.Figure 7 compares ground-truth masks in the top row with model predictions in the bottom row.