Majd, that's not stupidity, that's wise. The pre-battle odds calculation is less precise than the in-battle odds, so when the AI sees that it's outclassed it will withdraw.