Structure and Semantic-Guided Closed-Loop Medical Image Anomaly Detection via Multi-Agent Collaboration

Chunjing Xiao, Yunxiao Dai, Yuwan Fu, Yucong Wang, Chong Tang, Fan Zhou, Ying MaNeurIPS 2026

TL;DR

Finding rare diseases in medical scans without labeled examples usually relies on "spot-the-difference" AI: generate a healthy-looking version of the patient's scan and see what changed. However, single-pass generators often accidentally erase healthy anatomy or copy over the disease. $\text{S}^2\text{Agent}$ fixes this by turning image reconstruction into an iterative, closed-loop conversation among three specialized agents that enforce both anatomical structure and clinical text descriptions until the healthy reference is genuinely reliable.

What Problem Does This Paper Address?

In medical imaging, collecting enough labeled examples of every possible rare disease or subtle lesion is nearly impossible. Healthy scans, however, are plentiful. Consequently, researchers frame unsupervised anomaly detection around learning what "normal" looks like.

The dominant strategy is reconstruction-based: train a generative model exclusively on healthy images. When given a test X-ray containing pneumonia, the model should theoretically fail to draw the infection, reconstructing a clean lung instead. Comparing the input to the reconstruction reveals the anomaly.

Yet, existing methods suffer from two major flaws:

  1. The "One-Shot" Trap: Most pipelines generate the reference image in a single pass and blindly trust it. If the generator is too expressive, it faithfully copies the tumor right into the "healthy" reference (hiding the anomaly). If it is too rigid, it warps normal patient-specific anatomy (triggering false alarms).
  2. Uncoordinated Guidance: Medical scans have strict spatial layouts (ribs, spine, lungs) alongside clinical, semantic meaning. Without explicit, coordinated control over both, reconstructions easily drift away from plausible human anatomy.

Methods

Instead of a single-pass generator, the authors propose $\text{S}^2\text{Agent}$, reformulating anomaly detection as a feedback-driven, multi-agent loop.

Figure 1: Overall framework of S2Agent. It comprises three collaborative agents. The Planner derives memory-tree-guided structural constraints and claim-based semantic constraints. The Reconstructor performs reconstruction conditioned on both types of constraints. The Detector verifies structural and semantic consistency to provide feedback for closed-loop refinement.

Before inference, the system builds two offline "normality knowledge" bases: a Memory Tree (a coarse-to-fine hierarchy of normal visual prototypes learned from healthy scans) and a Normal Claim Inventory (short, factual observations of healthy anatomy extracted from clinical radiology reports).

At test time, three agents collaborate iteratively:

  • The Reflective Planner: Given a test X-ray, it queries the Memory Tree to build a personalized structural blueprint ("matched tree") and uses a vision-language model (BiomedCLIP) to select visually supported, normal-only clinical claims, assembling them into a short caption.
  • The Reconstructor: Built on an unCLIP diffusion decoder, it takes the original image's appearance prior via DDIM inversion and denoises it. What is new here is a dual-conditioning setup: text branches handle the Planner's semantic claims, while a custom lightweight adapter injects the continuous structural tree features directly into the U-Net.
  • The Dual-Space Detector: Rather than immediately scoring the anomaly, the Detector audits the reconstruction. It checks if the reconstructed image's structural tree and generated claims match what the Planner originally asked for. If discrepancies arise, it sends feedback back to the Planner.

When feedback arrives, the Planner deterministically re-weights deviated structural nodes (avoiding LLM hallucinations in continuous math) and uses an LLM to make targeted edits (revise, restore, restrain) to the semantic caption. Once the loop converges—or hits a round limit—pixel-wise differences between the input and final reconstruction yield the anomaly score.

Datasets

No new datasets are introduced, though the Normal Claim Inventory is parsed from MIMIC-CXR and CheXpert Plus radiology reports.

Image-level anomaly detection (training strictly on normal images) is evaluated on three public chest X-ray benchmarks:

  • ZhangLab Chest X-ray: Normal vs. pneumonia.
  • Stanford CheXpert (PA): Frontal radiographs featuring diverse abnormalities.
  • COVIDx (v9): Normal, non-COVID pneumonia, and COVID-19 cases.

Key Insights and Ideas

  • Verification before comparison: Treating reconstruction as an iterative control problem prevents generative artifacts in healthy tissue from masquerading as diseases. In a case study, the first pass cleared up lung abnormalities but hallucinated bright spots in a healthy upper-lung region; the Detector caught the grayscale inconsistency, allowing the second pass to restore the normal background.
  • Constrained semantics beat free-form text: Grounding the VLM in a curated inventory of atomic normal claims outperforms both rigid text templates and unconstrained free-form captions, preventing subtle abnormal descriptions from leaking into the reconstruction prompt.
  • Hierarchical anatomy matters: Organizing normal visual prototypes into a tree rather than a flat memory pool better captures multi-scale chest variations (from broad thoracic layouts down to local rib textures).
  • Diminishing returns on thinking too long: Performance steadily climbs over 1 to 3 feedback rounds before plateauing at round 4, offering a clean knob to balance accuracy against compute.

Key Results

$\text{S}^2\text{Agent}$ outperforms 10 medical-specific and general-purpose baselines (including diffusion and Mamba-based models) across all three benchmarks:

Table 1: Performance comparison on three benchmarks.
  • ZhangLab: Reaches 93.27% AUC-PR, 94.81% AUC-ROC, and 91.63% F1 (surpassing the strongest baseline, PDD, at 92.43% AUC-PR).
  • CheXpert (PA): Achieves 79.16% AUC-PR and 78.27% F1, beating DeCo-Diff by over 2.3 percentage points in AUC-PR.
  • COVIDx (v9): Hits 91.26% AUC-PR, 90.93% AUC-ROC, and 90.28% F1.
  • Removing either feedback loop hurts performance (e.g., on COVIDx, F1 drops from 90.28% to 88.79% with structure-only feedback, and 88.61% with semantic-only).

Limitations and Future Work

The authors candidly note several practical trade-offs:

  • Inference overhead & complexity: Running an iterative diffusion and VLM/LLM loop is noticeably slower and heavier to implement than single-pass detectors.
  • Scope: Experiments are restricted to image-level chest X-ray classification; pixel-level lesion localization and other modalities (like MRI or CT) remain untested.
  • Upstream dependencies: System reliability hinges on external pretrained VLMs/LLMs and clean claim extraction. Future work aims to expand to new medical modalities, tackle pixel-level localization, and explore fully trainable, lightweight alternatives to external LLM refinement.

Summary updated

Abstract

Unsupervised medical image anomaly detection aims to identify images that deviate from the learned normal distribution. Reconstruction-based methods are a dominant paradigm, generating a normal-looking reference for each test image and detecting anomalies via input--reconstruction discrepancy. However, most existing methods follow a one-shot reconstruction-and-comparison pipeline, making anomaly scoring vulnerable to reconstruction failures: abnormal regions may be preserved, while normal anatomical structures may be distorted. Moreover, they often lack coordinated control from structural and semantic normality, which can lead to anatomical inconsistency and semantic drift. To address these issues, we propose S2Agent, a structure- and semantic-guided multi-agent framework that reformulates anomaly detection as feedback-driven normality reconstruction. S2Agent decomposes the process into three collaborative agents. The Planner derives sample-specific matched-tree structural priors and normal-only semantic claims from normality knowledge. The Reconstructor generates a normality-oriented reference image under their joint guidance. The Detector verifies the reconstruction in matched-tree and semantic-claim spaces, returning feedback to refine structural weights and semantic constraints for the next round. Through this closed loop, S2Agent iteratively corrects structural deviation and semantic drift, suppresses abnormal or unsupported content, and improves the reliability of anomaly scoring. Experiments on three public chest X-ray benchmarks demonstrate the effectiveness of the proposed closed-loop guidance.
BibTeX
@inproceedings{xiao2026structure,
  author = {Chunjing Xiao and Yunxiao Dai and Yuwan Fu and Yucong Wang and Chong Tang and Fan Zhou and Ying Ma},
  title = {{Structure and Semantic-Guided Closed-Loop Medical Image Anomaly Detection via Multi-Agent Collaboration}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2026},
  url = {https://openreview.net/forum?id=LplVYRTK4x},
}
Figure