Kill two birds with one stone: generalized and robust AI-generated text detection via dynamic perturbations