frequency compensation
Picture pushing a child on a swing. If your pushes line up with the swing's natural rhythm, small nudges build into huge arcs. A feedback amplifier has the same danger: the loop feeds its output back to its input, and at some frequency the signal arrives delayed by a full half-cycle (180 degrees). If the loop still has gain greater than 1 at that frequency, those delayed corrections reinforce instead of cancel, and the amplifier rings or oscillates instead of settling. Frequency compensation is the deliberate reshaping of the loop's gain-versus-frequency curve so that the gain has safely fallen below 1 before that dangerous phase point arrives.
The usual trick is to make one pole dominant: you intentionally add (or enlarge) a capacitor at a high-impedance node so that the loop gain starts rolling off early, at a single low frequency, and keeps falling at a gentle 20 dB per decade for as long as possible. Because that first pole already contributes its 90 degrees of lag while the other poles are still far away, the phase has room to breathe and the gain crosses unity before the total lag reaches 180 degrees. The leftover safety margin is the phase margin, and you usually aim for at least 45 to 60 degrees so the response settles cleanly rather than ringing. In a two-stage op-amp the elegant move is Miller compensation: a small capacitor bridged across the high-gain second stage looks, from the input, like a much larger capacitor (multiplied by that stage's gain), so it splits the two poles apart, pulling the dominant one down and shoving the other one up out of the way.
The trade-off is honesty itself: every bit of stability you buy by lowering the dominant pole also lowers your gain-bandwidth product and slows the amplifier down, because the unity-gain frequency is roughly gm divided by the compensation capacitance. So compensation is a negotiation, not a free fix. Add too little and the part rings or oscillates; add too much and it is rock-solid but sluggish. Good analog design finds the smallest capacitor that still guarantees enough phase margin across temperature, process, and load.
Unity-gain bandwidth of a Miller-compensated op-amp set by the input-stage gm and the compensation capacitor Cc.
A Miller cap also creates a troublesome right-half-plane zero (it lets signal feed forward through the cap); designers usually cancel it with a small series nulling resistor of about 1/gm.