  We present optimized distillation schemes for preparing
Greenberger-Horne-Zeilinger (GHZ) states. Our approach relies on training
variational quantum circuits with white noise affected GHZ states as inputs.
Optimizing for a single iteration of the scheme, we find that it is possible to
achieve an increased fidelity to the GHZ state, although further iterations
decrease the fidelity. The same scheme, acting on coherently distorted
pure-state inputs, is effective only in certain special cases. We show that
radically different results can be achieved, however, when one optimizes for
the output after two iterations of the protocol. In this case, the obtained
schemes are more effective in distilling GHZ states from inputs affected by
white noise. Moreover, they can also correct several types of coherent
pure-state errors.
