DeepLLM Quiz
Deep Learning

Parameter sharing and soft weight sharing

10 questions on tying weights together, fewer free parameters, built-in invariances, soft sharing with a mixture prior and hybrid generative-discriminative models.

  • 10 questions
  • Stopwatch
  • Instant feedback

Shown publicly with your score. Don’t use your full real name.

Sample questions

Play now ↑

Answers stay hidden. Start the quiz to play them.

  1. Sample 1

    A layer has 100 connections, divided into 10 groups of 10, and all the connections in a group must share one value. How many free weights does the layer have?

    • 100
    • 1,000
    • 10

How it works

  • One question per screen. An answer is final once sent.
  • You see right away whether you were right, with a short explanation.
  • The stopwatch runs: on equal scores, the faster player ranks first.
  • Only your best attempt counts, so replaying is never risky.

About this quiz

A clerk is asked to stamp ten thousand forms, each of which needs the same check. She could write ten thousand separate instructions, one per form, or write one instruction and apply it ten thousand times. The second approach is not just shorter: it guarantees that every form is treated identically, and it means the clerk needs ten thousand times less training. Neural networks can be built in the same economical way. Many connections can be made to share a single learned value, so that the number of numbers to be learned is much smaller than the number of connections. This is parameter sharing.

This quiz is about the idea and its softer cousin. You will see what hard sharing does to the count of free parameters, why it is such a natural way to build in a known symmetry, and what has to be true for it to be usable at all. You will then meet soft weight sharing, in which weights are not forced to be equal but are encouraged by a penalty to cluster around a few shared values, with the clusters themselves discovered during training. The connection to the ordinary squared penalty is instructive: the latter is a pull towards a single centre at zero, while the former pulls towards several centres chosen by the data.

The questions use small numbers, such as the number of free parameters when connections are grouped, and short descriptions of how the pulling works. They also ask where soft sharing has been applied beyond ordinary regularisation, including a method that ties together the parameters of two models, one trained on unlabelled data and one on labelled data.

Common misunderstandings include taking weight sharing for a trick that reduces computation, when its main purpose is to constrain the model sensibly. People also assume that it can be applied to any problem, whereas it needs the form of the constraint to be known in advance. And they sometimes assume that soft sharing needs the groups to be specified beforehand, when learning the groups is part of its appeal. Sharing is one of the most productive ideas in the design of networks. Recurring structure, whether in space, in time or in a graph, appears in an enormous range of data, and a model that uses one set of weights for every occurrence needs far less data to learn the structure and applies what it has learned consistently. The softer version extends the same instinct to cases where the right grouping is not known beforehand, letting the data propose it. Both versions show how a clever constraint, rather than a larger model, can be the key to good generalisation.

The quiz suits learners who are about to meet convolutional networks, where sharing is used throughout, and practitioners interested in regularisation beyond the simple penalty. It needs no mathematics beyond counting. There are 10 questions, each with an explanation, and it takes about four minutes.

Questions and answers

›How long does the quiz take?

About 3 to 4 minutes for 10 questions, at roughly 20 seconds each. Each answer comes with an explanation, which makes the quiz a compact summary of the topic.

›What is parameter sharing?

It is a constraint in which groups of weights in a network are required to have the same value, and that shared value is learned from the data. The model then has fewer degrees of freedom than it has connections. It is also called weight sharing or parameter tying, and it is one of the ways of controlling the complexity of a network.

›Why would you tie weights together?

Usually to build in prior knowledge, such as the fact that the same pattern may appear in different places and should be detected in the same way everywhere. Sharing the weights guarantees this consistency and greatly reduces the number of values to be learned, which helps when data is limited. Convolutional networks rely on exactly this idea.

›What is the limitation of hard parameter sharing?

It can only be used when the form of the constraint is known beforehand, because the groups of weights that share a value have to be specified when the network is designed. It cannot discover which weights ought to be tied. That limitation is one reason for interest in softer alternatives.

›How does training work with shared weights?

The gradient for a shared value is obtained by combining the contributions of all the connections that use it. This needs only a small modification to backpropagation, and in modern software it is handled implicitly by automatic differentiation, so the programmer rarely has to think about it.

›What is soft weight sharing?

It is a regularisation method in which a penalty encourages weights to fall into a small number of groups, each with its own typical value and spread. Unlike hard sharing, weights are not forced to be equal, and the grouping, the centres and the spreads are all learned together with the weights themselves.

›How does soft sharing relate to weight decay?

Simple weight decay corresponds to a prior with a single Gaussian centred on zero, so every weight is pulled towards zero. Soft sharing replaces it with a mixture of several Gaussians, so a weight is pulled towards whichever centre is most likely to have produced it. The simple penalty is the special case with one component at zero.

›What is a hybrid of generative and discriminative models?

It is a way of combining the two kinds of model by softly tying their parameters. The generative model can learn from all the data, labelled or not, while the discriminative model learns from the labelled data only but is more robust when the generative assumptions are imperfect. The tie lets each help the other, which is useful when labels are scarce.

More quizzes