Universal Hypernetworks for Arbitrary Models
Organizations: Independent Researcher.
Abstract
Conventional hypernetworks are typically engineered around a specific base-model parameterization, so changing the target architecture often entails redesigning the hypernetwork and retraining it from scratch. We introduce the Universal Hypernetwork (UHN), a fixed-architecture generator that predicts weights from deterministic parameter, architecture, and task descriptors. This descriptor-based formulation decouples the generator architecture from target-network parameterization, so one generator can instantiate heterogeneous models across the tested architecture and task families. Our empirical claims are threefold: (1) one fixed UHN remains competitive with direct training across vision, graph, text, and formula-regression benchmarks; (2) the same UHN supports both multi-model generalization within a family and multi-task learning across heterogeneous models; and (3) UHN enables stable recursive generation with up to three intermediate generated UHNs before the final base model. Our code is available at https://github.com/Xuanfeng-Zhou/UHN.
Figures & tables
| Task type | Dataset | Model | #Params (Direct) | #Params (UHN) | Acc. (Direct) | Acc. (UHN) |
|---|---|---|---|---|---|---|
| Image | MNIST | MLP | 118,282 | 158,613 | ||
| Image | MNIST | CNN-8 | 74,762 | 158,613 | ||
| Image | CIFAR-10 | CNN-20 | 269,034 | 612,117 | ||
| Graph | Cora | GCN | 92,231 | 612,117 | ||
| Graph | CiteSeer | GCN | 237,446 | 612,117 | ||
| Graph | PubMed | GCN | 32,259 | 612,117 |
| #Params | Acc. | |||||||
|---|---|---|---|---|---|---|---|---|
| Model | Direct | HA | Chunked | UHN | Direct | HA | Chunked | UHN |
| CNN-20 | 269,034 | 619,306 | 625,480 | 612,117 | ||||
| CNN-32 | 463,018 | 635,546 | 627,592 | 612,117 | ||||
| CNN-44 | 657,002 | 651,786 | 629,640 | 612,117 | ||||
| CNN-56 | 850,986 | 668,026 | 631,688 | 612,117 | ||||
| Model statistics | Acc. | |||||
|---|---|---|---|---|---|---|
| Model family | #Models | Avg. #Params | Max #Params | UHN #Params | Seen | Unseen |
| CNN Mixed Depth | 100 | 366,995 | 463,018 | 663,151 | ||
| CNN Mixed Width | 500 | 624,987 | 1,072,586 | 663,151 | ||
| CNN Mixed Depth Width | 1000 | 734,206 | 1,372,110 | 663,151 | ||
| Transformer Mixed | 1000 | 523,650 | 1,086,212 | 663,151 | ||
| Task type | Dataset | Model | Perf. (Direct) | Perf. (UHN Single-task) | Perf. (UHN Multi-task) |
|---|---|---|---|---|---|
| Image | MNIST | MLP | |||
| Image | CIFAR-10 | CNN-44 | |||
| Graph | Cora | GCN | |||
| Graph | PubMed | GAT | |||
| Text | AG News | Transformer-2L | |||
| Formula (RMSE) | kv | KAN-g5 |
| Setting | Acc. |
|---|---|
| Direct training | |
| UHN (no recursion) | |
| UHN rec. ( ) | |
| UHN rec. ( ) | |
| UHN rec. ( ) |
Appendix figures & tables26 assets
Supplementary material from the paper’s appendix.
Appendix
| Idx | Field | Description |
|---|---|---|
| 0 | layer_idx | Layer index. |
| 1 | layer_type | Layer type (categorical). |
| 2 | param_type | Parameter type within the layer (categorical). |
| 3 | out_idx | Output index / output channel / output embedding channel. |
| 4 | in_idx | Input index / input channel / input embedding channel. |
| 5 | kernel_h_idx | Convolution kernel height index ( coordinate). |
| Idx | Field | Description |
|---|---|---|
| 0 | model_type | Model family type (categorical). |
| 1 | num_layers | Number of layers. |
| 2 | cnn_stage_num | Number of stages (CNN). |
| 3 | num_encoders | Number of encoder blocks (Transformer ( Vaswani et al., 2017 ) ). |
| 4 | num_structure_freqs | Number of frequencies for structure/task Fourier features ( Tancik et al., 2020 ) (Recursive UHN). |
| 5 | num_index_freqs | Number of frequencies for index Fourier features (Recursive UHN). |
| Idx | Field | Description |
|---|---|---|
| 0 | layer_idx | Layer index. |
| 1 | layer_type | Layer type (categorical). |
| 2 | bias_type | Bias option (categorical). |
| 3 | norm_type | Normalization option (categorical). |
| 4 | shortcut_type | Shortcut ( He et al., 2016 ) option (categorical). |
| 5 | output_size | Output dimension / channels / embedding dim. |
| Idx | Field | Description |
|---|---|---|
| 0 | task_type | Task type (categorical). |
| 1 | dataset_type | Dataset type (categorical). |
| Cora | CiteSeer | PubMed | |
|---|---|---|---|
| Nodes | 2708 | 3327 | 19717 |
| Edges | 5429 | 4732 | 44338 |
| Features | 1433 | 3703 | 500 |
| Classes | 7 | 6 | 3 |
| Function | Model (#Params) | RMSE (Direct) | RMSE (UHN) |
|---|---|---|---|
| Jacobian elliptic functions (ellipj) | KAN-g5 (407) | ||
| Incomplete elliptic integral of the first kind (ellipkinc) | KAN-g5 (254) | ||
| Incomplete elliptic integral of the second kind (ellipeinc) | KAN-g5 (254) | ||
| Bessel function of the first kind (jv) | KAN-g10 (364) | ||
| Bessel function of the second kind (yv) | KAN-g10 (364) | ||
| Modified Bessel function of the second kind (kv) | KAN-g5 (254) |
| Task | Dataset | Model | |||||
|---|---|---|---|---|---|---|---|
| Image | MNIST | MLP | 100 | ||||
| Image | MNIST | CNN-8 | 50 | ||||
| Image | CIFAR-10 | CNN-20 | 200 | ||||
| Text | AG News | Transformer-2L | 50 | ||||
| Text | IMDB | Transformer-1L | 100 | ||||
| Graph | All | All | 200 |
| Task | Dataset | Model | ||||
|---|---|---|---|---|---|---|
| Image | MNIST | MLP | 100 | 100 | ||
| Image | MNIST | CNN-8 | 200 | 100 | ||
| Image | CIFAR-10 | CNN-20 | 0 | 0 | 800 | |
| Graph | Cora | GCN | 200 | 400 | ||
| Graph | CiteSeer | GCN | 50 | 200 | ||
| Graph | PubMed | GCN | 200 | 200 |
| Task | Dataset | Model | ||
| Image | MNIST | MLP | ||
| Image | MNIST | CNN-8 | ||
| Image | CIFAR-10 | CNN-20 | ||
| Graph | Cora | GCN | ||
| Graph | CiteSeer | GCN/GAT | ||
| Graph | PubMed | GCN |
| Task | Dataset | Model | ||
| Image | MNIST | MLP | 0.01 | 200 |
| Image | MNIST | CNN-8 | 0.005 | 50 |
| Image | CIFAR-10 | CNN-20 | 0.005 | 400 |
| Graph | Cora | GCN | 0.01 | 100 |
| Graph | CiteSeer | GCN | 0.005 | 100 |
| Graph | PubMed | GCN | 0.005 | 200 |
| Hypernetwork | grid | grid | Best | Best |
|---|---|---|---|---|
| HA | 0.002 | 800 | ||
| Chunked | 0.002 | 800 |
| Model family | |||||
|---|---|---|---|---|---|
| CNN Mixed Depth | 100 | 80 | 20 | 20 | 20 |
| CNN Mixed Width | 500 | 450 | 50 | 50 | 50 |
| CNN Mixed Depth Width | 1000 | 950 | 50 | 50 | 50 |
| Transformer Mixed | 1000 | 950 | 50 | 50 | 50 |
| Model family | |||||
|---|---|---|---|---|---|
| CNN Mixed Depth | 200 | ||||
| CNN Mixed Width | 200 | ||||
| CNN Mixed Depth Width | 200 | ||||
| Transformer Mixed | 50 |
| Model family | ||||
|---|---|---|---|---|
| CNN Mixed Depth | 12800 | 3200 | ||
| CNN Mixed Width | 12800 | 3200 | ||
| CNN Mixed Depth Width | 3200 | 3200 | ||
| Transformer Mixed | 8000 | 100 |
| Task | Dataset | Model | Guardrail (val) |
|---|---|---|---|
| Image | MNIST | MLP | 0.95 |
| Image | CIFAR-10 | CNN-44 | 0.85 |
| Graph | Cora | GCN | 0.75 |
| Graph | PubMed | GAT | 0.75 |
| Text | AG News | Transformer-2L | 0.85 |
| Formula | kv | KAN-g5 |
| Grid ( ) | ||||
|---|---|---|---|---|
| Selected | 500 | 200000 |
| Grid ( ) | ||||
|---|---|---|---|---|
| Selected | 4000 | 30000 |
| Encoding type | #Params | Acc. |
|---|---|---|
| Raw | 68,629 | |
| Positional | 149,301 | |
| GFF | 612,117 |
| Value | #Params | Acc. | Value | #Params | Acc. | Value | #Params | Acc. |
|---|---|---|---|---|---|---|---|---|
| 256 | 135,445 | 32 | 156,117 | 0 | 545,045 | |||
| 512 | 203,541 | 64 | 299,925 | 1 | 578,581 | |||
| 1024 | 339,733 | 128 | 612,117 | 2 | 612,117 | |||
| 2048 | 612,117 | 256 | 1,334,805 | 3 | 645,653 | |||
| 4096 | 1,156,885 | – | – | – | – | – | – | |
| Model family | TSE | #Params | Seen Acc. | Unseen Acc. |
|---|---|---|---|---|
| CNN Mixed Width | w/ | 663,151 | ||
| CNN Mixed Width | w/o | 612,117 | ||
| Transformer Mixed | w/ | 663,151 | ||
| Transformer Mixed | w/o | 612,117 |
| Task | Dataset | Model | UHN perf. (multi-task, w/ TSE) | UHN perf. (multi-task, w/o TSE) |
|---|---|---|---|---|
| Image | MNIST | MLP | ||
| Image | CIFAR-10 | CNN-44 | ||
| Graph | Cora | GCN | ||
| Graph | PubMed | GAT | ||
| Text | AG News | Transformer-2L | ||
| Formula (RMSE) | kv | KAN-g5 |
| Model family | init | Seen Acc. | Unseen Acc. |
|---|---|---|---|
| CNN Mixed Width | w/ | ||
| CNN Mixed Width | w/o | ||
| Transformer Mixed | w/ | ||
| Transformer Mixed | w/o |
| Task | Dataset | Model | UHN perf. (multi-task, w/ init) | UHN perf. (multi-task, w/o init) |
|---|---|---|---|---|
| Image | MNIST | MLP | ||
| Image | CIFAR-10 | CNN-44 | ||
| Graph | Cora | GCN | ||
| Graph | PubMed | GAT | ||
| Text | AG News | Transformer-2L | ||
| Formula (RMSE) | kv | KAN-g5 |
Hypernetworks
Hypernetworks are neural networks that generate or modulate another model’s weights from task, input, or context information.
See all 62 papers