---
title: Hierarchical Diffusion Transformers (HiT)
url: https://www.emergentmind.com/topics/hierarchical-diffusion-transformers-hit
type: topic
---

# Hierarchical Diffusion Transformers (HiT)

Hierarchical Diffusion Transformers (HiT) are diffusion-based Transformer architectures that organize visual computation hierarchically rather than maintaining a uniform full-resolution token sequence throughout generation. The term denotes two related design directions: an earlier convolution-free hierarchical Transformer generator for GANs, which assigns global dependency modeling to low-resolution stages and local rendering to high-resolution MLP stages [2106.07631], and a later pixel-space diffusion architecture that adaptively groups image tokens into compact, input-dependent representations, processes them with a bottleneck Transformer, and restores them through soft ungrouping [2611.22962]. More broadly, hierarchical diffusion Transformers address the computational and representational limitations of dense attention by allocating global modeling to compact representations while preserving fine-resolution information through local operators, skip pathways, or adaptive routing.

## 1. Conceptual foundations and terminology

A conventional Vision Transformer processes a sequence of image tokens at a fixed spatial granularity. If the sequence contains \(N\) tokens, standard global self-attention has quadratic complexity, approximately \(\mathcal{O}(N^2)\). This cost becomes substantial for high-resolution images, long videos, and dense prediction tasks. Hierarchical architectures reduce this burden by changing the token organization or interaction pattern across stages.

The hierarchical principle can be expressed as a scale-dependent allocation of computation:

\[
\text{global structural reasoning at compact scales}
+
\text{fine-detail synthesis at high resolutions}.
\]

In the GAN-oriented HiT, hierarchy is primarily geometric and representational. The generator begins with an \(8\times 8\) feature map, applies efficient attention at low resolutions, and progressively upsamples through resolutions such as

\[
8\rightarrow16\rightarrow32\rightarrow64\rightarrow128\rightarrow256.
\]

In the pixel-space diffusion HiT, hierarchy is adaptive and token-based. Image tokens are progressively grouped into a smaller number of learned group tokens, processed in a compact bottleneck, and then ungrouped to the original image-token positions. With two grouping stages, the standard sequence for a \(256\times256\) image with \(16\times16\) patches is

\[
256\rightarrow128\rightarrow64.
\]

These approaches share the objective of avoiding uniform full-resolution computation, but they implement hierarchy differently. The former uses predetermined resolution stages and scale-specific operators; the latter learns image- and timestep-dependent group memberships and group counts.

The term “Hierarchical Diffusion Transformer” is therefore not restricted to one attention mechanism. It describes an architectural family in which diffusion computation is distributed across multiple levels of spatial, token, semantic, or representational granularity.

## 2. Precursor: convolution-free hierarchical Transformer generation

The first HiT architecture was introduced as a convolution-free generator for high-resolution GAN image synthesis [2106.07631]. Its motivation was that convolutions efficiently exploit locality but expand their receptive field only gradually, whereas global self-attention directly models long-range relationships. However, full self-attention over an image with \(N=HW\) tokens requires an \(N\times N\) attention matrix and has complexity approximately

\[
\mathcal{O}(N^2).
\]

HiT addresses this cost through a division between low- and high-resolution stages. At low resolutions, it retains efficient sparse attention for spatial dependency modeling. At high resolutions, it removes self-attention and uses token-wise MLPs to synthesize local pixel-level detail. A cross-attention self-modulation mechanism provides every stage with access to a compact representation of the original latent code.

The generator maps a latent vector

\[
z\sim\mathcal{N}(0,I)
\]

to an initial \(8\times8\) feature map. A separate projection produces a compact spatial latent embedding \(Z\), also spatially organized at \(8\times8\) in the reported implementation. The same latent embedding is shared across generator stages. Each stage adds positional information, applies cross-attention to \(Z\), performs either multi-axis blocked self-attention or an MLP, upsamples the feature representation, and may produce an RGB contribution that is progressively accumulated.

Feature-map transitions use pixel shuffle. If

\[
X_l\in\mathbb{R}^{H\times W\times 4C'},
\]

then

\[
\operatorname{PixelShuffle}_{2\times2}(X_l)
\in\mathbb{R}^{2H\times2W\times C'}.
\]

The paper reports that pixel shuffle performed better than nearest-neighbor upsampling for principal feature-map transitions. Nearest-neighbor operations are used separately for progressively accumulating RGB outputs.

The generator contains no convolutional layers. Its principal operations are linear projections, positional embeddings, cross-attention, multi-axis blocked self-attention, MLPs, pixel shuffle, and linear RGB projections. The convolution-free designation applies to the generator; the discriminator remains ResNet-based.

## 3. Low-resolution global reasoning

### 3.1 Multi-axis blocked self-attention

At low resolutions, HiT partitions a feature map into non-overlapping \(b\times b\) blocks. For a feature map with dimensions \(H\times W\), the number of blocks is

\[
M=\frac{H}{b}\frac{W}{b},
\]

and each block contains

\[
N_b=b^2
\]

tokens. The blocked representation can be written as

\[
X\in\mathbb{R}^{M\times N_b\times C}.
\]

HiT computes two attention operations in parallel.

**Regional attention** operates within each block. Tokens attend to other tokens in the same local block, capturing local spatial relationships.

**Dilated attention** connects corresponding positions across different blocks. If \(i\) denotes a position within a block, the token at position \(i\) attends to position \(i\) in multiple spatially separated blocks. This creates a sparse, large-receptive-field interaction pattern analogous to dilated convolution.

The two outputs are concatenated across attention heads and projected. Approximately half of the query heads are assigned to regional attention and half to dilated attention. Keys and values are shared in the multi-query attention variant used by the implementation.

The central design choice is parallel multi-axis mixing: local within-block and long-range across-block interactions are computed in one attention layer rather than in separate or alternating layers.

### 3.2 Complexity

Blocked regional attention has complexity

\[
\mathcal{O}(HWb^2),
\]

while dilated attention has complexity

\[
\mathcal{O}\left(\frac{(HW)^2}{b^2}\right).
\]

HiT balances the two axes by selecting \(b\) such that

\[
b^2\approx\frac{HW}{b^2}.
\]

The resulting attention computation is summarized as \(S\) sequences of length \(S\), with

\[
\mathcal{O}(S\cdot S^2)
=
\mathcal{O}(N\sqrt{N}),
\]

where \(N=HW\). This is subquadratic but not strictly linear. The nearly linear behavior of the complete generator arises principally because this attention is restricted to low-resolution stages, whereas high-resolution stages remove self-attention entirely.

### 3.3 Normalization and attention variants

The general Transformer block uses positional embeddings, normalization, attention, an MLP, and residual connections. In the actual HiT implementation, batch normalization replaces layer normalization because it produced better FID and IS and stabilized training. Multi-query attention replaces conventional multi-head attention by sharing keys and values across query heads.

On ImageNet \(128\times128\), the reported comparison gives FID \(38.96\) and IS \(18.18\) for layer normalization, versus FID \(31.87\) and IS \(21.32\) for batch normalization. Multi-query attention has throughput \(75.33\) and FID \(31.87\), compared with throughput \(74.73\) and FID \(32.06\) for multi-head attention.

## 4. High-resolution synthesis and latent conditioning

At resolutions above approximately \(64\times64\), the GAN-oriented HiT removes self-attention and applies shared MLP transformations token-wise. For a feature map

\[
X_l\in\mathbb{R}^{H_l\times W_l\times C_l},
\]

the MLP cost is

\[
\mathcal{O}(H_lW_lC_lC_{\mathrm{hidden}}),
\]

which is linear in the number of spatial tokens and does not construct an \(N\times N\) attention matrix.

The high-resolution stage can be interpreted as a conditional function

\[
f(p;x),
\]

where \(p\) is a spatial coordinate or positional encoding and \(x\) is a feature condition inherited from earlier stages and the latent code. This connects the design to implicit neural representations, in which an image is represented as

\[
I(p)=f_\theta(p,z).
\]

HiT is not identical to earlier INR-GANs. Whereas INR-GANs commonly use hypernetworks to generate or modulate MLP weights, HiT conditions its high-resolution MLP stages with decoded hierarchical feature maps, positional encodings, and cross-attention to a latent embedding.

The architecture assumes that global structure, coarse shape, color, and long-range spatial dependencies can be decoded at low resolutions. High-resolution stages then synthesize local detail. Ablations report that adding more self-attention stages improves results at low resolutions, while self-attention above \(64\times64\) provides little apparent quality benefit and substantially worsens training and inference time.

Cross-attention is inserted at the beginning of every generator stage. The stage feature acts as the query, while the latent embedding and its positional encoding provide keys and values:

\[
Q=X_lW_Q,
\]

\[
K=(Z+P_Z)W_K,
\]

\[
V=(Z+P_Z)W_V.
\]

The resulting complexity is

\[
\mathcal{O}(N_lN_Z),
\]

where \(N_Z\ll N_l\). With a fixed compact latent sequence, this becomes effectively linear in the stage sequence length. Cross-attention therefore supplies a global latent-conditioning path even when high-resolution stages use only MLPs.

## 5. Adaptive token hierarchy in pixel-space diffusion

The later HiT architecture applies hierarchy directly to end-to-end pixel-space diffusion generation [2611.22962]. Pixel-space diffusion avoids a separately pretrained visual encoder but ordinarily maintains approximately one token per patch throughout the Transformer. This gives background and semantically important regions similar computational allocation and prevents deeper layers from operating on progressively more compact semantic representations.

The diffusion HiT uses an encoder–bottleneck–decoder structure. For \(J\) grouping levels, its token sequence follows

\[
N\rightarrow K_1\rightarrow K_2\rightarrow\cdots\rightarrow K_J
\rightarrow\cdots\rightarrow K_2\rightarrow K_1\rightarrow N,
\]

where \(N\) is the number of original image patches and \(K_\ell\) is the input-dependent number of groups at level \(\ell\).

The default ImageNet HiT-B/16 layout contains 18 Transformer blocks arranged as

\[
3/3/6/3/3.
\]

These correspond to full-resolution encoder blocks, intermediate-resolution encoder blocks, compact bottleneck blocks, intermediate-resolution decoder blocks, and full-resolution decoder blocks. The main HiT-XL/16 model has approximately \(959.5\) million parameters.

The computation proceeds through linear patch projection, full-resolution Transformer processing, learned grouping, compact group-token processing, soft ungrouping, skip fusion, a second grouping stage, symmetric decoding, and a final linear head predicting the clean image.

### 5.1 Learned affinity grouping

At grouping stage \(\ell\), contextualized features are represented as

\[
H=[h_1,\ldots,h_N]^\top\in\mathbb{R}^{N\times d}.
\]

Query and key projections are normalized:

\[
q_i=\operatorname{norm}(W_qh_i),
\qquad
k_i=\operatorname{norm}(W_kh_i).
\]

The symmetric affinity between tokens \(i\) and \(j\) is

\[
S_{ij}
=
\frac{1}{2}
\left(q_i^\top k_j+q_j^\top k_i\right).
\]

Average-linkage grouping begins with every token as its own group and repeatedly merges groups with the highest mean inter-group affinity. Merges whose affinity is at least a threshold \(\tau\) are retained. The number of resulting groups is not fixed and can vary across images, image contents, diffusion timesteps, and batch elements.

Because grouping is affinity-based rather than spatially constrained, spatially distant patches can be assigned to the same group. Reported visualizations include separated banana regions, repeated foliage, and disconnected car markings.

### 5.2 Soft pooling and ungrouping

Hard groups define the computational hierarchy, but hard grouping is not directly differentiable. HiT therefore constructs soft routing weights. For input token \(i\) and group \(G_g\),

\[
e_{ig}
=
\frac{1}{|G_g|}
\sum_{j\in G_g}S_{ij},
\]

and

\[
A_{ig}
=
\frac{\exp(e_{ig}/T_{\mathrm r})}
{\sum_{g'=1}^{K}\exp(e_{ig'}/T_{\mathrm r})}.
\]

The default routing temperature is \(T_{\mathrm r}=0.05\).

The pooling matrix is

\[
P_{ig}
=
\frac{A_{ig}}
{\sum_{j=1}^{N}A_{jg}},
\]

and compact group tokens are

\[
Z=P^\top H.
\]

Every input token can contribute softly to every group. This differs from averaging only the members of a hard partition. Ablations report that learned soft aggregation over all input tokens performs substantially better than hard-group-only pooling.

After compact Transformer processing,

\[
\widetilde{Z}=\mathcal{M}(Z),
\]

the representation is restored by

\[
R=A\widetilde{Z}.
\]

Skip fusion combines the ungrouped compact representation with pre-grouping features:

\[
\widetilde{H}
=
A\mathcal{M}(Z)+HW_\ell^\top,
\]

where \(W_\ell\) is initialized to the identity. The skip pathway preserves fine-grained information that may be lost during compact pooling.

### 5.3 Compression budget

HiT regulates the average retained token fraction over a batch rather than enforcing a fixed group count for every image. For target compression ratio \(r\), the retained fraction is

\[
\rho=\frac{1}{r}.
\]

If \(N_b\) is the number of input tokens for batch example \(b\) and \(K_b\) is the number of hard groups, the actual retained fraction is

\[
f_{\mathrm h}
=
\frac{\sum_bK_b}{\sum_bN_b}.
\]

A differentiable estimate uses the merge affinities:

\[
\widetilde{K}_b
=
N_b-\sum_{m=1}^{N_b-1}
\sigma\left(\frac{s_{b,m}-\tau}{T_{\mathrm b}}\right),
\]

with soft retained fraction

\[
f_{\mathrm s}
=
\frac{\sum_b\widetilde{K}_b}{\sum_bN_b}.
\]

The compression loss at stage \(\ell\) is

\[
\mathcal{L}_{\mathrm{comp}}^{(\ell)}
=
1+
\frac{(f_{\mathrm h}-\rho)(f_{\mathrm s}-\rho)}
{\rho(1-\rho)}.
\]

The total objective is

\[
\mathcal{L}
=
\mathcal{L}_{\mathrm{diff}}
+
\lambda\mathcal{L}_{\mathrm{comp}},
\]

with default \(\lambda=0.01\). The budget is aggregate: individual images and timesteps can use different numbers of groups.

## 6. Diffusion conditioning, sampling, and multimodal grouping

The pixel-space diffusion HiT follows a clean-image prediction formulation. Given clean image \(x\), Gaussian noise \(\epsilon\), and timestep \(t\in[0,1]\),

\[
x_t=tx+(1-t)\epsilon.
\]

The denoiser predicts \(x\), with diffusion loss

\[
\mathcal{L}_{\mathrm{diff}}
=
\mathbb{E}_{x,c,t,\epsilon}
\left[
\frac{
\operatorname{MSE}(f_\theta(x_t,t,c),x)
}{
\max(1-t,a_{\min})^2
}
\right],
\]

where \(a_{\min}=0.05\).

Class and timestep conditioning is introduced as tokens rather than through adaptive layer normalization. For ImageNet, the model uses eight class-context tokens and one timestep token. These tokens bypass grouping and ungrouping and are excluded from the compression budget.

At inference, grouping is recomputed from the current noisy input, so the hierarchy can change throughout denoising. HiT additionally uses group guidance, which treats group capacity as a controllable axis alongside ordinary conditional guidance. Conditional and unconditional branches may use different group-count multipliers. For the reported ImageNet result, group guidance uses scale \(s=2.6\), conditional multipliers \((1.2,1)\), and timestep-dependent unconditional multipliers. Sampling uses 50 Heun steps followed by a final Euler step and a timestep-grid shift \(k=1.7\).

For text-to-image generation, image and caption tokens are grouped jointly after outer-stage processing. A frozen FLAN-T5-Large text encoder supplies caption tokens with sequence length 256. Groups may contain image features, text features, or both. The same affinity router operates in the shared representation space, allowing caption words to associate with image patches depicting corresponding concepts without word–region annotations.

The reported text-to-image HiT-B/16 model has approximately \(0.25\) billion denoiser parameters and requires \(139.4\) GFLOPs per forward pass. It obtains an average benchmark score of \(65.93\) across five reported benchmarks, exceeding UniLiP-3B’s \(65.76\), while using approximately \(6\times\) fewer denoiser parameters and \(3\times\) fewer forward FLOPs.

## 7. Applications, results, and qualifications

The GAN-oriented HiT demonstrated convolution-free high-resolution image synthesis. It reported FID \(30.83\) and IS \(21.64\) on unconditional ImageNet \(128\times128\), and FID \(2.95\) on FFHQ \(256\times256\). On FFHQ \(256\times256\), HiT-B reported FID \(2.95\) with throughput \(52.09\) images per second, while HiT-L reported FID \(2.58\) with throughput \(20.67\) images per second on a single Tesla V100. At \(1024\times1024\), HiT remained competitive but did not surpass StyleGAN2: FFHQ FID was \(6.37\) versus \(4.41\), and CelebA-HQ FID was \(8.83\) versus \(5.17\).

The diffusion HiT reported FID \(1.48\) on ImageNet \(256\times256\). At 600 epochs, HiT-XL/16 achieved FID \(1.48\), compared with FID \(1.86\) for JiT-H/16. The paper reports comparable generation quality to JiT using approximately \(40\%\) of its cumulative training FLOPs. In a controlled 80-epoch scaling study, HiT-B, HiT-L, and HiT-XL achieved FIDs \(6.61\), \(4.16\), and \(3.64\), respectively, compared with \(10.37\), \(4.85\), and \(4.39\) for corresponding JiT models.

The reported ablations indicate that adaptive grouping contributes beyond token reduction alone. A fixed spatial grouping control with the same average token populations achieved FID \(7.11\), whereas adaptive learned grouping achieved FID \(6.61\). The best compression configuration was a progressive two-stage \(2\times2\) hierarchy, with token counts

\[
256\rightarrow128\rightarrow64.
\]

More aggressive one-shot compression, excessive compression, or allocating too much depth to the deepest bottleneck degraded FID.

Several qualifications apply. Grouping is not exactly differentiable: hard tree construction and threshold decisions are treated as fixed during backpropagation, while gradients pass through soft pooling, soft ungrouping, and the differentiable group-count estimate. Pooling is lossy, making skip connections important. Routing introduces affinity-computation overhead and requires threshold calibration. Nominal GFLOPs are based on target group counts, whereas actual inference cost varies with image content and timestep.

The semantic interpretation of the groups is emergent rather than supervised. Visualizations suggest object, object-part, texture, and cross-modal organization, but the model is not trained with segmentation or region-level labels. These groups therefore should not be interpreted as guaranteed semantic segmentation.

Hierarchical diffusion Transformers are best understood as a family of scale-adaptive generative architectures rather than a single canonical model. The GAN-oriented HiT uses low-resolution multi-axis attention, high-resolution MLP rendering, and cross-attention latent self-modulation. The pixel-space diffusion HiT learns adaptive affinity-based token grouping, compact bottleneck processing, soft ungrouping, skip fusion, and group-guided sampling. Their common architectural premise is that global structure should be modeled through compact, information-rich representations, while high-resolution computation should be restricted to operations whose cost scales more favorably with the number of tokens.

Source: https://www.emergentmind.com/topics/hierarchical-diffusion-transformers-hit