Detecting Machine-Generated Texts by Multi-Population Aware Optimization for Maximum Mean Discrepancy