So coceptually, what do you want to happen if the ‘optimal’ configuration for g1 and g2 happens to be at different values of the shared block?
If you duplicate, you will get different values.
If you just want the shared block to be pulled in the respective descent direction with each step, without caring too much about the details, having two optimizers might be better.
If you care about one more than the other, you might use a weighted loss of those for g1and g2 and filter out the duplicates.
The last two are not really excluding each other: you could split out the common part to a third parameter group.
Best regards
Thomas