Hi,
parameters_to_vector is differentiable and so yes gradients will flow back to both models.
In general, there are very limited cases where you need .detach() within your training function. It is most often used when you want to save the loss for logging, or save a Tensor for later inspection but you don’t need gradient information.