  The quantum approximate optimization algorithm (QAOA) is a near-term hybrid
algorithm intended to solve combinatorial optimization problems, such as
MaxCut. QAOA can be made to mimic an adiabatic schedule, and in the
$p\to\infty$ limit the final state is an exact maximal eigenstate in accordance
with the adiabatic theorem. In this work, the connection between QAOA and
adiabaticity is made explicit by inspecting the regime of $p$ large but finite.
By connecting QAOA to counterdiabatic (CD) evolution, we construct CD-QAOA
angles which mimic a counterdiabatic schedule by matching Trotter "error" terms
to approximate adiabatic gauge potentials which suppress diabatic excitations
arising from finite ramp speed. In our construction, these "error" terms are
helpful, not detrimental, to QAOA. Using this matching to link QAOA with
quantum adiabatic algorithms (QAA), we show that the approximation ratio
converges to one at least as $1-C(p)\sim 1/p^{\mu}$. We show that transfer of
parameters between graphs, and interpolating angles for $p+1$ given $p$ are
both natural byproducts of CD-QAOA matching. Optimization of CD-QAOA angles is
equivalent to optimizing a continuous adiabatic schedule. Finally, we show
that, using a property of variational adiabatic gauge potentials, QAOA is at
least counterdiabatic, not just adiabatic, and has better performance than
finite time adiabatic evolution. We demonstrate the method on three examples: a
2 level system, an Ising chain, and the MaxCut problem.
