Hi,
I’m not sure what you are trying to achieve.
When you compute the gradient of head-output w.r.t. shared feature, $$\frac{\partial g1}{feat}$$ does not depend on the weights of base_model.
Hence, the gradient should be 0.