PhysXAI: A Theoretical Framework for Diagnosing Physical Hallucinations in Weather Foundation Models

Anjan Mahapatra, Nikhil RajarXiv 2026 · arXiv

TL;DR

PhysXAI is a novel diagnostic framework designed to detect and explain "physical hallucinations"—forecasts that look accurate but violate fundamental laws of physics—in AI weather models. By combining a multi-branch physics encoder with a contrastive learning objective, it provides a learnable system that can spatially localize and attribute physical inconsistencies with calibrated uncertainty.

What Problem Does This Paper Address?

The current generation of "foundation models" for weather—like GraphCast and Pangu-Weather—has achieved incredible predictive accuracy, often rivaling or beating traditional numerical weather prediction (NWP) systems. However, these models are typically trained purely on data (supervised learning) without an explicit "understanding" of physics.

As a result, they can produce physical hallucinations: forecast states that score well on standard metrics like Root Mean Square Error (RMSE) but are physically impossible. They might violate mass conservation, break hydrostatic balance, or fail to follow proper energy scaling. Existing evaluation tools are mostly "post-hoc" and global; they can tell you a forecast is physically "off" in aggregate, but they can't pinpoint where the violation is happening, what specific law is being broken, or provide a measure of confidence in that diagnosis.

Methods

The authors propose PhysXAI, a learnable diagnostic layer that sits on top of pre-trained weather models. Its architecture (illustrated in Figure 1) consists of several key innovations:

  1. A Rigorous Definition: They formally define a physical hallucination as a state that is either "accurate but inconsistent" (low numerical error but high physical residual) or "severely inconsistent" (catastrophic physical violation regardless of error).
  2. Multi-Branch Physics Encoder: The system extracts features from five distinct "residual families":
  3. Conservation: Mass, water, and energy.
  4. Dynamics: Vorticity, geostrophic, and hydrostatic balance.
  5. Spectral: Kinetic energy spectrum and flux.
  6. Cross-variable: Thermodynamic consistency (e.g., Clausius–Clapeyron).
  7. Spatiotemporal: Continuity over time.
  8. Cross-Physics Attention Fusion: A mechanism that allows the model to adaptively focus on the most relevant physical features based on the atmospheric context (e.g., focusing on hydrostatic balance near a cyclone).
  9. Physics-Consistency Contrastive Learning: This is the "secret sauce." The model is trained to pull physically consistent states together in latent space while pushing inconsistent states (created via controlled synthetic perturbations) apart.
  10. Multi-Task Prediction Heads: The model outputs a hallucination score, a spatial heatmap of the violation, the type of violation, and Bayesian uncertainty parameters ($\alpha, \beta$ for a Beta distribution).
Figure 1: PhysXAI architecture: a multi-scale encoder extracts hierarchical features from the fore- cast, while five physical residual branches compute conservation, dynamics, spectral, cross-variable, and spatiotemporal residuals. Features are fused via cross-physics attention and projected through a contrastive head. Three output heads produce detection, diagnosis, and uncertainty estimates.

Datasets

The framework was evaluated using a comprehensive suite of data:

  • Reference Data: ERA5 (reanalysis data), WeatherBench 2, and MERRA-2.
  • Forecast Models: Forecasts generated by GraphCast, Pangu-Weather, and NeuralGCM.
  • Evaluation Period: Test set spanning 2020–2022, with lead times of 1, 3, 5, and 10 days.

Key Insights and Ideas

  • The Isometry Theorem: The authors provide a theoretical proof that their contrastive learning objective makes the model's latent representation "isometric" to the physical residual space. In plain English: the "distance" between two states in the AI's internal representation directly corresponds to the difference in their physical law violations.
  • Decoupling Error from Physics: A central "aha" moment is the proof of an Error-Residual Trade-off. They show that numerical accuracy and physical consistency can vary independently, justifying why we need specialized tools to look for hallucinations rather than just relying on RMSE.
  • Learnable vs. Deterministic: Unlike previous metrics that are static calculations, PhysXAI is a learnable system. This allows it to improve over time and provide "explainable" outputs like heatmaps and uncertainty, which are critical for operational trust.

Key Results

PhysXAI significantly outperforms existing anomaly detection and physical metric baselines.

  • Detection Performance: At a 5-day lead time, PhysXAI achieved an AUROC of 0.91, far surpassing the best baseline (PhysMetrics Ensemble at 0.80).
  • Robustness over Time: While other methods degrade quickly as forecast lead time increases, PhysXAI maintains an AUROC above 0.83 even at day 10 (see Figure 3).
  • Uncertainty Calibration: The model's uncertainty estimates are highly reliable, with an Expected Calibration Error (ECE) below 0.05 (see Figure 4).
  • Ablation Study: Removing the contrastive learning component caused the largest performance drop (from 0.91 to 0.85), highlighting its importance in structuring the model's physical "understanding."
Figure 3: Receiver Operating Characteristic (ROC) curves for PhysXAI and baseline methods at 5-day forecast lead time.

Limitations and Future Work

  • Residual Independence: The theoretical isometry proof assumes that different physical residuals are independent. In reality, things like mass divergence and vertical motion are coupled, which might slightly weaken the theoretical guarantees in practice.
  • Synthetic vs. Real Failures: The model is currently trained on synthetic perturbations. While effective, these might not capture every subtle way a foundation model can fail. The authors plan to augment training with actual labeled forecast errors from foundation models.
  • Computational Cost: At roughly 2 seconds per forecast on an NVIDIA A100, the inference cost is acceptable for single forecasts but might require optimization for massive ensemble systems.

Overall, PhysXAI represents a major step toward "Trustworthy AI" in meteorology, moving beyond simple accuracy to ensure that AI-generated weather forecasts are actually physically grounded.

Summary updated

Abstract

Modern machine learning models for global weather forecasting achieve remarkable predictive accuracy, yet they frequently produce states that violate fundamental physical laws, including conservation of mass, hydrostatic balance, or spectral energy scaling. We term these outputs physical hallucinations and propose PhysXAI, a rigorous diagnostic framework that detects, localises, and attributes such inconsistencies. Unlike existing post-hoc metric suites, PhysXAI is a learnable system that explicitly decouples forecast error from physical plausibility. We formalise the problem through a novel joint condition on numerical and physical residuals, and introduce a multi-branch encoder that extracts representations from conservation, dynamical, spectral, cross-variable, and spatiotemporal residuals. A key innovation is a physics-consistency contrastive learning objective, which we theoretically show the latent representation to be approximately isometric to the physical residual space, ensuring that diagnostic decisions remain grounded in physically meaningful deviations. We further derive an adaptive multi-objective loss with gradient-based weighting to balance competing diagnostic objectives. The framework produces spatially resolved hallucination maps, violation-type classifications, and calibrated Bayesian uncertainty, enabling both detection and interpretable attribution of physical inconsistencies. We conduct a comprehensive comparative evaluation of PhysXAI across ERA5, WeatherBench 2, and MERRA-2, using forecasts from GraphCast, Pangu-Weather, and NeuralGCM, with Python-written code and a fully reproducible experimental protocol. Our theoretical analysis and empirical evaluation establish PhysXAI as a principled framework for diagnosing physical hallucinations and advancing trustworthy AI for weather forecasting.
BibTeX
@misc{mahapatra2026physxai,
  author = {Anjan Mahapatra and Nikhil Raj},
  title = {{PhysXAI: A Theoretical Framework for Diagnosing Physical Hallucinations in Weather Foundation Models}},
  year = {2026},
  eprint = {2611.15053},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2611.15053},
}
Figure