Abstract
This work analyzes the training dynamics of Image Restoration (IR) Transformers and uncovers a critical yet overlooked issue: conventional LayerNorm (LN) drives feature magnitudes to diverge to a million scale and collapses channel-wise entropy. We analyze this in the perspective of networks attempting to bypass LN's constraints that conflict with IR tasks. Accordingly, we address two misalignments between LN and IR: 1) per-token normalization disrupts spatial correlations, and 2) input-independent scaling discards input-specific statistics. To address this, we propose Image Restoration Transformer Tailored Layer Normalization i-LN, a simple drop-in replacement that normalizes features holistically and adaptively rescales them per input. We provide theoretical insights and empirical evidence that this simple design effectively leads to both improved training dynamics and thereby improved performance, validated by extensive experiments.
The Hidden Instability in IR Transformers
Vision Transformers have become the standard for Image Restoration (IR) tasks like super-resolution, denoising, and deraining. However, a bizarre and overlooked phenomenon exists in their training dynamics: the magnitudes of intermediate features in these networks diverge dramatically, reaching scales up to a million ($10^6$). Simultaneously, channel-wise entropy collapses, indicating that a few specific channels completely dominate the network's activations.
This root cause is traced back to a fundamental mismatch between IR tasks and conventional LayerNorm (LN). LN normalizes data on a per-token basis, which destroys the spatial relationships between pixels—a critical requirement for low-level image restoration. Furthermore, LN maps features into a unified space, discarding input-dependent statistics (like variance) that the network needs to faithfully reconstruct specific images. To bypass these constraints, the network essentially "fights" LN by generating massive feature values to preserve information through the normalization layer.
Methodology: Introducing i-LN
To fix this misalignment, we propose Image Restoration Transformer Tailored Layer Normalization (i-LN), a drop-in replacement for standard LN. It consists of two key modifications:
- Spatial Holisticness (LN*): Instead of normalizing each token independently, i-LN computes the mean and standard deviation across the entire spatio-channel dimension of the input feature map. This holistic approach preserves inter-pixel spatial structures up to a global scale.
- Input-Adaptive Rescaling: To recover the input-dependent statistics lost during normalization, i-LN adaptively rescales the outputs of the Attention and Feed-Forward Network (FFN) layers. It multiplies these outputs by the standard deviation computed during the preceding normalization step, restoring range flexibility to the features.
Experimental Setup
The models were trained and evaluated on standard image restoration benchmarks including DF2K for super-resolution (SR), denoising (DN), and JPEG artifact removal (CAR), and Rain13K for image deraining (DR). Evaluation was conducted across diverse datasets such as Set5, BSD100, Urban100, and Manga109. Robustness was further tested using the complex Real-ESRGAN degradation pipeline.
Key Insights and Results
The "Compensatory Shortcut" of LN
Standard IR Transformers avoid crashing despite feature magnitudes hitting a million because the network learns extreme affine bias parameters in the final LN layer. These biases perfectly align with the abnormal channel activations to cancel them out. This is a fragile "hack" rather than a fundamental fix, leaving the model prone to instability.
Training Stability and Performance
i-LN consistently outperformed vanilla LN and other normalization schemes (RMSNorm, LayerScale, InstanceNorm, BatchNorm) across all tested tasks. For example, on x4 Super-Resolution (Urban100 dataset using the HAT backbone), i-LN achieved a PSNR of 27.17 compared to LN's 26.55. Feature magnitudes dropped from a massive $\sim 5.8 \times 10^6$ to $\sim 1.2$, matching a healthy standard normal distribution.
Hardware Efficiency and Low-Precision Inference
Because standard LN causes feature values to explode, running these models in half-precision (fp16) on edge devices causes overflow errors, resulting in visual artifacts like black dots. By keeping features bounded around a scale of 1, i-LN makes Transformer deployment inherently safe for efficient, low-precision hardware (fp16, int8, and int4) with near-zero fidelity loss.
Conclusion and Future Work
While i-LN is highly effective for standard IR Transformers, its impact varies in architectures that use Permuted Self-Attention (like SRFormer). Because these architectures reshape multi-pixel features into a single token, standard per-token LN implicitly acts in a somewhat spatially holistic manner. Exploring the deeper relationship between feature reshaping operations and normalization schemes remains a promising direction for future architectural design.
Summary updated