1. Introduction
Hyperspectral images (HSIs) capture detailed surface information across hundreds of contiguous spectral bands, forming rich three-dimensional data cubes that enable precise material discrimination in applications such as mineral exploration and precision agriculture [
1]. Consequently, HSI classification, which aims to assign land cover labels based on spectral–spatial characteristics, is a fundamental remote sensing task.
Traditional machine learning approaches, including support vector machines (SVMs) [
2] and random forests [
3], primarily rely on handcrafted features. While computationally efficient, these methods are fundamentally limited in modeling the complex, non-linear spectral–spatial interactions inherent in HSIs due to their reliance on manual feature engineering and their vulnerability to the curse of dimensionality, leading to pronounced sensitivity to noisy and redundant spectral bands [
4].
The advent of deep learning revolutionized HSI classification by enabling automatic feature extraction. Convolutional Neural Networks (CNNs), particularly 2D-CNNs [
5] and 3D-CNNs [
6], excelled at capturing local spectral–spatial patterns through hierarchical convolutions. Hybrid architectures [
7,
8] further enhanced multi-scale feature fusion. However, CNNs are inherently limited by their local receptive fields, struggling to model long-range spatial dependencies crucial for large-scale scenes. Recently, Transformers [
8,
9] have addressed this by leveraging global self-attention mechanisms to model long-range dependencies. Despite their success, standard self-attention computes dependencies between all token pairs indiscriminately, making it susceptible to spurious correlations from high-dimensional spectral redundancies. Furthermore, its quadratic computational complexity with respect to sequence length limits its scalability for high-resolution HSIs. Meanwhile, emerging State Space Models (SSMs) such as Mamba [
9] offer a promising alternative with linear complexity, as demonstrated by [
10] with regard to remote sensing data processing. Concurrently, Causal Attention Mechanisms have shown potential in mitigating confounding biases, with ref. [
11] developing causal attention for vision–language tasks, and ref. [
12] employing causal meta-reinforcement learning for multimodal remote sensing data classification.
Beyond correlation-based models, causal inference has emerged as a powerful framework for enhancing model robustness and interpretability by modeling cause–effect relationships. Causal networks, such as Causal Bayesian Networks (CBNs) [
13], aim to identify directional dependencies, mitigating confounding biases. Parallelly, Causal Attention Mechanisms have been developed to integrate these principles directly into deep learning architectures. For instance, masked attention [
14] and front-door adjustment [
15] restrict attention to causally relevant features, effectively reducing spurious correlations in tasks like vision–language reasoning and improving out-of-distribution generalization in language models [
16]. These works demonstrate the potential of causal attention to provide a principled approach to feature selection and robustness. However, their application to HSI classification remains largely unexplored and faces significant domain-specific challenges.
Parallelly,
causal attention networks have been developed to integrate causal principles into attention mechanisms, primarily to mitigate confounding biases and spurious correlations. The core innovation lies in restricting attention to causally relevant features through mechanisms like masked attention [
11] or front-door adjustment [
17]. For instance, Yang et al. proposed Causal Attention (CATT) for vision–language tasks, employing in-sample and cross-sample attention modules to eliminate confounding effects without requiring explicit confounder observations. In large language models, Causal Attention Tuning (CAT) has been introduced to inject fine-grained causal knowledge into attention distributions, effectively reducing reliance on spurious correlations and improving out-of-distribution generalization [
18]. Recent work like CASTLE further enhanced causal attention with lookahead keys, enabling better global context understanding while maintaining causal constraints [
19]. These approaches demonstrate that causal attention can significantly improve model interpretability and robustness across diverse domains.
Despite these advancements, current deep learning approaches for HSI classification face three unresolved challenges: (1) susceptibility to spurious spectral–spatial correlations due to unconstrained attention in high-dimensional spaces; (2) inadequate modeling of causal dependencies between spectral bands and spatial contexts, leading to interpretability bottlenecks and noise sensitivity; and (3) limited scalability imposed by the quadratic complexity of standard Transformers. Existing causal models are either not designed for HSI or require extensive, separate causal discovery pipelines. To address these limitations holistically, we propose the Causal Attention Transformer (CAT). Our approach directly tackles these issues: a Causal Attention Mechanism eliminates spurious correlations via structured masking; a Dual-Path Hierarchical Fusion module jointly models spectral and spatial causality; and a Linearized Causal Attention module reduces complexity to O(N) for scalable processing.
To address these limitations, we propose the Causal Attention Transformer (CAT), a novel hybrid architecture that integrates causal inference with hierarchical feature fusion for robust and interpretable HSI classification. Our approach introduces three key innovations: (1) a Causal Attention Mechanism that eliminates spurious interactions by establishing counterfactual dependencies through triangular masking and axial decomposition; (2) a Dual-Path Hierarchical Fusion module that implements a spectral–spatial fusion framework with learnable gating to progressively integrate causal features from orthogonal domains; and (3) a Linearized Causal Attention module that leverages kernelized cumulative summation to reduce computational complexity from to while maintaining causal constraints for high-resolution HSI processing. These components are integrated within a multi-scale CNN-Transformer backbone that extracts both local patterns and global dependencies while preserving causal relationships.
The main contributions of this work are summarized as follows:
We propose a novel Causal Attention Transformer (CAT) that first integrates causal inference with a hybrid CNN-Transformer architecture for hyperspectral image classification, enabling explicit modeling of spectral–spatial causality without external causal discovery pipelines.
We design a Causal Attention Mechanism with triangular masking and axial decomposition to explicitly disentangle spectral–spatial causality via front-door adjustment, enhancing model robustness and generalization capability, which enforces temporal and spatial causality to eliminate spurious correlations—a principled approach not previously applied to HSI.
We develop a Dual-Path Hierarchical Fusion framework with learnable gating, which adaptively merges spectral and spatial causal features in an end-to-end trainable manner.
We introduce a Linearized Causal Attention that reduces complexity from to while preserving causal constraints, enabling scalable high-resolution HSI processing.
We conduct extensive experiments on three benchmark datasets, demonstrating that CAT achieves state-of-the-art performance compared to existing CNN and Transformer models, while providing interpretable spectral–spatial causal relationships for robust remote sensing analysis.
The rest of this paper is organized as follows:
Section 2 introduces the related work of CNN in hyperspectral image classification and the CAT network integrated with the mamba algorithm.
Section 3 introduces the causal framework of the proposed method.
Section 4 details the methodology of the proposed approach.
Section 5 presents the experimental results and analysis.
Section 6 concludes the paper and discusses future directions.
2. Related Works
2.1. CNN-Based HSI Classification Methods
Convolutional Neural Networks (CNNs) have been a cornerstone of HSI classification, leveraging their strong inductive bias for spatial hierarchies to extract discriminative features. Early approaches primarily focused on 2D-CNNs, which treat HSI as 2D spatial grids and extract local spatial patterns. For instance, Yang et al. [
5] proposed a 2D-CNN with three convolutional layers to classify HSIs by leveraging spatial neighborhood information. However, 2D-CNNs often fail to adequately model the continuous spectral information, as they treat spectral bands merely as independent channels. To address this limitation, 3D-CNNs were introduced to model HSIs as 3D cubes, capturing joint spectral–spatial dependencies via volumetric convolutions. Liu et al. [
8] developed a hybrid 2D-3D CNN that effectively fuses multi-scale spectral–spatial features. Further innovations include lightweight architectures such as the Multi-scale Squeeze-and-Excitation Pyramid Pooling Network (MSPN) proposed by Gong et al. [
20] to tackle the “small sample problem” and the hybrid 3D/2D CNN with squeeze excitation networks by Ari et al. [
21], which employ depthwise separable convolutions to reduce computational costs while maintaining accuracy. More recently, researchers have integrated CNNs with Graph Neural Networks (GCNs) to enhance model stability through attention mechanisms [
7,
12,
22,
23,
24,
25,
26,
27,
28,
29,
30]. Notwithstanding these advancements, CNNs fundamentally struggle to capture global long-range dependencies due to their inherent local receptive fields, and deeper CNN architectures often face overfitting risks when labeled samples are limited [
31], particularly for large-scale HSIs.
Despite their success, CNN-based methods exhibit critical limitations. Their inherent local receptive fields restrict the modeling of global contextual information, which is crucial for large-scale HSI scenes. While 3D-CNNs address this partially, they suffer from high computational complexity. More fundamentally, CNNs lack explicit mechanisms to mitigate spectral redundancy or model causal relationships, making them vulnerable to spurious correlations and confounding factors present in high-dimensional hyperspectral data. These limitations underscore the need for architectures with global receptive fields and built-in robustness, motivating the shift to attention-based models.
2.2. Attention-Based HSI Classification Methods
Attention mechanisms have been progressively integrated into HSI classification to enable adaptive feature refinement [
32]. Early attention-based CNNs, such as the Feedback Attention-based Dense CNN proposed by Yu et al. [
22], enhanced attention maps with semantic knowledge from high-level layers and strengthened spatial attention through multi-scale spatial information. Paolett et al. [
24] further advanced this field by developing AAtt-CNN, which automatically designs and optimizes CNNs using channel-based attention mechanisms. The emergence of Transformers has significantly accelerated this trend, with models like SpectralFormer [
33] employing Groupwise Spectral Embedding (GSE) to tokenize spectral cubes, and SSFTT [
9] integrating Gaussian-weighted tokenization for better spectral–spatial alignment. Recent hybrid approaches, such as the Cross-Attention Fusion Network by Xu et al. [
23], effectively bridge CNNs and Transformers by integrating local features from CNNs with global dependencies from Transformers. Beyond conventional attention, State Space Models (SSMs) like Mamba have recently gained attention; for instance, Peng et al. [
10] applied Mamba to multispectral data, demonstrating faster convergence compared to Transformers. Despite these remarkable developments, conventional attention mechanisms often compute dependencies between all token pairs without explicit constraints, making them susceptible to spurious correlations arising from high-dimensional spectral redundancies [
10,
14,
34,
35,
36]. Moreover, the quadratic computational complexity of self-attention with respect to token length limits scalability for high-resolution HSIs.
However, these attention-based methods face persistent challenges. The standard self-attention mechanism in Transformers computes dependencies between all token pairs without distinguishing between causal and non-causal relationships. This ‘all-to-all’ interaction makes them highly susceptible to spurious correlations arising from high dimensional spectral redundancies, as attention weights may reflect statistical co-occurrences rather than genuine causal dependencies. Furthermore, the quadratic complexity of self-attention remains prohibitive for high-resolution HSI processing. While SSMs like Mamba offer linear complexity, they lack tailored designs for spectral–spatial causality and struggle to disentangle confounding factors. These limitations highlight the necessity for novel attention mechanisms that incorporate causal reasoning.
2.3. Causal-Based Hyperspectral Image Classification Methods
Causal inference has recently emerged as a promising framework for enhancing the robustness and interpretability of HSI classification by modeling cause–effect relationships rather than mere correlations. For instance, Cheng et al. [
37] designed a mask Transformer to identify non-causal factors unrelated to categories, while Zhang et al. [
12] developed causal reinforcement learning frameworks that capture pure causal factors in multimodal data through causal intervention rewards. These approaches prevent false statistical associations between non-causal factors and class labels. In a closely related domain, Li et al. [
16] pioneered causal inference in remote sensing by applying causal-aware feature distribution calibration to pan-sharpening, addressing distribution biases in multispectral images. Beyond HSI, causal graph convolutional networks like Causal-GCNM [
38] have been developed for spatio-temporal prediction, automatically capturing missing patterns in data without requiring additional imputation algorithms. Nevertheless, existing causal methods for HSIs typically require extensive causal discovery pipelines or fail to effectively integrate spectral and spatial causality within a unified, end-to-end trainable architecture. Moreover, they often overlook computational efficiency, limiting their applicability to large-scale HSI data.
Nevertheless, existing causal methods for HSIs present several unresolved challenges. First, they often rely on external, computationally expensive causal discovery modules, reducing their practicality for end-to-end training. Second, they typically focus on either spectral or spatial causality in isolation, lacking a unified mechanism for joint causal modeling across both dimensions. Third, they fail to integrate causal inference seamlessly with modern global architectures like Transformers and neglect computational efficiency, maintaining high complexity. These limitations highlight the need for a novel framework that can efficiently disentangle and integrate spectral–spatial causal relationships within an end-to-end trainable architecture. The proposed CAT model is designed specifically to address this gap.
The proposed CAT introduces key innovations over existing methods. It uses a hybrid CNN-Transformer to capture local and global dependencies while enforcing causal constraints to remove spurious correlations. Its Causal Attention Module, with triangular masking and axial decomposition, explicitly models causal dependencies, boosting robustness against spectral noise. Unlike methods requiring separate causal pipelines, CAT integrates causal inference via a novel front-door adjustment for end-to-end training. Its Dual-Path Hierarchical Fusion dynamically combines spatial and spectral causal features, and the Linearized Causal Attention reduces complexity from to using kernelized cumulative summation. Overall, CAT outperforms current models in HSI classification and provides interpretable spectral–spatial causal relationships.
While kernelized attention [
39] and causal masking have been explored separately in other domains, our work is the first to integrate them within a hierarchical CNN-Transformer backbone specifically designed for HSI, coupled with a novel dual-path fusion strategy.
4. Proposed Method
In this section, we present the Causal Attention Transformer (CAT), a novel architecture designed to perform HSIC by explicitly modeling causal dependencies in both spectral and spatial dimensions. As outlined in
Section 3, our approach is built upon three core innovations: the Causal Attention Mechanism, the Dual-Path Hierarchical Fusion strategy, and the Linearized Causal Attention for efficiency.
Our architecture (as shown in
Figure 1) builds upon established concepts but introduces several key novelties. The hierarchical CNN-Transformer backbone follows common design practices. However, the core innovation lies in the integration of Causal Attention Mechanisms into both spectral and spatial dimensions, and the subsequent dual-path fusion strategy. While causal masking has been explored in NLP, its adaptation and joint application for spectral–spatial HSI analysis is, to the best of our knowledge, unprecedented.
4.1. Causal Attention Mechanism
The Causal Attention Mechanism is the cornerstone of our method, directly implementing the front-door adjustment principle from our causal framework (
Section 3). It ensures that the learned intermediate representation
Z for any token is solely dependent on its causal predecessors, thereby blocking non-causal paths induced by confounders.
4.1.1. Causal Self-Attention
The Causal Self-Attention mechanism enforces a causal structure, crucial for modeling sequences where future elements should not influence past ones. For HSI, we treat the spectral dimension as a sequential signal. The input tensor
is first reshaped into a sequence of tokens
, where
(number of spectral bands) and
(flattened spatial dimensions). We then compute query, key, and value projections:
The attention weights are computed with triangular masking to prevent information leakage:
where the masking function applies lower-triangular constraints, as follows:
This formulation ensures that each position can only attend to itself and preceding positions, maintaining the autoregressive property essential for causal inference in the spectral or spatial sequence.
4.1.2. Causal Attention for 4D Inputs
For direct 4D tensor processing
, we extend causal attention to the spatial domain (as shown in
Figure 2). We employ depthwise separable convolutions for efficient local feature extraction and to maintain the channel-wise independence crucial for spectral causality:
Spatial causality is enforced via axial decomposition, processing the image in a raster-scan order (row-by-row and left-to-right). The causal attention for a query at position
attends only to keys at positions
where
and
:
where
is the indicator function enforcing spatial causality. This approach processes rows and columns sequentially while maintaining computational efficiency through depthwise separable operations.
4.1.3. Linear Causal Attention
To address the quadratic complexity of standard self-attention, we introduce a linearized variant based on kernelized attention. The core idea is to approximate the softmax operation using feature maps that decompose the attention computation into linear complexity.
Given queries
Q, keys
K, and values
V, the standard softmax attention is as follows:
We approximate this using feature maps
and
:
where
is an all-ones vector of the appropriate dimension. This formulation reduces memory complexity from
to
.
For our causal implementation, we use cumulative sums to maintain the causal structure. For the
i-th position, the output is as follows:
We adopt the feature mapping proposed by [
39]:
This ensures non-negative attention scores and stable cumulative computation. The ELU activation function is defined as follows:
with
in our implementation.
The linearization process preserves the directional dependency inherent in the causal attention (i.e., aggregation only from preceding positions). The cumulative sum formulation naturally aligns with the autoregressive nature of causal sequences, thus maintaining the causal constraint while significantly reducing computational complexity.
4.2. Dual-Path Hierarchical Fusion
To comprehensively model the complex causal structures within HSI data, we propose a dual-path strategy that separately captures spectral and spatial causalities, followed by a hierarchical fusion scheme.
4.2.1. Dual-Path Attention Module
The dual-path architecture separately models spectral and spatial dependencies through parallel causal attention pathways. Given input tensor
,
The dynamic fusion with learnable gate
follows:
Spectral attention operates along channel dimension C with complexity , while spatial attention uses axial decomposition with complexity , providing complementary perspectives on the data.
The spectral causal path () aims to eliminate spurious correlations caused by physical factors like atmospheric absorption across bands. Conversely, the spatial causal path () captures genuine causal influences arising from real-world object layouts (e.g., roads causing adjacent soil exposure). This orthogonal design ensures a holistic modeling of causal relationships.
4.2.2. Hierarchical Feature Extraction and Fusion
This section details how the dual-path features are processed and fused across multiple scales.
Patch Embedding Module
The module processes raw HSI cubes through spectral–spatial hierarchical projection. Given input
,
with the following 3D convolution parameters: kernel
, stride
, and channels
. Spatial refinement applies, as follows:
with the following 2D convolution configuration: kernel progression
and channel expansion
.
Multi-Stage Processing
The backbone employs multi-scale processing through four hierarchical stages:
Each stage contains strided convolution for downsampling () and Transformer blocks with counts . The dynamic fusion mechanism employs learnable weights to adaptively combine features across scales.
Feature Fusion and Classification
The final representation integrates multi-scale features through upsampling and weighted combination, as follows:
where upsampling uses bilinear interpolation for dimension alignment. The classification head processes fused features through global average pooling and linear projection:
Dropout with is applied before final projection to prevent overfitting, while the global pooling operation ensures spatial invariance and reduces the parameter count.
4.3. Computational Complexity Analysis
The computational advantage of our linearized approach can be quantified as follows:
Standard attention: time, memory;
Linear attention: time, memory.
Where N is the sequence length and d is the feature dimension. For hyperspectral images where N () is large but d is moderate, this provides substantial efficiency gains while preserving causal structure.
4.4. Connection to State Space Models
Our Linearized Causal Attention (LCA) shares with State Space Models (SSMs) the goal of achieving linear computational complexity in sequence length, making both suitable for long-range modeling in hyperspectral data. However, the underlying mechanisms and implications for interpretability diverge fundamentally.
First, while Mamba replaces attention with a continuous-time hidden state recurrence , which implicitly filters and propagates information through data-dependent parameters, it does not yield explicit, sample-wise importance scores over input tokens. In contrast, our LCA retains an explicit, normalized attention map (via kernelized approximation of Softmax), which can be directly computed and visualized for any input–output pair. This explicitness is critical: within our causal framework, serves as a proxy for the causal influence of feature j on the prediction at location i. Thus, even after linearization, LCA preserves the semantic transparency that standard attention provides—a property absent in black-box SSM dynamics.
Second, LCA is natively embedded within a Transformer architecture, enabling seamless integration with positional encodings, layer normalization, and multi-head mechanisms. This architectural compatibility allows our model to inherit the rich representational capacity and modular design of modern vision Transformers, while replacing only the attention core with a linearized, causally informed variant. Mamba, by contrast, requires a complete architectural shift away from attention, limiting its plug-and-play compatibility with existing attention-based pipelines or hybrid designs.
Consequently, our approach uniquely balances three desiderata: (1) linear complexity, (2) causal interpretability via explicit attention weights, and (3) architectural flexibility within the Transformer paradigm. This triad enables not only efficient inference but also scientifically meaningful analysis of spectral–spatial decision rationales—something SSMs alone cannot offer.
6. Conclusions
This paper has introduced the Causal Attention Transformer (CAT), a novel framework that integrates causal inference with deep learning for hyperspectral image classification. The proposed architecture addresses fundamental limitations in existing methods through three key innovations: a Causal Attention Mechanism that eliminates spurious correlations via triangular masking and axial decomposition, a Dual-Path Hierarchical Fusion module that adaptively integrates spectral and spatial features, and a Linearized Attention formulation that reduces computational complexity from the quadratic to linear scale. Extensive experiments on three benchmark datasets have demonstrated that CAT achieves state-of-the-art performance with 94.25% OA on Indian Pines, 98.24% OA on Houston2013, and 99.08% OA on Pavia University, while providing enhanced interpretability through spectral–spatial causal maps and computational efficiency with 1.26 G FLOPs.
Future work will enhance the CAT framework by developing automated causal discovery to derive HSI causal structures without predefined assumptions, exploring multimodal fusion (e.g., LiDAR and SAR) to boost classification in complex settings, and employing domain adaptation for better cross-region and sensor generalization. We will also extend this framework to remote sensing tasks like change detection, semantic segmentation, and target detection, leveraging its interpretability and robustness.