Air marines are very useful as guards. The marine barracks is more space efficient than the guard quarters (at the cost of being less space flexible, but still), and even if you don't plan to use them to board it still is an option in a pinch.
However, ships equipped with a handful of marine guards seem to be very eager to board, even when attempting to do so puts them at a disadvantage. The AI needs to better compare its boarding ability vs its firepower and firing arcs when deciding whether boarding is a good idea at any given moment.
I guess to make this clearer, if a ship has 16 marines (and ~100 crew), and is armed with e.g. 3 heavy cannons and 3 regular cannons... the problem is that despite its potent cannon armament it will try to single-mindedly board an opposing ship, even if that ship has enough crew that the mere 16 marines have zero chance of accomplishing anything, and in chasing the other ship it leaves its guns useless half the time while the other ship fires away.
Captain, Engineering Corps
The AI should calculate whether the boarding chance is successful or not, and whether to try to ram. If the boarding would be successful, it should decide whether to use the cannons or board.
I see your point, but I don't want to make the AI cheat - how can it know how well-defended the opponent ship is? I guess it could use size as a proxy?
I'd imagine a heuristic that primarily compares the number of working weapons vs the number of marines, and then tempers that with the size of the other ship. This way ships that are obviously boarder-focused will not care so much about the size of the other ship.
If I have a whole lot of guns, getting up close is bad because keeping the target in the firing arc of every gun becomes a whole lot more difficult.
If I only have a handful of marines, it doesn't make sense to try and board anything but the smallest ships. And even then it's more likely to be better just to shoot them out of the sky if I do have a whole lot of guns. Especially in the context of a larger engagement where it might make more sense to hold on to those marines as boarder defence.