---
title: 'DiNAT-IR: Dilated Neighborhood Attention'
url: https://www.emergentmind.com/topics/dinat-ir
type: topic
---

# DiNAT-IR: Dilated Neighborhood Attention

Searching arXiv for DiNAT-IR context papers and related methods.
arxiv_search(query="DiNAT Restormer neighborhood attention image restoration", max_results=10)
Searching arXiv for related papers.
arxiv_search(query="DiNAT Restormer neighborhood attention image restoration", max_results=10)
DiNAT-IR is a Transformer-based architecture for image restoration that explores Dilated Neighborhood Attention (DiNA) as an alternative to conventional self-attention formulations for high-resolution low-level vision. Introduced in "DiNAT-IR: Exploring Dilated Neighborhood Attention for High-Quality Image Restoration" [2507.17892], it targets the efficiency–quality trade-off that arises when full spatial self-attention is applied to restoration tasks such as motion deblurring, defocus deblurring, deraining, and real-world denoising. The model retains the four-stage U-Net backbone of Restormer while replacing a purely channel-wise attention emphasis with a hybrid design that alternates Neighborhood Attention (NA) and DiNA and complements them with a Channel-Aware Module (CAM), with the stated goal of integrating global context without sacrificing pixel-level precision [2507.17892; 2111.09881].

## 1. Problem setting and design rationale

The starting point for DiNAT-IR is the observation that Transformers have become a dominant paradigm in image restoration because self-attention can model long-range dependencies, but the computational cost of self-attention limits scalability to high-resolution images [2507.17892]. Restormer addresses this by employing channel-wise self-attention, computing attention across channels instead of spatial dimensions. DiNAT-IR is motivated by the claim that, while this is effective, such an approach may overlook localized artifacts that are crucial for high-quality image restoration [2507.17892; 2111.09881].

DiNAT-IR therefore explores Dilated Neighborhood Attention as a middle ground between local precision and broader contextual aggregation. The paper states that DiNA balances global context and local precision by integrating sliding-window attention with mixed dilation factors, effectively expanding the receptive field without excessive overhead [2507.17892]. At the same time, its preliminary experiments indicate that directly applying this global-local design to the classic deblurring task hinders accurate visual restoration, primarily because local attention still constrains global context understanding [2507.17892]. The architectural response is to add a channel-aware module that supplies a lightweight global signal.

A central misconception addressed by the model design is that a high-level vision attention pattern can be transferred unchanged to restoration. DiNAT-IR explicitly reports that this direct transfer is inadequate for classic deblurring and requires channel-aware compensation [2507.17892]. This suggests that restoration imposes stricter requirements on pixel-level fidelity than the high-level tasks from which DiNA was originally motivated.

## 2. Network organization and backbone structure

DiNAT-IR inherits the four-stage U-Net backbone of Restormer [2507.17892; 2111.09881]. Each stage contains an encoder block that downsamples by a factor of 2 via strided convolution and a sequence of $N$ Dual Transformer Blocks, together with a decoder block that upsamples by a factor of 2 via pixel shuffle or transpose convolution and a matching sequence of Dual Transformer Blocks [2507.17892]. Skip-connections connect encoder features to decoder features at the same spatial resolution.

The basic computational unit is the Dual Transformer Block. Its internal order is: LayerNorm; a self-attention module, alternating NA and DiNA, in parallel with the Channel-Aware Module; element-wise multiplication to fuse the two branches; residual addition; LayerNorm; a Feed-Forward Network with GELU nonlinearity; and a second residual addition [2507.17892]. The paper further states that the number of Transformer blocks per stage and the hidden-channel width $C$ are kept the same as in Restormer, ensuring a comparable parameter count [2507.17892].

In verbal block-diagram form, the block operates as follows. Given input $X$, the self-attention branch produces $A(X)$, the CAM branch produces $M(X)$, and these outputs are fused as $A(X)\odot M(X)$ before the first residual path is applied. This is followed by normalization, a two-layer MLP-style FFN with hidden expansion, and a second residual path [2507.17892]. Architecturally, the design preserves the macro-organization of a restoration U-Net while changing the internal attention mechanism.

## 3. Dilated Neighborhood Attention

The DiNA component is defined for input features $X \in \mathbb{R}^{B\times C\times H\times W}$. After projection to queries, keys, and values,
$$
Q, K, V \in \mathbb{R}^{B\times d_k\times H\times W},
$$
the output at spatial position $i$ is
$$
y_i = \sum_{j\in\mathcal{N}_i^{(d)}} A_{ij}\cdot V_j,
$$
with attention weights
$$
A_{ij} = \operatorname{softmax}_{j\in\mathcal{N}_i^{(d)}}\left(\frac{Q_i\cdot K_j^T}{\sqrt{d_k}}\right),
$$
where the dilated neighborhood is
$$
\mathcal{N}_i^{(d)} = \{\, i + (a\cdot d, b\cdot d) \mid a,b \in \{-r,\ldots,+r\} \,\}.
$$
In DiNAT-IR, attention alternates between $d=1$ and a larger dilation, with example stage-wise pairs given as $\{1,36\}$ in stage 1, $\{1,18\}$ in stage 2, $\{1,9\}$ in stage 3, and $\{1,4\}$ in stage 4 [2507.17892].

The receptive-field argument is explicit. For window radius $r$ and dilation $d$, the effective side length is $(2r\cdot d + 1)$ [2507.17892]. By selecting a large $d$, DiNA samples a broad but sparse neighborhood while avoiding the quadratic token–token interaction cost of full self-attention.

The complexity comparison in the paper makes this trade-off concrete. Full global self-attention on $H\times W$ tokens costs
$$
O((HW)^2\cdot d_k),
$$
whereas DiNA with window radius $r$ costs
$$
O(HW\cdot (2r+1)^2\cdot d_k).
$$
Because $(2r+1)^2 \ll HW$ at high resolution, the paper characterizes the complexity as effectively linear in the number of pixels [2507.17892]. In the context of image restoration, the significance of this formulation is not merely lower asymptotic cost, but the attempt to preserve local detail sensitivity while expanding contextual support.

## 4. Channel-Aware Module and block-level fusion

The Channel-Aware Module is introduced to compensate for the limits of purely local or sparse spatial attention. The paper’s motivation is explicit: purely local attention can miss large-scale context, and purely sparse DiNA can overlook fine detail [2507.17892]. CAM therefore provides a lightweight global context signal through channel-wise gating and complements the spatial attention branch by reweighting channels based on a global descriptor.

For input $X \in \mathbb{R}^{B\times C\times H\times W}$, the global descriptor is computed by global average pooling:
$$
z = \operatorname{GAP}(X) \in \mathbb{R}^{B\times C\times 1\times 1},
$$
with
$$
z_{b,c,0,0} = \frac{1}{H\cdot W}\sum_{h,w} X_{b,c,h,w}.
$$
After flattening and transposing to $f(z)\in\mathbb{R}^{B\times 1\times C}$, a 1D convolution with kernel size 3 and a sigmoid generate
$$
s = \sigma(\operatorname{Conv1D}(f(z);\mathrm{kernel}=3)) \in \mathbb{R}^{B\times 1\times C}.
$$
This is reshaped back to $\mathbb{R}^{B\times C\times 1\times 1}$, broadcast to $\mathbb{R}^{B\times C\times H\times W}$, and used as
$$
\operatorname{CAM}(X) = s \odot \mathbf{1}_{H\times W}.
$$
The effect is a global, channel-wise gating mask [2507.17892].

Within the Dual Transformer Block, the fusion procedure is:
1) $X_0=\operatorname{LayerNorm}(X)$;  
2) $A=\operatorname{SA}(X_0)$, where SA is NA or DiNA;  
3) $M=\operatorname{CAM}(X_0)$;  
4) $X_1 = X + (A\odot M)$;  
5) $X_2=\operatorname{LayerNorm}(X_1)$;  
6) $F=\operatorname{FFN}(X_2)$;  
7) $Y=X_1+F$ [2507.17892].

This structure makes the CAM branch multiplicative rather than additive at the attention-fusion point. A plausible implication is that the model uses CAM primarily as a content-adaptive gain control over spatial attention responses, rather than as an independent feature stream.

## 5. Optimization protocol and evaluation regime

DiNAT-IR is evaluated on motion deblurring, defocus deblurring, deraining, and real-world denoising, using the following datasets and metrics [2507.17892]:

| Task | Dataset(s) | Metrics |
|---|---|---|
| Motion deblurring | GoPro, HIDE | PSNR, SSIM |
| Defocus deblurring | DPDD dual-pixel dataset | PSNR, SSIM, MAE |
| Deraining | Rain100H / Rain100L / Test2800 / Test1200 / Test100 | PSNR, SSIM |
| Real-world denoising | SIDD | PSNR, SSIM |

The optimization details are task-specific but consistent in optimizer design. For motion deblurring on GoPro, the model uses PSNR loss and AdamW with $\beta_1=0.9$, $\beta_2=0.999$, an initial learning rate decayed from $3e\!-\!4$ to $1e\!-\!6$ under cosine annealing over 600K iterations, followed by fine-tuning at $384^2$ patches with batch size 8 and learning rate $1e\!-\!4$ for 200K iterations [2507.17892]. For DPDD, it uses PSNR loss with the same AdamW schedule for 300K iterations, with a checkpoint at 290K. For Rain13K, it uses $L_1$ loss with the same optimizer and schedule for 300K iterations plus 100K fine-tuning at $384^2$. For SIDD, it uses PSNR loss with the same optimizer and schedule for 300K iterations, with a checkpoint at 220K [2507.17892].

Training uses standard patch-based random cropping and horizontal/vertical flips inherited from Restormer, and the paper does not emphasize additional bespoke augmentations [2507.17892]. This indicates that the reported behavior is primarily attributed to the attention-and-gating design rather than to an unusually specialized training pipeline.

## 6. Empirical behavior, limitations, and prospective directions

The main numerical comparison reported in the paper is against Restormer. On GoPro deblurring, DiNAT-IR achieves $33.80\,\mathrm{dB}/0.967$ SSIM, compared with Restormer’s $32.92\,\mathrm{dB}/0.961$; the parameter counts are $25.9\,\mathrm{M}$ and $26.1\,\mathrm{M}$ respectively, and the FLOPs are $45.6\,\mathrm{G}$ and $35.3\,\mathrm{G}$ [2507.17892]. On HIDE, it reports $31.57\,\mathrm{dB}/0.945$ versus Restormer’s $31.22\,\mathrm{dB}/0.942$. On the combined dual-pixel defocus benchmark, it reports $27.05\,\mathrm{dB}$ versus a best prior of approximately $27.04\,\mathrm{dB}$, with $\mathrm{MAE}=0.034$. On Rain100L, it reports $38.93\,\mathrm{dB}/0.977$ SSIM versus Restormer’s $38.99\,\mathrm{dB}/0.978$. On SIDD, it reports $39.89\,\mathrm{dB}/0.960$ SSIM versus Restormer’s $40.02\,\mathrm{dB}/0.960$ [2507.17892].

The qualitative discussion emphasizes sharper license-plate characters, cleaner text in deblurring, and crisper edges in rain and noise removal, as shown in Figures 1, 3, and 4 of the paper [2507.17892]. The stated interpretation is that alternating NA/DiNA plus global channel gating preserves both fine strokes and broad structure.

The strengths identified by the paper are that the method balances local precision with expanded receptive field at very low overhead, that CAM efficiently injects true global context without blowing up FLOPs, and that the model is competitive or superior across deblurring, defocus, deraining, and denoising while keeping a Restormer-comparable model size [2507.17892]. The limitations are equally explicit: ablation and architectural choices, including dilation pairs, were tuned primarily on GoPro; gains may vary on other data distributions; slight PSNR drop on some deraining benchmarks indicates room for task-specific tuning; and the hybrid NA–DiNA pattern requires selecting discrete dilation factors per stage [2507.17892].

The future directions named in the paper are learnable or dynamic dilation schedules, possibly conditioned on the input; richer channel-spatial cross-attention beyond simple global average pooling; extension of the ablation suite to more varied low-level and cross-modal tasks such as video restoration; and investigation of hybrid losses that combine perceptual and pixel terms [2507.17892]. Taken together, these directions position DiNAT-IR not as a final resolution of attention design for restoration, but as a specific demonstration that dilated local attention becomes materially more effective when paired with an explicit global channel-aware gating mechanism.

Source: https://www.emergentmind.com/topics/dinat-ir