Unifying VLM-Guided Flow Matching and Spectral Anomaly Detection for Interpretable Veterinary Diagnosis

Pu Wang, Zhixuan Mao, Jialu Li, Zhuoran Zheng, Dianjie Lu, Youshan ZhangarXiv 2026 · arXiv

TL;DR

Researchers have developed a new, interpretable AI framework for diagnosing canine pneumothorax (collapsed lung) that moves away from traditional "black box" classifiers. By combining Vision-Language Models (VLMs) for precise lesion localization with Random Matrix Theory (RMT) for statistical anomaly detection, the system achieves state-of-the-art accuracy while providing a clear, physics-based rationale for its diagnoses.

What Problem Does This Paper Address?

Veterinary radiology faces a "perfect storm" of challenges for AI development. First, there is an extreme scarcity of high-quality, pixel-level annotated datasets compared to human medicine. Second, veterinary patients exhibit massive anatomical variance—the thoracic cavity of a Chihuahua looks nothing like that of a Great Dane—making it difficult for standard models to generalize.

Finally, most medical AI models act as "black boxes" (see Figure 1b). They might output a diagnosis, but they can't explain why. In high-stakes clinical environments, this lack of interpretability hinders trust. For a condition like canine pneumothorax, where features can be incredibly subtle and life-threatening, veterinarians need tools that are both precise and transparent.

![Fig.

  1. Comparison of diagnostic approaches for canine pneumothorax. (a) The clinical challenge of subtle features. (b) The interpretability issue of ”black box” AI. (c) Our proposed framework.](/figures/art_cad50baf69e246f39f027ade1949ed13)

Methods

The authors propose a two-stage paradigm that reframes diagnosis as a process of signal localization followed by spectral analysis.

  1. Localization (VLM-Guided Flow Matching): The system starts with a ViT-UNet that uses text prompts (e.g., "a collapsed lung due to pneumothorax") to generate an initial, coarse segmentation mask. To sharpen this mask, they employ Conditional Flow Matching (CFM). This is a generative approach that treats mask refinement as a continuous path, iteratively "flowing" the coarse mask toward a high-fidelity boundary. This process ensures the model captures the subtle, fuzzy edges characteristic of lung collapse.

  2. Detection (Random Matrix Theory): Instead of feeding the segmented area into a standard neural network classifier, the authors turn to Random Matrix Theory (RMT). They model healthy tissue as a system of predictable random noise following the Marchenko-Pastur law. When a pathology like pneumothorax is present, it introduces a "non-random" structural signal that manifests as outlier eigenvalues in the feature covariance matrix. By calculating a Spectral Anomaly Score (SAS) based on these outliers, the model provides a quantitative, statistically grounded measure of disease severity (see Figure 2).

![Fig.

  1. Overview of our proposed synergistic framework for canine pneumothorax diagnosis.](/figures/art_2adc276bc5524e5d916b22accef051eb)

Datasets

A major contribution of this work is the release of a new, public dataset of canine thoracic radiographs.

  • Scale: 12,345 total images (8,641 training, 2,468 validation, 1,236 test).
  • Quality: Pixel-level annotations provided by three board-certified veterinary radiologists, with a senior radiologist adjudicating disagreements.
  • Challenge: The dataset reflects real-world clinical imbalance, with an 8:2 ratio of healthy to diseased cases.

Key Insights and Ideas

  • Synergy is Key: The high-fidelity localization from the Flow Matching stage is crucial. By "purifying" the signal—isolating only the suspected lesion area—the RMT detector becomes significantly more sensitive to pathological outliers.
  • Statistical First Principles: By using RMT, the model avoids "memorizing" anatomical shapes (which vary by breed). Instead, it identifies the statistical signature of the disease, making it more robust to the high inter-breed variance found in dogs.
  • Built-in Interpretability: The SAS isn't just a probability score; it represents a measurable deviation from a statistical "normal." This gives clinicians a tangible basis for the diagnosis.

Key Results

The proposed framework outperformed a wide array of state-of-the-art models in both segmentation and classification tasks.

  • Segmentation: The model achieved a mDice of 0.8953 and mIoU of 0.8114, surpassing established architectures like Unet++, Swin-UNet, and even the Segment Anything Model (SAM), which struggled with the domain shift to veterinary X-rays (see Figure 4).
  • Classification: The system reached an AUC of 0.939 and a balanced F1-score of 0.7962. Crucially, while baseline models like VGG16 tended to over-predict the positive class (100% recall but very low precision), the RMT-based approach maintained high precision (0.8222) alongside strong recall.

![Fig.

  1. Qualitative Comparison of Unet-based Segmentation Results.](/figures/art_fbb02374380f454a82b69ffb8fce63a5)

![Fig.

  1. (a) ROC Curve and (b) P-R Curve showing superior performance over baselines.](/figures/art_dd64bc7c8556402eb72185e4313bdcd7)

Limitations and Future Work

While the paper demonstrates strong results, a few areas remain for exploration:

  • Computational Overhead: The iterative nature of Flow Matching (solving an ODE during inference) is more computationally intensive than a single-pass U-Net.
  • Generalization: The current study focuses specifically on pneumothorax. Future work could investigate whether the RMT-based "spectral anomaly" approach can be extended to other thoracic pathologies like pneumonia or pleural effusion.
  • VLM Dependency: The quality of the initial mask depends on the VLM's ability to understand the text prompt, which may require careful prompt engineering for different diseases.

Summary updated

Abstract

Automatic diagnosis of canine pneumothorax is challenged by data scarcity and the need for trustworthy models. To address this, we first introduce a public, pixel-level annotated dataset to facilitate research. We then propose a novel diagnostic paradigm that reframes the task as a synergistic process of signal localization and spectral detection. For localization, our method employs a Vision-Language Model (VLM) to guide an iterative Flow Matching process, which progressively refines segmentation masks to achieve superior boundary accuracy. For detection, the segmented mask is used to isolate features from the suspected lesion. We then apply Random Matrix Theory (RMT), a departure from traditional classifiers, to analyze these features. This approach models healthy tissue as predictable random noise and identifies pneumothorax by detecting statistically significant outlier eigenvalues that represent a non-random pathological signal. The high-fidelity localization from Flow Matching is crucial for purifying the signal, thus maximizing the sensitivity of our RMT detector. This synergy of generative segmentation and first-principles statistical analysis yields a highly accurate and interpretable diagnostic system (source code is available at: https://github.com/Pu-Wang-alt/Canine-pneumothorax).
BibTeX
@misc{wang2026unifying,
  author = {Pu Wang and Zhixuan Mao and Jialu Li and Zhuoran Zheng and Dianjie Lu and Youshan Zhang},
  title = {{Unifying VLM-Guided Flow Matching and Spectral Anomaly Detection for Interpretable Veterinary Diagnosis}},
  year = {2026},
  eprint = {2604.05482},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2604.05482},
}
Figure