Masked Layer Fusion Attention (MLFA)
- Masked Layer Fusion Attention (MLFA) is a multimodal fusion mechanism that integrates SAR and optical data using cross-attention within Vision Transformers.
- It employs dedicated XAttnEncoder and XAttnDecoder modules to perform early and feature-level fusion, enhancing masked autoencoder performance.
- By using independent and consistent masking strategies, MLFA efficiently aligns heterogeneous features, achieving competitive results against contrastive methods.
Masked Layer Fusion Attention (MLFA) is a multimodal data fusion mechanism developed for Masked Autoencoder (MAE)-style Vision Transformers, enabling early and feature-level information merging between heterogeneous sources such as synthetic aperture radar (SAR) and multispectral optical imagery. MLFA integrates cross-attention operations both at the input and decoder stages to facilitate interaction between modalities with non-trivial domain gaps. This framework underlies the Fus-MAE architecture, which is designed for self-supervised representation learning in remote sensing and achieves competitive or superior performance relative to contrastive and other masked modeling approaches (Chan-To-Hing et al., 2024).
1. Architectural Components and Data Flow
MLFA operates on paired modality inputs (SAR) and (optical). Each input is separately patch embedded using a 2D convolution with kernel and stride , yielding tokens and of shape , where is the latent dimension.
The fusion process incorporates cross-attention mechanisms at specific layers:
- Early fusion occurs in the first encoder block, replacing the standard self-attention+MLP pair with an XAttnEncoder that combines the patch-embedded tokens from both modalities.
- Feature-level fusion is conducted in the decoder just before per-modality decoding, introducing additional cross-attention via XAttnDecoder to enhance intra- and inter-modality representations.
Table 1 summarizes the key architectural stages.
| Stage | Operation | Token Shape |
|---|---|---|
| Patch Embedding | Conv2d per modality, add | |
| Early Fusion | XAttnEncoder (replaces block 1) | |
| Encoder | 0 ViT blocks (self-attention+MLP) | 1 |
| Decoder Fusion | XAttnDecoder pre-decoder per modality | 2 |
2. Cross-Attention Mechanism and Fusion Operators
The core of MLFA is its cross-attention (CA) subroutine, instantiated as:
3
where 4, 5, and 6 denote learned linear projections per head (with 7, 8 for 9 heads). This bi-directional mechanism enables each stream to query and integrate features from the other.
For fusion, the operator is defined as:
0
The XAttnEncoder combines both the direct concatenation of input streams and their mutual cross-attention outputs. This aggregated token stream is refined with a two-layer MLP using GELU activations.
In the decoder, feature-level fusion augments each modality's latent with cross-attended features from its counterpart:
1
A separate XAttnDecoder refines these cross-attended latents before passing them to lightweight modality-specific decoders.
3. Masking Strategies and Data Handling
MLFA employs a masking ratio of 2 on the patch tokens, occurring before patch embedding. Two masking strategies are used:
- Independent masking: Randomly sample 3 of tokens to drop independently in each modality, encouraging discovery of both intra- and inter-modal correlations.
- Consistent masking: Apply the same mask indices across both modalities to facilitate cross-modal alignment.
Only the unmasked tokens are transformed via 4, 5, 6 projections and participate in cross-attention; masked tokens are omitted from encoder input as in classical MAE frameworks.
4. Layer-Wise Fusion Protocol
MLFA restricts fusion to two specific locations in the network:
- Early fusion: Performed solely in the first encoder block via XAttnEncoder; no fusion occurs in intermediate layers, which use standard ViT self-attention and MLP blocks.
- Decoder fusion: Executed once pre-decoder per modality using XAttnDecoder, followed by an MLP for further token refinement.
Post-fusion, a learned 7 token is appended at the encoder output.
5. Training Objective and Optimization Details
The objective is a per-modality masked reconstruction loss:
8
where 9 denotes the per-modality lightweight transformer decoder, and 0 is the number of masked patches in modality 1. The total loss is the sum 2, with no additional weighting or contrastive terms.
Optimization follows AdamW with a batch size of 200, a peak learning rate of 3 (warmed up over 10 epochs), cosine decay, and standard ViT/MAE weight decay (e.g. 0.05). Pretraining is performed for 100 epochs on 354k BigEarthNet-MM images, optionally initializing from ImageNet-pretrained weights (Chan-To-Hing et al., 2024).
6. Implementation Considerations
MLFA adapts the MAE framework as follows:
- Backbone: Utilizes standard ViT-Base defaults, e.g., 4, 5, 6.
- Patch size: Commonly 7, yielding 8 tokens.
- Decoder: Lightweight, per-modality transformer, depth 9, hidden dim 0, 1 heads.
- Fusion point frequency: Fusion is explicitly non-repetitive in the encoder, occurring only in the first block and once per decoder.
This architectural and procedural approach is tailored to multimodal data with substantial domain differences, such as SAR and optical satellite imagery.
7. Significance and Comparative Performance
Empirical results demonstrate that MLFA within the Fus-MAE framework achieves performance on par with or exceeding contrastive learning-based fusion strategies when applied to SAR-optical paired data, while addressing the limitations of augmentation-heavy protocols. The cross-attention-based fusion of MLFA offers an alternative to contrastive alignment, enabling masked modeling to bridge disparate sensor domains efficiently. The framework is shown to outperform other masked autoencoder formulations even when trained on larger datasets (Chan-To-Hing et al., 2024).