A method for training a machine learning model is provided. In this method, samples are drawn from a first training set according to multiple weights for training the machine learning model in a first epoch. The first training set includes multiple levels corresponding to the multiple weights. After the first epoch, the machine learning model is evaluated using a validation set for multiple first performances at the multiple levels. Additionally, the weight corresponding to each level are updated based on the first performances, and samples are redrawn from the first training set according to the updated weights for training the machine learning model in a second epoch following the first epoch. Moreover, a device and a computer program product utilizing the above method are also provided. |