~Hidden unit acrobatics
There’s more to functional equivalence than flips and swaps
How can we change a neural network’s weights without changing the function it implements? Two familiar answers are to permute its hidden units, or, for an odd activation such as the hyperbolic tangent, to flip the signs of a unit’s weights. But some networks admit many more possibilities. In this note, we’ll explore these hidden unit acrobatics through a sequence of small games.
Acknowledgements: This post was drafted with the help of ChatGPT 6 Astra, based on an old presentation of mine. We jointly sketched the post, then Astra implemented the games and I finalised the surrounding text.
§The network architecture
To keep things simple, our networks have one input, one output, and a single hidden layer of hyperbolic tangent units, with no biases. A parameter vector implements a function
Each unit has an incoming weight and an outgoing weight . We can draw each unit as a point . A single unit controls a single sigmoidal contribution to the overall function. So much for a single unit. A collection of points form a cloud of points in the plane that represents a single parameter in .
As a warmup, try the following challenge: move the point to configure the incoming and outgoing weight in order to implement the function shown by the dashed line. You can drag the point, or focus it with Tab and use the arrow keys. Reset, guides, and hints are available throughout.
Interactive figure: find weights for the target tanh(1.5x). Enable JavaScript to play. One solution is (a, b) = (1, 1.5).
In the following exercises, we’ll explore various different ways to implement this and other neural network functions using collections of one or more units.
§I. Flips and swaps
First, let’s get on top of the obvious different ways to represent a given neural network function.
§§Unit flips
The hyperbolic tangent is an odd function: . Negating both of a unit’s weights therefore preserves its contribution:
Your next challenge is to explore this unit flip. Move to the other parameter that implements the same function.
Interactive figure: flip (1, 1.5) to (−1, −1.5). Both implement the same function.
§§Unit swaps
Addition is commutative, so exchanging two units also preserves the function:
So, your next challenge is to swap two labelled units. Pay close attention to the starting points, and then move them both and see if you can find this alternative way of implementing the same function.
Interactive figure: exchange unit 1 at (1, 1.5) and unit 2 at (−0.5, 0.75).
§§Permutations and signs in general
In a larger network with units, there are permutations that implement the results of different unit swaps, times different combinations of unit flips to consider. In total, this gives up to distinct implementations of a given single-hidden-layer biasless hyperbolic tangent network.
These operations always preserve the implemented function for any parameter. In most cases, they’re the only operations that do, and there are different ways to implement the function exactly. This result is a special case of the result proved by Sussmann (1992). It holds for all parameters unless one of the following conditions holds:
- for some unit ;
- for some unit ;
- for distinct units ; or
- for distinct units .
When any of these conditions hold, the parameter is called reducible. The flip and swap operations also preserve the functions implemented by reducible parameters. But for reducible parameters, there are many more possibilities.
§II. Reducibility
Sussmann showed that reducible parameters implement functions redundantly, in that it’s possible to implement the same function with fewer units. In a reducible network, units either contribute nothing to the function, or a set of two or more units contributes only a single sigmoid (which could be implemented by any one of them). Let’s explore the consequences.
§§Silent units
If , the incoming weight can be anything; if , the outgoing weight can be anything: This leads to a continuum of possible parametisations that all implement the same (zero) function.
Your next challenge is to find this entire set of parameters. Trace both axes, passing through their intersection to change direction. Valid motions leave a trail.
Interactive figure: the zero function’s equivalence class is the coordinate cross {a = 0} ∪ {b = 0}.
§§Matching units
When , only the sum of the outgoing weights matters:
For the next challenge, we want to move both units around while holding the sum of their outgoing weights constant. So, we introduce a second slice of parameter space, showing the point . Dragging this point around moves both units’ outgoing weights in tandem, leaving the incoming weights fixed.
Your next challenge is to trace the line to see how it preserves the target .
Interactive figure: in the (a₁, a₂) plane, follow a₁ + a₂ = 1. Its intercepts (1, 0) and (0, 1) put all the contribution in one unit.
At either intercept, one unit becomes silent. Beyond the intercepts, one unit contributes more than the target while the other cancels the excess.
§§Opposite units
When , we have a similar situation. Because hyperbolic tangent is odd, it’s as if the units have the same incoming weight, and all that matters is the difference between their outgoing weights:
Therefore, your next challenge is to repeat the previous game with opposite incoming weights.
Interactive figure: with (b₁, b₂) = (1, −1), follow a₁ − a₂ = 1.
§III. Staying in the fibre
The above examples show that for reducible parameters, the set of parameters that implement the same function is much more intricate than in the irreducible case.
This set of parameters is called a fibre of the parameter–function map, or the functional equivalence class of the parameter :
For irreducible parameters, this is the discrete set generated by flips and swaps. Reducible fibres are not only infinite. In this architecture, they are also piecewise linear path-connected: any two equivalent reducible parameters can be joined by a path of straight segments that stays entirely within their fibre.
In particular, we should be able to implement a flip or a swap while staying entirely inside the fibre. Let’s see how the moves we discovered above can combine to implement continuous flips and swaps, while preserving the implemented function continuously.
§§A continuous flip
Start with one active unit and one spare unit. The idea is to let the spare carry the function while the original unit changes its incoming weight.
First move the silent spare to the opposite incoming weight. Transfer the contribution to it using the outgoing-weight panel. The original unit is now silent, so you can move it to its flipped incoming weight. Transfer the contribution back, then return the spare to the origin.
Interactive figure: move ((1, 1.5), (0, 0)) to ((−1, −1.5), (0, 0)) through transfers using the spare. The sum stays tanh(1.5x).
The incoming-weight panel shows , just as the outgoing-weight panel shows . All views describe the same parameter. When one unit is silent, you can change its incoming weight in either view.
§§A continuous swap
For a swap of two active units, use a third unit as temporary storage. Select the pair whose weights you want to coordinate. Transfer the first unit’s contribution into the spare, the second into the first, and the spare into the second. Before each transfer, move the silent receiving unit to the donor’s incoming weight.
Writing the contributions in their labelled slots, the plan is Finally, return the spare’s incoming weight to zero to complete the exact swap of the full parameter vector.
Interactive figure: use unit 3 to swap the two active units, keeping their total function fixed and returning unit 3 to (0, 0).
§Conclusion
Reducible parameters have quite complicated functional equivalence classes, but their geometry can still be understood through simple motions of moving silent units and redistributing contributions.
In my Master’s thesis, Structural Degeneracy in Neural Networks, I pioneered an approach to characterising these functional equivalence class through combinatorial algorithms for navigating the functional equivalence class, enumerating paths like the ones you explored above.
This theory is also summarised in my 2023 NeurIPS paper “Functional equivalence and path connectivity of reducible hyperbolic tangent networks”.
So far, the theory only covers single-hidden-layer hyperbolic tangent networks, but more recently, I’ve been working on a generalisation to a much broader class of activation functions, and I think it might be possible to consider other architectures too.