Methods, systems, and apparatus for implementing a unitary
quantum gate on one or more qubits. In one aspect, a method includes the actions designing a control pulse for the unitary
quantum gate, comprising: defining a universal
quantum control cost function, wherein the control cost function comprises a
qubit leakage penalty term representing i) coherent
qubit leakage, and ii) incoherent
qubit leakage across all frequency components during a time dependent Hamiltonian evolution that realizes the unitary
quantum gate; adjusting parameters of the time dependent Hamiltonian evolution to vary a control cost according to the control cost function such that leakage errors are reduced; generating the control pulse using the adjusted parameters; and applying the control pulse to the one or more qubits to implement the unitary
quantum gate.