4 ms·
One of the strangest things in AI, to me, is that you can average the weights of multiple different models to create a single model that’s better than any of th
by sillysaurusx 7y ago
One of the strangest things in AI, to me, is that you can average the weights of multiple different models to create a single model that’s better than any of the individuals.
This is how distributed training often works, for example. Data parallelism.
I don’t understand why it still works in higher dimensions, but it seems to.
The intuition is that the multiple models are “spinning” around the true solution, so averaging gives the final result more quickly. But it works even early in the training process.
- im3w1l 7y agoI believe it works in distributed training because the models never have time to diverge far enough to be "incompatible".
- deleted 7y ago[deleted]
- joker3 7y agoConcentration of measure. If you have a quantity that depends on a large number of random variables but not too strongly on any small subset of them, it tends to behave like a constant. That's the intuition behind the law of large numbers, the central limit theorem, a bunch of concentration inequalities, and model averaging.
- marcosdumay 7y agoAnd, of course, there is nothing that says this would work for intermediate layers, since the sample dimensions may get there from any input. What works is averaging similar networks and averaging your networks a lot of times.
- rprenger 7y agoWhen we use data parallelism, we're summing/averaging the gradients induced by different parts of the data, not the weights of the model itself. When using multiple models for ensemble methods, we're summing/averaging the output of the models for a sample. We're not summing/averaging the weights of the models themselves. While averaging the weights of several models might work on a given problem, it definitely doesn't work in general. w2tanh(w1x) = -1w2tanh(-w1*x) But if you average the weights in those two equivalent models you get 0. If you're talking about asynchronous data parallelism, then there can be some averaging of weights, but they all start with the same weights and are re-synched often enough that weights are never too different to break it.
- sillysaurusx 7y agohttps://www.docdroid.net/faDq8Bu/swarm-training-v01a.pdf https://www.docdroid.net/faDq8Bu/swarm-training-v01a.pdf We average the weights themselves, and the efficiency seems to be similar to gradient gathering. It’s also averaging in slices, not the full model. There’s never a full resync. SWA is the theoretical basis for why it works, I think. Another way of thinking about it: If the gradients can be averaged, then so can the weights.
- uoaei 7y agoIf you are averaging weights often enough, then it's basically the same as averaging gradients. If you average the weights of a bunch of independently-trained models, you're going to have a rough time. Even if the function computes the exact same thing, the order of rows and columns in the intermediate matrices will totally ruin your averaging strategy.
- ncraig 7y agoWorks for humans as well (wisdom of crowds).
- toxik 7y agoThe claim as stated is not true, and would be equivalent to taking the average brain and it being as good as the average answer from those people. Nonsense.
- pavanky 7y agoThe weights arent averaged unless the training step is synchronous. Even then most of the times it is the gradients that are added up rather than the actual weights. For inference, I dont think there are many papers that claim direct average of weights perform better than any single model. It is usually the output that is accumulated in some way.
- sillysaurusx 7y agohttps://arxiv.org/abs/1803.05407 https://arxiv.org/abs/1803.05407 "Averaging Weights Leads to Wider Optima and Better Generalization" Weirdly, the averaging doesn't have to be synchronous.
- halflings 7y agoAs others commented, you either ensemble models (average the predictions) or average the update (gradient). For ensembling, the mathematical justification for why this surprising result is true (e.g just averaging many weak but different models gives a better model) is pretty interesting: https://en.wikipedia.org/wiki/Condorcet%27s_jury_theorem https://en.wikipedia.org/wiki/Condorcet%27s_jury_theorem
- uoaei 7y agoYou are averaging weights in distributed training? That seems like it would be rife with pitfalls unless you average after every batch. I always thought the preferred method was to average the gradient updates, and pass that to update the single mother-model.
- gambler 7y agoAre you familiar with a paper called Synergy of Monotonic Rules? http://jmlr.csail.mit.edu/papers/volume17/16-137/16-137.pdf http://jmlr.csail.mit.edu/papers/volume17/16-137/16-137.pdf The math there is above my paygrade, but it describes a way to structurally combine a certain class of ML models for very significant performance gains. More importantly, it describes why it works.
- ghostcluster 7y agoIsn't this sort of like "the wisdom of crowds"? https://en.wikipedia.org/wiki/The_Wisdom_of_Crowds https://en.wikipedia.org/wiki/The_Wisdom_of_Crowds
- anonytrary 7y ago> One of the strangest things in AI, to me, is that you can average the weights of multiple different models to create a single model that’s better than any of the individuals. I think this is one of the least strange things in AI. All you're doing is taking N overfitted models (unlikely to be overfit in the same way) and then asserting that the average of those predictions is probably not overfitted as much (regularization). Overfitting as a concept is not restricted to some number of dimensions.
- MiroF 7y agoThat would be averaging the predictions, not averaging the weights. It doesn't really matter though, because the parent comment is nonsense and you can't just average the weights at the end and get a working neural net.
- anonytrary 7y agoI just assumed he meant averaging the predictions but said it wrong.
- MiroF 7y agoEven stranger is that such a misleading/false claim is upvoted here.
- _wzsf 7y agoI tried averaging the weights from a bunch of differently-trained neural networks for a Loss.jpg detector once. If you think about what sort of brain you'd get if you "averaged" a few hundred geniuses' brains by blending them into a soup and adding some gelatin to a brain-sized sample, yeah, that's about the level of intelligence I saw in the "average neural net." It was basically in a constant state of seizure.