- The paper introduces a transformer-based architecture that generates task-specific weights and employs dynamic loss balancing for all-in-one medical image restoration.
- It demonstrates state-of-the-art performance on PET synthesis, CT denoising, and MRI super-resolution, achieving higher PSNR, SSIM, and lower RMSE compared to baselines.
- It effectively addresses task interference and imbalance through dedicated task representation extraction and sample-level adaptive loss scaling.
Introduction
The proliferation of modality-specific models has advanced medical image restoration (MedIR), but these models are hindered by poor cross-task generalization, redundancy in resource usage, and susceptibility to data scarcity. All-in-One approaches promise to overcome these limitations but must resolve fundamental challenges: task interference (gradient conflicts in shared parameters across tasks) and task imbalance (unequal optimization trajectories due to varying task learning difficulties). The "TAT: Task-Adaptive Transformer for All-in-One Medical Image Restoration" (2512.14550) directly addresses these challenges by introducing a transformer-based architecture with explicit task-adaptivity in both parameterization and loss balancing.
Figure 1: The TAT architecture integrates a Transformer encoder-decoder with task-adaptive specialization modules for end-to-end multi-task MedIR.
Methodology
TAT employs a multi-level, U-shaped transformer network comprising a three-stage transformer encoder and a four-stage decoder built around Weight-Adaptive Transformer Blocks (WATBs). A dedicated Task Representation Extraction Network (TREN) processes latent features (with stopped gradients) to yield a low-dimensional but task-discriminative representation vector Z∈Rd. This vector conditions task adaptation mechanisms throughout the decoder, inducing task-specific behavior without sacrificing architectural amortization.
Task-Adaptive Weight Generation
TAT innovates upon standard transformer sharing by generating depthwise convolutional weights specific to each task, circumventing the gradient contention that arises from multitask learning on a shared parameter set. The task-adaptive weights are computed as:
WG=Reshape(MLP(Z)),
with W=WS+λWG for each depthwise convolution, where WS is the shared backbone weight and λ is a learnable scaling factor. By leveraging depthwise convolutions, the parameter generation remains computationally tractable (O(C)), and the integration with transformer blocks ensures effective local-global feature fusion, which is critical in diverse MedIR tasks.
Task-Adaptive Loss Balancing
Beyond standard task-level uncertainty weighting, TAT introduces a sample-level adaptive loss balancing strategy. For an input (ILQ,IHQ,I^HQ), three L1 losses encoding input-target, input-prediction, and prediction-target discrepancies are pooled and passed through an MLP (with gradients detached from the main model) to generate a sample-specific scaling parameter σ:
σ=MLP([L1(ILQ,IHQ),L1(ILQ,I^HQ),L1(I^HQ,IHQ)]).
The loss is then scaled for each sample as
Loss=2σ21L1(I^HQ,IHQ)+logσ,
yielding dynamic attenuation for hard/easy samples and allowing the network to remain responsive to sample-level imbalance within each task. This contrasts with prior work that only modulates loss terms globally per task.
Empirical Results
TAT is evaluated on three canonical MedIR tasks: PET synthesis, CT denoising, and MRI super-resolution, using standardized splits and metrics (PSNR, SSIM, RMSE). The method is benchmarked both as a task-specific model and as an All-in-One model against state-of-the-art task and multitask baselines.
Numerical Outcomes: In both task-specific and multitask regimens, TAT achieves the highest PSNR, SSIM, and lowest RMSE across all restoration tasks. Notably, in All-in-One settings, it exceeds the current SOTA AMIR [yang2024amir] by consistent and statistically significant margins, demonstrating effective mitigation of task interference and imbalance.
Figure 2: Qualitative comparison: TAT yields superior perceptual restoration across PET, CT, and MRI tasks, preserving fine structural details and suppressing artifacts robustly.
Ablation studies validate both core innovations: removing task-adaptive weight generation or using non-sample-adaptive loss balancing leads to measurable performance degradation. Crucially, attempting to generate all weights (rather than restricting to depthwise convs) introduces computational overhead without further gains, underlining the efficacy of TAT's design constraints.
Theoretical and Practical Implications
Addressing Task Interference
By dynamically generating task-specific parameters conditioned on latent task representations, TAT avoids destructive gradient interference in shared multitask settings, a challenge identified but not resolved by prior approaches (e.g., routing networks or naive mixture-of-experts). This paradigm can be extended to arbitrarily diverse MedIR tasks, given the architecture's modular and scalable adaptation strategy.
Handling Task Imbalance
Sample-level adaptive loss reweighting—conditioned not on task identity but on input-output and reconstruction statistics—enables fine-grained, automated regularization even in highly imbalanced imaging datasets. This directly addresses a common limitation in joint-modality clinical workflows, where different modalities and degradations coexist in the same dataset.
Future Directions
TAT's design is architecture-agnostic; both the weight generation and sample-adaptive balancing modules can be integrated with more recent transformer variants (e.g., sparse/memory-efficient models [yang2024rat, yang2024restore_rwkv, guo2025mambair]), and could facilitate development of unified, real-world-deployable MedIR toolkits. Moreover, insights from adaptive parameterization and loss scaling may inform general multi-task learning outside the MedIR context, including multimodal and multitask scene understanding.
Conclusion
TAT presents a principled, empirically validated contribution to unified medical image restoration by incorporating explicit dynamic specialization in both parameter generation and optimization. The architecture achieves robust SOTA performance across diverse MedIR tasks, and its components—task-adaptive weight generation and loss balancing—are generalizable for future adaptation to novel and more sophisticated network backbones. The work substantiates the value of dynamic modularity in multitask transformers and introduces scalable directions for clinical and research deployment in complex multi-modal imaging environments.