TL;DR
XAIguiFormer is a novel Transformer architecture that moves Explainable AI (XAI) from a post-hoc analysis tool to an active participant in model training. By using XAI-generated importance scores to refine self-attention and incorporating demographic-aware frequency encoding, the model achieves state-of-the-art performance in identifying brain disorders from EEG data while providing clear clinical interpretability.
What Problem Does This Paper Address?
Identifying brain disorders using scalp electroencephalography (EEG) is cost-effective and non-invasive, but it presents significant data science challenges. EEG signals are typically transformed into "connectomes"—graphs representing the connectivity between different brain regions across various frequency bands (like alpha, beta, and theta).
Standard deep learning approaches, particularly Transformers, face three major hurdles here:
- Structural Loss: Traditional tokenization (like splitting images into patches) destroys the topological structure of brain graphs.
- Contextual Blindness: Standard positional encodings don't account for the intrinsic meaning of frequency bands or individual demographic differences (age and gender), which significantly affect brain activity.
- The "Black Box" Gap: While XAI is often used to explain why a model made a decision, it is rarely used to help the model make better decisions during the learning process.
Methods
The authors introduce XAIguiFormer, which treats the Transformer as a dynamical system that can be "refined" through feedback. Its architecture rests on three innovative pillars:
- Connectome Tokenizer: Instead of fragmenting a brain graph, the model uses a Graph Neural Network to process each single-band graph as an "atomic token." This preserves the complex spatial relationships of the brain's neural pathways.
- dRoFE (Rotary Frequency Encoding with Demographics): Building on the popular Rotary Positional Embedding (RoPE), the researchers integrated frequency bounds and demographic data (age and gender) directly into the rotation matrix. This allows the model to "orient" itself based on who the patient is and what frequency it is looking at.
- XAI-Guided Self-Attention: This is the "secret sauce." The model uses DeepLift (an XAI algorithm) to identify which features were most influential in a "vanilla" pass. These importance scores are then used to refine the Query ($Q$) and Key ($K$) vectors in a second, guided pass. This forces the attention mechanism to filter out noise and concentrate on the most relevant dependency relationships.
The training is governed by a Joint Loss Function that balances the accuracy of the initial "coarse" prediction with the "refined" prediction guided by XAI.
Datasets
The model was evaluated on two major publicly available EEG datasets:
- TUH Abnormal EEG Corpus (TUAB): One of the largest clinical EEG datasets, containing nearly 3,000 sessions. It was used for binary classification (Normal vs. Abnormal).
- TDBRAIN: A clinical lifespan database containing diverse patients with MDD, ADHD, and OCD. This was used for more complex multi-class classification.
Key Insights and Ideas
- XAI as a Teacher: The most significant "aha moment" is the transition of XAI from a passive visualization tool to an active supervisor. By treating XAI insights as "additional knowledge," the model performs a form of "self-refinement" without needing external datasets.
- Attention Concentration: The researchers found that XAI guidance significantly reduced "attention entropy." In plain English: the model stopped looking at everything at once and started focusing intensely on specific, clinically relevant frequency relationships.
- The Power of the Theta/Beta Ratio: The model’s internal "importance" rankings aligned with established medical literature, identifying the theta/beta ratio as a primary biomarker for attentional control and brain disorders.
- Demographics Matter: Integrating age and gender into the embedding space (dRoFE) provided a significant performance boost, confirming that "normal" brain activity is a moving target that depends on the individual's profile.
Key Results
XAIguiFormer outperformed several heavy-hitting baselines, including specialized EEG models like BIOT and LaBraM-Base.
- On TUAB: It achieved a Balanced Accuracy (BAC) of 0.8205, surpassing the previous best models.
- On TDBRAIN: It reached a BAC of 0.6635. Notably, the performance gain from XAI guidance was even more pronounced on this smaller dataset (+2.78% BAC), suggesting that XAI guidance is particularly helpful when data is scarce.
- Ablation Success: Removing the demographic-aware encoding (dRoFE) or the XAI guidance led to a measurable drop in accuracy, proving that both components are vital to the model's success.
Limitations and Future Work
While powerful, the authors note a few areas for improvement:
- Granularity of Explanation: Currently, the XAI explanations are provided at the frequency band level (e.g., "the alpha band is important"). They do not yet provide "node-level" explanations that could pinpoint specific brain regions (e.g., "the frontal lobe connectivity is abnormal").
- Generalization: While tested on two large datasets, the authors acknowledge that real-world clinical scenarios are even more diverse.
- Pre-training: Future work will explore self-supervised pre-training on even larger unlabeled datasets to see if the XAI-guidance benefits scale further.
Check out the code: https://github.com/HanningGuo/XAIguiFormer
Summary updated