Cavalry carbine should be shorter as it was a secondary arm to the lance and sabre, and had to fit on the horse along with other stuff. Be able to move quickly and easily. Usually lightly armed and equipped.
Artillery were more static and had more transport available, thus a longer carbine. Artillery carbine so they could handle easily when the cavalry go too close to dispose of with the guns. Easy to handle in the confined space with the guns. Didn't need the long range and volley of the infantry.