They recoil the same all else being equal. The laws of physics are the laws of physics.
The weight and speed of the ejecta and the weight of the gun all combine to create recoil no matter which gauge is being shot. A 1 ounce load in an 8lb 12 gauge is going to kick less than a 1-1/4 ounce 3" magnum in a 6lb. 20 gauge.
The speed of the recoil matters too. A gas-operated semi-auto has the same total recoil as a pump except the semi-auto lengthens the recoil pulse so it feels softer. Also gun fit matters. A poorly fitting gun will feel like it is kicking harder.
Moving to a 20 gauge to reduce recoil often makes the problem worse if the gun is lighter and the shot weight and speed are the same.