You are right in the assumption that passing the output of one model to the other would keep the computation graph intact and model1 should get valid gradients as long as the computation graph is not detached.
I don’t know what model1.generate does so could you check, if output has a valid .grad_fn?
If that’s not the case, this would mean that output is detached and Autograd won’t backpropagate through it. On the other hand, if the grad_fn is set, could you check the .grad attributes of model1's parameters before and after the first backward() call (they should be None before and contain valid values after)?