1
$\begingroup$

Does L1/L2 (NAdam weight decay) really make the model "unlearn"?

Ok so my question might be dumb but is there any way to "unlearn" a model - and yeah I know there is wieght_decay and L1 and L2 - but I'm thinking like instead having a way to tell a model to forget specific thing it has learned so like untrain it from certain cases.

And my questions is worded this way because L1/L2 was the only thing I've found close to what I ask but I don't think it's exactly what I'm searching for - instead as I've worded it above I want instead of having a pass which "trains" the model specific outcome to have a "pass" which reverts that training (not train on different outcome).

So after it has unlearned this training - it predicts with all the other training it has received before.

Thanks in advance.

A possible solution I'm thinking is like keeping the weights of the model before and/or after the training I want to make it unlearn and then somehow use it to do the unlearning but not sure.

$\endgroup$
0

1 Answer 1

0
$\begingroup$

Does L1/L2 (NAdam weight decay) really make the model "unlearn"?

Sort of. These regularisation methods help to make it "forget", but are not required. This is something it will do anyway - unless repeatedly shown the same data, neural networks will preferentially match to more recent data to at least some degree. This is often desirable, and allows neural networks to be used in situations that require online learning.

A possible solution I'm thinking is like keeping the weights of the model before and/or after the training I want to make it unlearn and then somehow use it to do the unlearning but not sure.

For a neural network, this is the only workable solution.

You could, in principle, keep the individual weight step calculations, and reverse them. It would have to be done strictly in order, like an "undo" step in a word processor. However, you cannot calculate what the previous weight step was from the current network plus a set of data. So this will normally keep a data structure the same size as the neural network parameters for each undo step. Keeping a backup copy of the network to restore will use less data than two undo steps, and is less mathematically complicated therefore less prone to error in code.

Most neural network libraries will let you clone a network, so you use that feature to assign to a variable and/or save to disk. If you need to restore then copy the backup (cloning again, so that the two sets of weights are not shared) over the variable tracking the current learning network.

$\endgroup$
3
  • $\begingroup$ I'm very interested in how this undo will work in practice - are there any reference documents or implementations - but from what I'm reading wouldn't it be the same as saving and loading the model weights (at certain point) - which is not what I ideally want. $\endgroup$ Commented Feb 2 at 9:27
  • $\begingroup$ @AnArrayOfFunctions: You don't have to save or load to disk, most NN libraries will give you a deep clone function. Take a look at DQN or early stopping code if you want to see an example (DQN uses this to stash the "target" NN. You might also see example in your NN library documentation. This is too small a thing for there to be separate reference docs, and what to do will depend strongly on the logic surrounding your try/fail scenarios plus which NN library you are using. Provided you already have the try -> succeed/fail logic written out though, we're only talking a few lines of code. $\endgroup$ Commented Feb 2 at 11:30
  • $\begingroup$ Your best bet for a clean example is that someone has written out how to do early stopping logic using your library. However many libraries now have this built in so you automatically get the backed-up copy without needing to do anything, so it is not guaranteed you will see the code you need $\endgroup$ Commented Feb 2 at 11:33

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .