# How to “forward” updated NN model to a transferred model?

I've trained a robot to walk in a straight line for as long as it can (using TD3), and now I'm using that pre-trained model for two new models with separate purposes: 1. Walk to a specific point and halt (adding target position to the NN inputs); 2. Walk straight at a specified velocity (adding a target velocity to NN inputs).

Now let's say I retrain the original model again to walk properly after changing, say, the mass of the robot. How can I approach "forwarding" this update to the two transfer-learned models? The purpose of this is to minimize re-training time for all future models transfer-learned from the original.

(What strikes me as particularly challenging is the fact that the input layer of the transfer-learned models have additional features, so this may re-wire the majority of the NN, making a "forwarded update" completely incompatible...)

I think there is no simple way to transfer knowledge changes between different models.

If you take your initial model and create a new version of it which you use to learn some other task (like "Walk to a specific location"), then the values copied from the first (original) model change in the second model. From that moment on, training the former model on another task will have different effects on its weights than continuing the training of the second model, whose parameter have been changed already.

Consider, for example, that you had changed the mass of the robot and trained the initial model on that new task already. Then, if you took all the re-trained parameters from the first model and implanted them into the second model (trained on walking to a certain location), then you would essentially overwrite the additional knowledge the second model had gained already during its initial transfer-learning-process (not even taking into consideration any additional parameters appended to the list of parameters in the second model).

So, you will have to re-train all three models (the original one and the two transfer-learning models) if you change the mass of the robot.

Edit:

There might be an option to apply the same knowledge changes to another model architecture if you refrain from pure transfer learning. This can be achieved with a more modularized model architecture.

Consider that you train your first model on walking straight head. Let's call this model $$m_{walk}$$.

Then you intend to recycle $$m_{walk}$$ for another task, like walking straight ahead to a given location. Such a model architecture could be realized in two ways:

1. You apply real transfer learning, retraining a copy of $$m_{walk}$$ to walk straight ahead until it reaches a certain location
2. You take $$m_{walk}$$, don't change it, but add a second model (let's call it $$m_{navigator}$$), which is trained on predicting $$go$$ vs. $$stop$$.

In the second case, your overall model architecture (let's call it $$m_{go\_to}$$) consists of both one model used for walking (i.e. $$m_{walk}$$) and one model architecture which is used for predicting $$go$$ vs. $$stop$$ (i.e. $$m_{navigator}$$). The idea then is that the robot executes the actions suggested by $$m_{walk}$$ until $$m_{navigator}$$ suggests stopping, upon which prediction the suggestions by $$m_{walk}$$ will be ignored.

Then, whenever you retrain your model $$m_{walk}$$ (e.g. because the mass of some robot changes), you can simply apply the changes to $$m_{go\_to}$$ by replacing $$m_{walk}$$ by a new version, leaving the rest of $$m_{go\_to}$$ intact.

If you generalize $$m_{walk}$$ to not only walk straight ahead, but also to take turns etc. and you generalize $$m_{navigator}$$ to predict going $$left$$, $$right$$, $$straight\ ahead$$, $$back$$, or $$stop$$ (being predicted when a certain destination has been reached), you can generalize $$m_{go\_to}$$ to walk where-ever you want it to go.