This is one of the things that is difficult to program in. Could you please explain here (in mathematical terms perferably) how to have the AI identify that they are losing the war, and that their "superior" military isn't up to the job? If you could, the devs could work on it right away.
Um come on it's not rocket science. All it would need to do is keep track of say the last 10-20 battles with each race in the last x weeks. If it sees that it is losing 80% of the time, it should :
1) Rethink ship design. For each of those battles the key element of why it lost could be recorded. (out-numbered, too weak offensive, thier defense too good, your defense too weak, ...)
2) Rethink tech choices based on above. Face it, the AI doesn't use defense correctly, or prioritize researching it.
3) Consider upgrading ships to better design.
4) Consider peace if it doesn't make any progress.
The reality is the AI does not design good ships. It still for the most part designs hords of crappy ships, and on top of that it uses a completely flawed calculation of military power.
It is completely pathetic how the turn your power is more than them, they will almost always take a peace deal.