Abstract
Explainability for Deep Learning Models is especially important for clinical applications, where decisions of automated systems have far-reaching consequences. While various post-hoc explainable methods, such as attention visualization and saliency maps, already exist for common data modalities, including natural language and images, little work has been done to adapt them to the modality of Flow CytoMetry (FCM) data. In this work, we evaluate the usage of a transformer architecture called ReluFormer that ease attention visualization as well as we propose a gradient- and an attention-based visualization technique tailored for FCM. We qualitatively evaluate the visualization techniques for cell classification and polygon regression on pediatric Acute Lymphoblastic Leukemia (ALL) FCM samples. The results outline the model's decision process and demonstrate how to utilize the proposed techniques to inspect the trained model. The gradient-based visualization not only identifies cells that are most significant for a particular prediction but also indicates the directions in the FCM feature space in which changes have the most impact on the prediction. The attention visualization provides insights on the transformer's decision process when handling FCM data. We show that different attention heads specialize by attending to different biologically meaningful sub-populations in the data, even though the model retrieved solely supervised binary classification signals during training.
Introduction
Flow Cytometry (FCM) is a cornerstone of clinical pathology, used to diagnose blood cancers like leukemia by measuring protein expressions on hundreds of thousands of individual cells. Traditionally, human experts analyze this data by "gating"—drawing polygons around specific cell populations in 2D projections. While deep learning models, specifically Transformers, have reached human-level performance in automating this process, they remain "black boxes." In a clinical setting, this lack of transparency is a liability; if a model misclassifies a sample, doctors need to know why. Standard XAI tools designed for images do not translate well to FCM data, which consists of high-dimensional point clouds rather than pixels. This paper addresses the challenge of creating interpretability tools that respect the unique structure of FCM data while remaining computationally feasible for samples containing up to 500,000 cells.
Methods
The researchers propose two primary avenues for making FCM Transformers transparent: the ReluFormer architecture and novel gradient-based visualizations.
ReluFormer Architecture
Standard Transformers have a computational complexity of $O(N^2)$, which is prohibitive for FCM samples with hundreds of thousands of cells. Previous solutions used "inducing points" to save memory, but this obscured cell-to-cell attention. The authors instead use ReluFormer, an adaptation of cosFormer that utilizes a linear attention mechanism. This allows the model to process large samples while enabling the extraction and visualization of how individual cells "attend" to one another.
Gradient-based Visualization
Instead of simple heatmaps, the authors plot gradient vectors on 2D projections to show the model's sensitivity to feature changes.
- Classification Gradients: These vectors show the direction in the feature space (e.g., increasing CD45 expression) that would most rapidly change a cell's predicted class.
- Polygon Regression Gradients: For automated gating, the authors introduce a "query polygon" method. By comparing a predicted gate to a shifted version, they calculate gradients that reveal which cells are responsible for the gate's specific position and shape.
Results
The study evaluated these techniques on pediatric Acute Lymphoblastic Leukemia (ALL) FCM samples across four datasets (VIE14, BLN, BUE, and VIE20).
Performance and Attention Specificity
The ReluFormer achieved F1-scores (0.60 to 0.95) comparable to the state-of-the-art Set-Transformer, demonstrating that interpretability does not sacrifice accuracy. Quantitative analysis showed that specific attention heads consistently focused on cancer cells (blasts) across different datasets, with the top 5% of attended cells being significantly enriched for the target cancer population.
Emergent Biological Knowledge
A striking finding was that different attention heads specialized in identifying specific biological sub-populations (e.g., erythroblasts or B-cells), even though the model was only trained on a binary signal (cancer vs. healthy). The model "discovered" these biological categories autonomously to solve the task.
Gradient Analysis for Model Debugging
The gradient-based tools allow for detailed inspection of the model's logic. Unlike image-based XAI, which indicates where the model looked, these vectors indicate what the model is looking for. For instance, a vector might show that a cell would be classified as a "blast" if its CD10 expression were slightly higher. This can act as a "BS detector"; in one example, gradient tools revealed that a model's gate prediction relied solely on the bottom edge of a cluster, indicating potential overfitting.
Discussion and Conclusion
The proposed techniques provide clinicians with tools to see which cell populations drive a diagnosis and whether a model is learning genuine biology or overfitting to data artifacts. While promising, the work faces limitations in quantitative XAI evaluation. Future research could involve more rigorous mapping of attention heads to specific immunophenotypes and using these gradient-based tools as a regularization term during training to force models to focus on biologically relevant features, effectively teaching the model to think more like a human pathologist.
Summary updated