SWXAI: A Unified Multimodal Explainability Library for Space Weather Forecasting and Heliophysics

Benedict Antonio Mervyn, Anli Ji, Manolis K. Georgoulis, Berkay AydinarXiv 2026 · DOI · arXiv

TL;DR

SWXAI is a new open-source Python library that unifies explainable AI (XAI) workflows for the diverse data types used in space weather forecasting, including solar images, multivariate time series, and tabular event logs. By providing a consistent interface across different machine learning backends like PyTorch and scikit-learn, it reduces the coding effort for generating explanations by up to 90%, making scientific ML models in heliophysics more transparent and reproducible.

What Problem Does This Paper Address?

Predicting space weather—phenomena like solar flares and coronal mass ejections—is critical for protecting satellite operations and power grids. Researchers increasingly use machine learning (ML) to process heterogeneous data: 2D magnetograms (images), temporal magnetic field readings (time series), and structured event catalogs (tabular data).

However, the tools used to explain why these models make certain predictions are fragmented. A researcher might use Captum for image models, SHAP for tabular data, and custom scripts for time series. This lack of a unified framework creates significant engineering overhead, makes it difficult to compare results across different data modalities, and hinders the reproducibility of scientific findings.

Methods

The authors introduce SWXAI, a framework designed to bridge these gaps through a modular architecture:

  • Unified API: A single SpaceWeatherExplainer object handles requests regardless of the data type or model backend.
  • Multimodal Support: It integrates popular XAI methods for three main data types:
  • Image: Gradient-based methods like Grad-CAM, Integrated Gradients, and Saliency.
  • Time-Series: Both gradient-based and model-agnostic occlusion methods, plus specialized feature extractors (e.g., MiniRocket, TSFresh).
  • Tabular: Standard local and global explainers like SHAP, LIME, and Ceteris Paribus profiles.
  • Backend Agnosticism: The library acts as a wrapper for PyTorch, scikit-learn, and the aeon time-series toolkit, normalizing inputs and outputs so researchers can swap models without rewriting their entire pipeline.
  • Standardized Persistence: Every explanation is returned as a consistent dataclass containing raw attribution values, metadata, and generated figures, facilitating long-term storage and comparison.
Figure 1: Overview of the SWXAI architecture, showing multimodal inputs, the unified API, registry and validation layers, backend model support, and explanation outputs. Output structure (API schema, visualization templates) is consistent across runs; attribution values are run-specific.

Datasets

The library comes bundled with three representative heliophysics datasets to demonstrate its capabilities:

  1. HMI Active-Region Patches: 2,000 line-of-sight magnetogram patches for image-based flare prediction.
  2. SWAN-SF Subset: 300 multivariate time-series windows of magnetic field parameters.
  3. Geomagnetic Storms: 132 event-level records from the NASA CDAW catalog, spanning 1996–2025.

Key Insights and Ideas

  • Reducing "Glue Code": The primary value of SWXAI isn't a new algorithm, but the "plumbing" that connects disparate tools. By handling validation and adapters internally, it allows scientists to focus on physics rather than software engineering.
  • Domain-Specific Visualizations: Unlike general-purpose XAI libraries, SWXAI includes visualization templates tailored for heliophysics, such as temporal importance scores that highlight exactly when a solar region became "flaring-active."
  • Reproducibility by Design: By forcing a standard output schema (the Explanation object), the library ensures that an explanation generated today can be easily reloaded and compared to a new model's output months later.
Figure 2: SWXAI coverage across data modalities, explanation methods, modeling and feature-extraction extensions, and utility and reproducibility resources.

Key Results

  • Efficiency: In benchmarks, SWXAI reduced the number of user-authored code statements required to generate an explanation by 83% to 91% compared to direct backend implementations.
  • Performance: The abstraction layer introduces negligible overhead, with runtime differences remaining below two milliseconds in all tested workflows.
  • Fidelity: Attributions generated by SWXAI match direct backend implementations exactly, ensuring that the simplified interface does not sacrifice numerical accuracy.

For example, Figure 4 illustrates how the library can pinpoint specific time intervals and magnetic features (like TOTUSJH) that drive a flare prediction model.

Time-series occlusion importance showing which intervals drive flare prediction.

Limitations and Future Work

The authors acknowledge that the current release prioritizes system integration and common modalities over cutting-edge algorithms. Future iterations aim to include:

  • Advanced XAI Methods: Incorporating uncertainty-aware and physics-guided counterfactual explanations.
  • Broader Architectures: Supporting newer multimodal transformer architectures.
  • Expert Validation: Working with heliophysics domain experts to validate whether the "important" regions identified by the AI align with known physical processes.

Summary updated

Abstract

Space weather forecasting and heliophysics increasingly rely on machine learning models that process heterogeneous inputs such as multi-viewpoint multi-wavelength solar images and rasters, multivariate time series, spatial annotations, and tabular event-level data. However, explainability workflows remain fragmented across libraries, model interfaces, and output formats, limiting reuse and reproducibility. We present SWXAI, an open-source library that unifies explainable AI (XAI) workflows for image, time-series, and tabular data in space weather forecasting and heliophysics. SWXAI provides a common, extensible interface across commonly used vision, time-series, and tabular learning models, with validation, adaptation, and persistent explanation objects. It also includes domain-grounded examples, reproducible notebooks, tests, and documentation, enabling users to inspect outputs, swap models or explainers, and extend workflows to new heliophysics datasets. SWXAI reduces modality-specific engineering overhead and supports comparable, reusable explanations across heterogeneous scientific machine learning pipelines. A benchmark against direct backend implementations shows that SWXAI substantially reduces the code users write to produce an explanation, with no practical runtime cost.
BibTeX
@misc{mervyn2026swxai,
  author = {Benedict Antonio Mervyn and Anli Ji and Manolis K. Georgoulis and Berkay Aydin},
  title = {{SWXAI: A Unified Multimodal Explainability Library for Space Weather Forecasting and Heliophysics}},
  year = {2026},
  eprint = {2611.10861},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2611.10861},
}
Figure