Papers
Topics
Authors
Recent
Search
2000 character limit reached

WeightFormer: Dynamic Parameter Generation

Updated 4 July 2026
  • WeightFormer is a dual-concept framework: one variant dynamically predicts CNN layer weights for global visual modeling, while the other maps teacher parameters to a student model.
  • It leverages input-conditioned updates and reformulated attention to achieve linear-time complexity and improved scalability in vision tasks.
  • Empirical evaluations on ImageNet, COCO, ADE20K, and CIFAR demonstrate enhanced accuracy, throughput, and efficient ensemble compression compared to standard baselines.

WeightFormer is the name used for two different neural architectures in the arXiv literature. In "Linear-Time Global Visual Modeling without Explicit Attention" (He et al., 3 May 2026), WeightFormer denotes a vision backbone that replaces explicit attention with dynamic parameterization inside standard CNN layers, with the stated goal of achieving Transformer-level global modeling at linear complexity. In "Meta-Ensemble Parameter Learning" (Fei et al., 2022), WeightFormer denotes an encoder-only Transformer hypernetwork that predicts the parameters of a single student model from the parameters of multiple teacher models in one forward pass. The shared theme is weight prediction conditioned on structured context, but the two formulations operate at different levels: one predicts layer parameters from the current visual input, whereas the other predicts an entire student network from teacher checkpoints.

1. Two uses of the name

The term "WeightFormer" therefore refers to two separate research programs rather than a single canonical architecture.

Usage Core mechanism Primary setting
WeightFormer (He et al., 3 May 2026) Dynamic parameterization within CNN layers from compressed global descriptors Linear-time global visual modeling without explicit attention
WeightFormer (Fei et al., 2022) Encoder-only Transformer that predicts student weights from teacher parameters Meta-ensemble parameter learning

In the 2026 usage, the central object is an input-conditioned layer of the form W(X)=W0+ΔW(X)W(X)=W_0+\Delta W(X), where the current feature map determines a dynamic update to a static weight tensor. In the 2022 usage, the central object is a generator gθg_\theta that maps a set of teacher parameters [W(1),…,W(M)]\left[W^{(1)},\dots,W^{(M)}\right] to predicted student parameters W^s\widehat{W}_s. This suggests that the name is best understood as describing a design philosophy centered on parameter generation, while the actual modeling targets—global visual sequence modeling versus ensemble compression—remain distinct (He et al., 3 May 2026, Fei et al., 2022).

2. Attention as a dynamically parameterized MLP

The 2026 WeightFormer is built on a mathematical reformulation of attention. For an input X∈RN×dX\in\mathbb{R}^{N\times d}, canonical attention is written as

Q=XWQ,K=XWK,V=XWV,Q=XW_Q,\qquad K=XW_K,\qquad V=XW_V,

with

Y=softmax(QKT/d)V.Y=\mathrm{softmax}(QK^T/\sqrt{d})V.

For the ii-th token, this becomes

oi=softmax(qiKT/d)V.o_i=\mathrm{softmax}(q_iK^T/\sqrt{d})V.

The paper re-brackets this computation as a two-layer per-token MLP with softmax nonlinearity. The first layer computes

zi=(qiKT)/d,z_i=(q_iK^T)/\sqrt{d},

which is a linear map with weight gθg_\theta0 and no bias, followed by gθg_\theta1 across the hidden width. The second layer computes

gθg_\theta2

again as a linear map with weight gθg_\theta3 and no bias. The crucial point is that gθg_\theta4 and gθg_\theta5 are not static parameters: they are generated from the input by linear projections, so the effective network parameters are

gθg_\theta6

and the overall computation may be written as

gθg_\theta7

Within this view, attention’s global modeling power is attributed not to explicit token-wise aggregation as such, but to input-conditioned parameters that act as a compressed representation of global context. The formulation is exact rather than approximate: no approximation is required to establish the equivalence, and no explicit bias terms are necessary in the mapping. The same analysis also explains the quadratic cost of attention. Because gθg_\theta8 and gθg_\theta9, the corresponding dynamic MLP has width proportional to [W(1),…,W(M)]\left[W^{(1)},\dots,W^{(M)}\right]0, which yields the familiar [W(1),…,W(M)]\left[W^{(1)},\dots,W^{(M)}\right]1 compute and [W(1),…,W(M)]\left[W^{(1)},\dots,W^{(M)}\right]2 memory behavior (He et al., 3 May 2026).

3. WeightFormer for linear-time global visual modeling

On the basis of that reformulation, the 2026 WeightFormer instantiates dynamic parameterization inside CNN blocks by generating layer weights from fixed-shape global descriptors. The stated objective is to retain implicit global sequence modeling while avoiding construction of a quadratic [W(1),…,W(M)]\left[W^{(1)},\dots,W^{(M)}\right]3 attention matrix (He et al., 3 May 2026).

Global context is compressed by descriptors [W(1),…,W(M)]\left[W^{(1)},\dots,W^{(M)}\right]4 whose shape is decoupled from sequence length. Two forms are given. Pooling-based compression uses

[W(1),…,W(M)]\left[W^{(1)},\dots,W^{(M)}\right]5

for example by Global Average Pooling or Adaptive Average Pooling. Correlation-based compression uses

[W(1),…,W(M)]\left[W^{(1)},\dots,W^{(M)}\right]6

which captures second-order statistics independent of [W(1),…,W(M)]\left[W^{(1)},\dots,W^{(M)}\right]7.

For dynamic linear layers acting on channels, the model predicts an update [W(1),…,W(M)]\left[W^{(1)},\dots,W^{(M)}\right]8 and combines it with a static weight:

[W(1),…,W(M)]\left[W^{(1)},\dots,W^{(M)}\right]9

The paper studies several prediction strategies. Pooling-based prediction uses

W^s\widehat{W}_s0

Correlation-based variants include

W^s\widehat{W}_s1

W^s\widehat{W}_s2

W^s\widehat{W}_s3

and the Bilateral Activation form

W^s\widehat{W}_s4

Here W^s\widehat{W}_s5 denotes a pointwise nonlinearity such as SiLU, and the W^s\widehat{W}_s6 are learned, resolution-independent matrices.

For dynamic depthwise convolution layers, the model predicts a per-channel W^s\widehat{W}_s7 kernel update with W^s\widehat{W}_s8:

W^s\widehat{W}_s9

The strategies include global pooling-based prediction, spatially adaptive prediction using

X∈RN×dX\in\mathbb{R}^{N\times d}0

Amp-Dir stabilization with

X∈RN×dX\in\mathbb{R}^{N\times d}1

and a convolutional predictor in which X∈RN×dX\in\mathbb{R}^{N\times d}2 for a small two-layer X∈RN×dX\in\mathbb{R}^{N\times d}3 conv net with channel bottleneck and GELU.

The default WeightFormer block inserts dynamic parameterization sparsely: one dynamic block every third block, which corresponds to X∈RN×dX\in\mathbb{R}^{N\times d}4 dynamic blocks in a small model. Each dynamic block contains a dynamic DWC using Spatially Adaptive Prediction and an MLP whose first linear layer is dynamically parameterized through Bilateral Activation, while the second linear layer remains static. Standard CNN components, including normalization, residual connections, and pointwise convolutions, are retained; LayerNorm is used. Because parameter generation depends on fixed-shape summaries such as GAP, AAP, or X∈RN×dX\in\mathbb{R}^{N\times d}5, the resulting complexity is X∈RN×dX\in\mathbb{R}^{N\times d}6 in compute and memory, with parameter generation cost X∈RN×dX\in\mathbb{R}^{N\times d}7 or X∈RN×dX\in\mathbb{R}^{N\times d}8 independent of X∈RN×dX\in\mathbb{R}^{N\times d}9 (He et al., 3 May 2026).

4. Empirical profile of the 2026 model

The 2026 WeightFormer is evaluated on ImageNet-1K classification, COCO 2017 detection and instance segmentation, ADE20K semantic segmentation, and class-conditional image generation on ImageNet-1K. The reported classification setup trains from scratch for 300 epochs with AdamW, initial learning rate Q=XWQ,K=XWK,V=XWV,Q=XW_Q,\qquad K=XW_K,\qquad V=XW_V,0, cosine decay, 20-epoch linear warm-up, weight decay Q=XWQ,K=XWK,V=XWV,Q=XW_Q,\qquad K=XW_K,\qquad V=XW_V,1, total batch size Q=XWQ,K=XWK,V=XWV,Q=XW_Q,\qquad K=XW_K,\qquad V=XW_V,2, and RandAugment, Mixup, CutMix, and Random Erasing on Q=XWQ,K=XWK,V=XWV,Q=XW_Q,\qquad K=XW_K,\qquad V=XW_V,3 RTX 3090 (He et al., 3 May 2026).

For ImageNet-1K classification, the reported results are: WeightFormer-T with Q=XWQ,K=XWK,V=XWV,Q=XW_Q,\qquad K=XW_K,\qquad V=XW_V,4M parameters and Q=XWQ,K=XWK,V=XWV,Q=XW_Q,\qquad K=XW_K,\qquad V=XW_V,5G FLOPs achieves Q=XWQ,K=XWK,V=XWV,Q=XW_Q,\qquad K=XW_K,\qquad V=XW_V,6 top-1, compared with DeiT-T at Q=XWQ,K=XWK,V=XWV,Q=XW_Q,\qquad K=XW_K,\qquad V=XW_V,7 with Q=XWQ,K=XWK,V=XWV,Q=XW_Q,\qquad K=XW_K,\qquad V=XW_V,8M and Q=XWQ,K=XWK,V=XWV,Q=XW_Q,\qquad K=XW_K,\qquad V=XW_V,9G; WeightFormer-S with Y=softmax(QKT/d)V.Y=\mathrm{softmax}(QK^T/\sqrt{d})V.0M and Y=softmax(QKT/d)V.Y=\mathrm{softmax}(QK^T/\sqrt{d})V.1G achieves Y=softmax(QKT/d)V.Y=\mathrm{softmax}(QK^T/\sqrt{d})V.2, compared with DeiT-S at Y=softmax(QKT/d)V.Y=\mathrm{softmax}(QK^T/\sqrt{d})V.3 and ConvNeXt-S iso. at Y=softmax(QKT/d)V.Y=\mathrm{softmax}(QK^T/\sqrt{d})V.4; WeightFormer-B with Y=softmax(QKT/d)V.Y=\mathrm{softmax}(QK^T/\sqrt{d})V.5M and Y=softmax(QKT/d)V.Y=\mathrm{softmax}(QK^T/\sqrt{d})V.6G FLOPs at Y=softmax(QKT/d)V.Y=\mathrm{softmax}(QK^T/\sqrt{d})V.7 achieves Y=softmax(QKT/d)V.Y=\mathrm{softmax}(QK^T/\sqrt{d})V.8, compared with ConvNeXt-B at Y=softmax(QKT/d)V.Y=\mathrm{softmax}(QK^T/\sqrt{d})V.9 and DeiT-B at ii0. Dynamic-strategy ablations show a static CNN baseline at ii1; Dynamic Linear 1 with Bilateral Activation at ii2; Dynamic DWC with Spatially Adaptive prediction at ii3; and the combined Dynamic Linear 1 plus Dynamic DWC configuration at ii4, which is identified as the best accuracy-efficiency trade-off.

The measured efficiency claims are central. At resolution ii5, WeightFormer-T reaches throughput ii6 img/s versus DeiT-T at ii7, and WeightFormer-S reaches ii8 img/s versus ConvNeXt-S iso. at ii9. At high resolution, however, the linear-scaling advantage becomes explicit: at oi=softmax(qiKT/d)V.o_i=\mathrm{softmax}(q_iK^T/\sqrt{d})V.0 (approximately oi=softmax(qiKT/d)V.o_i=\mathrm{softmax}(q_iK^T/\sqrt{d})V.1 tokens), WeightFormer achieves oi=softmax(qiKT/d)V.o_i=\mathrm{softmax}(q_iK^T/\sqrt{d})V.2 higher throughput and oi=softmax(qiKT/d)V.o_i=\mathrm{softmax}(q_iK^T/\sqrt{d})V.3 memory reduction versus DeiT on RTX 3090.

Downstream dense prediction results follow the same pattern. On COCO 2017 with Cascade Mask R-CNN and ViTDet-style backbone integration, WeightFormer-T reports oi=softmax(qiKT/d)V.o_i=\mathrm{softmax}(q_iK^T/\sqrt{d})V.4 oi=softmax(qiKT/d)V.o_i=\mathrm{softmax}(q_iK^T/\sqrt{d})V.5 versus DeiT-T oi=softmax(qiKT/d)V.o_i=\mathrm{softmax}(q_iK^T/\sqrt{d})V.6 and oi=softmax(qiKT/d)V.o_i=\mathrm{softmax}(q_iK^T/\sqrt{d})V.7 oi=softmax(qiKT/d)V.o_i=\mathrm{softmax}(q_iK^T/\sqrt{d})V.8 versus oi=softmax(qiKT/d)V.o_i=\mathrm{softmax}(q_iK^T/\sqrt{d})V.9, with total/backbone FLOPs zi=(qiKT)/d,z_i=(q_iK^T)/\sqrt{d},0G/zi=(qiKT)/d,z_i=(q_iK^T)/\sqrt{d},1G versus zi=(qiKT)/d,z_i=(q_iK^T)/\sqrt{d},2G/zi=(qiKT)/d,z_i=(q_iK^T)/\sqrt{d},3G. On ADE20K with UperNet, WeightFormer-T reports zi=(qiKT)/d,z_i=(q_iK^T)/\sqrt{d},4 mIoU against DeiT-T at zi=(qiKT)/d,z_i=(q_iK^T)/\sqrt{d},5, and WeightFormer-S reports zi=(qiKT)/d,z_i=(q_iK^T)/\sqrt{d},6 mIoU against DeiT-S at zi=(qiKT)/d,z_i=(q_iK^T)/\sqrt{d},7, again with reduced backbone FLOPs.

The generation experiments extend the claim beyond discriminative vision. On class-conditional ImageNet-1K generation, WeightFormer-S/2 reports FID zi=(qiKT)/d,z_i=(q_iK^T)/\sqrt{d},8 versus DiT-S/2 at zi=(qiKT)/d,z_i=(q_iK^T)/\sqrt{d},9 and DiG-S/2 at gθg_\theta00, while WeightFormer-B/2 reports FID gθg_\theta01 versus DiT-B/2 at gθg_\theta02 and DiG-B/2 at gθg_\theta03. Effective Receptive Field analysis further reports that static CNNs remain localized, whereas dynamic variants exhibit global ERFs after training. The ablation on dynamic block frequency also establishes a stability boundary: too many dynamic blocks, specifically gθg_\theta04, destabilize training, while the default gθg_\theta05 gives the best throughput-accuracy balance. The paper’s stated limitations are that the study focuses on vision, that deeper analysis of expressivity and inductive biases is needed, and that training stability requires careful normalization, gating, and sparse placement of dynamic blocks (He et al., 3 May 2026).

5. WeightFormer for meta-ensemble parameter learning

The 2022 WeightFormer addresses a different problem: replacing an ensemble of teacher models with a single student whose parameters are predicted directly from teacher checkpoints. The motivation is that ensembles improve performance and robustness but incur inference latency and memory that grow with the number of models gθg_\theta06, while conventional knowledge distillation requires retraining whenever the teacher set changes (Fei et al., 2022).

The standard KD objective is described as

gθg_\theta07

whereas meta-ensemble parameter learning replaces retraining with direct parameter prediction:

gθg_\theta08

The student gθg_\theta09 is then deployed directly.

Architecturally, the model is an encoder-only Transformer with 24 Transformer blocks, hidden size gθg_\theta10, 20 attention heads, and feed-forward size gθg_\theta11. Prediction proceeds layer by layer. For a student layer gθg_\theta12, WeightFormer forms tokens from all teachers’ parameters for that layer and prepends a special "[cross]" token. The Transformer encoder processes that sequence, decodes the relevant hidden states into gθg_\theta13, and propagates the hidden state at the "[cross]" position as the context token for layer gθg_\theta14. This mechanism is explicitly designed to capture both cross-teacher and cross-layer correlations.

Teacher parameters are tokenized by layer type. Convolutional kernels are sliced along the output-channel dimension and flattened into gθg_\theta15 tokens; fully connected layers use columns of the weight matrix as tokens; and self-attention layers in ViT-B/32 flatten Q/K/V/O into a weight sequence encoding all heads jointly. Biases and normalization parameters are treated like other parametric tensors through the same tokenization view. A layer-specific weight embedding dictionary gθg_\theta16 maps raw weight-token dimensions to gθg_\theta17 and back, while relative position embeddings index output channels or units within a layer and model-id embeddings distinguish teachers.

The training procedure combines weight-level pretraining and task-driven optimization. To stabilize learning, the model is first pretrained against a KD-trained student using

gθg_\theta18

optimized with SGD at learning rate gθg_\theta19. Main training uses a task loss

gθg_\theta20

plus shift consistency regularization. The consistency term is computed by running WeightFormer twice, once on the original teacher order and once on a cyclically shifted order, with different "weight cutoff" masks as feature-space dropout:

gθg_\theta21

The combined loss is

gθg_\theta22

with gθg_\theta23. Main training uses initial learning rate gθg_\theta24, decay by gθg_\theta25 every five epochs, checkpoint resampling every gθg_\theta26k steps, and early stopping at validation plateau. Once trained, the generator can produce a student for a new teacher set in one forward pass, after which serving uses only the student rather than the full ensemble (Fei et al., 2022).

6. Empirical profile of the 2022 model and comparative interpretation

The 2022 WeightFormer is evaluated on CIFAR-10, CIFAR-100, and ImageNet with VGG-11, ResNet-50, and ViT-B/32. The reported ensemble size is gθg_\theta27, and for each architecture a pool of 72 checkpoints is constructed, with 60 used to train WeightFormer and 12 for evaluation. The principal metrics are top-1 accuracy, top-5 accuracy, and Expected Calibration Error (Fei et al., 2022).

Across all reported settings, WeightFormer outperforms the single network and standard KD baseline, and the optional fine-tuned variant "WF*" often slightly exceeds the average ensemble. For VGG-11 on ImageNet, ACC-1 is reported as Single gθg_\theta28, Ensemble gθg_\theta29, KD gθg_\theta30, WF gθg_\theta31, and WF* gθg_\theta32; for ResNet-50 on ImageNet, Single gθg_\theta33, Ensemble gθg_\theta34, KD gθg_\theta35, WF gθg_\theta36, and WF* gθg_\theta37; for ViT-B/32 on ImageNet, Single gθg_\theta38, Ensemble gθg_\theta39, KD gθg_\theta40, WF gθg_\theta41, and WF* gθg_\theta42. Calibration follows the same pattern: for ResNet-50 on ImageNet, ECE is Single gθg_\theta43, Ensemble gθg_\theta44, KD gθg_\theta45, WF gθg_\theta46, and WF* gθg_\theta47.

The CIFAR results show the same trend. For example, with VGG-11 on CIFAR-100, ACC-1 is Single gθg_\theta48, Ensemble gθg_\theta49, KD gθg_\theta50, WF gθg_\theta51, and WF* gθg_\theta52; with ResNet-50 on CIFAR-10, ACC-1 is Single gθg_\theta53, Ensemble gθg_\theta54, KD gθg_\theta55, WF gθg_\theta56, and WF* gθg_\theta57. The paper also reports that a simple MLP regressor baseline underperforms WeightFormer, which is used as evidence that cross-layer and cross-teacher attentional aggregation matters for parameter prediction.

Ablations attribute performance gains to the specific architectural devices rather than to parameter regression in general. Removing cross-layer fusion or shift consistency reduces ACC-1 by up to approximately gθg_\theta58, and weight cutoff is also reported as helpful. The ViT-B/32 ImageNet example gives ACC-1 values of WF gθg_\theta59, gθg_\theta60Cross-layer gθg_\theta61, gθg_\theta62Shift gθg_\theta63, and gθg_\theta64Cutoff gθg_\theta65. Increasing the number of teachers improves predicted-student performance, and the paper notes that concatenating more teacher parameters yields gains with only marginal increases in learnable parameters because the encoder is shared.

The limitations are also explicit. The method assumes homogeneous teacher architectures: student and teachers share the same architecture, whether VGG-11, ResNet-50, or ViT-B/32. Cross-architecture teacher-student mapping is left to future work. The approach is not data-free, because training optimizes gθg_\theta66 on labeled data through the predicted student. Sensitivity to normalization and bias handling is not separately studied, and extreme shape differences may require extending the layer-specific embedding dictionary.

Taken together, the two WeightFormer lines clarify a recurring misconception. WeightFormer is not a single fixed architecture but a name attached to two parameter-generation frameworks with different operating regimes. One compresses global visual context into input-conditioned layer weights to obtain implicit global modeling without explicit attention; the other compresses an ensemble of teacher checkpoints into a single student model through Transformer-based weight prediction. The common technical motif is dynamic parameterization, but the empirical claims, computational trade-offs, and intended deployment scenarios are different (He et al., 3 May 2026, Fei et al., 2022).

Definition Search Book Streamline Icon: https://streamlinehq.com
References (2)

Topic to Video (Beta)

No one has generated a video about this topic yet.

Whiteboard

No one has generated a whiteboard explanation for this topic yet.

Follow Topic

Get notified by email when new papers are published related to WeightFormer.