I had a 'deadly' army attack one of my cities today (it's recorded on twitch and starts at 38:33). After the AI wiped out most of my melee units, all I had to do was sit back and shoot the AI units that were left. They had all been severely wounded (down to a single figure) and kept running away from my two champions (one on a horse). Both champions had very weak ranged weapons, and would have been killed if the AI actually sent the units forward.
Basically: If there's ranged units left on the map AI melee units should hunt them down.