
HyperNetwork_Ha
1,722 ops97.9K params
One small network writes the weights of another: static layer embeddings for convnets, a HyperLSTM for recurrent nets.
21 operations Checked
Click or tap a spot to read it up close. Scroll or drag inside the diagram to move through it. Zoom with + and − or Ctrl and scroll. Press 0 for the whole graph. Swipe inside the diagram to move through it. Use + and − to zoom.
The file opened in a new tab. Use your browser's Save command there to keep it.
The diagram is a drawing of a TorchLens trace of the source code. It contains no code or weights.
This is the static hypernetwork: for each layer j the hypernetwork receives a layer embedding z_j as input and predicts that layer's convolution kernel K_j, through a two-layer linear network.
About this model's family
A hypernetwork is one network used to generate the weights for another network. The authors frame it with an analogy from nature, the relationship between a genotype, the hypernetwork, and a phenotype, the main network, and note that while hypernetworks are reminiscent of HyperNEAT in evolution, theirs are trained end-to-end with backpropagation and are usually faster. The main network behaves like any usual neural network, mapping raw inputs to targets, whereas the hypernetwork takes a set of inputs that describe the structure of the weights and generates the weight for that layer.
The paper treats convolutional networks and recurrent networks as two ends of a spectrum, with recurrent networks imposing weight-sharing across layers and convolutional networks enjoying the flexibility of no weight-sharing at the cost of redundant parameters when deep. Hypernetworks are a form of relaxed weight-sharing that strikes a balance between the two ends. In the static form, aimed at deep convolutional networks, the hypernetwork receives a layer embedding z_j for each layer j and predicts that layer's kernel matrix K_j. In the dynamic form, a recurrent network generates weights for another recurrent network so that the weights can vary across many timesteps, and for memory's sake the practical version only scales the rows of a weight matrix by a weight scaling vector rather than building the whole matrix from scratch.
The headline result is that hypernetworks can generate non-shared weights for LSTM and reach near state-of-the-art results on character-level language modelling, handwriting generation and neural machine translation, challenging the weight-sharing paradigm for recurrent networks. Applied to convolutional networks they still achieve respectable image recognition results compared to state-of-the-art baselines while requiring fewer learnable parameters; on CIFAR-10 the relaxed weight sharing cost about 1.25 to 1.5% in classification accuracy while drastically reducing the number of parameters. The captured members cover the static convolution-kernel generator, the dynamic HyperLSTM, a PyTorch HyperNetworks-for-ResNet implementation, and a generic MLP hypernetwork that emits flattened target weights.
Key idea. HyperNetworks showed that a small network can generate non-shared, per-step weights for an LSTM and reach near state-of-the-art sequence modelling results, which challenged the weight-sharing paradigm for recurrent networks.
AI-written summary, based on the paper and checked automatically against it; not reviewed by a person. Corrections welcome.
@misc{ha2016hypernetworks,
title={HyperNetworks},
author={David Ha and Andrew Dai and Quoc V. Le},
year={2016},
eprint={1609.09106},
archivePrefix={arXiv},
primaryClass={cs.LG},
url={https://arxiv.org/abs/1609.09106},
}