I would suggest to use the second approach and not even creating an optimizer for the backend.
Once you have finished training the frontend, you could create the optimizer for the backend and set requires_grad=False for the frontend.