AI latency optimization