This application relates to a
federated learning method, apparatus, device, storage medium, and program product. The method includes: training a first
artificial intelligence model locally on a
client using a training dataset to obtain the classifier gradient of the first
artificial intelligence model; the sample data for each category in the training dataset is imbalanced, and the sample data for the first category does not meet the data balance condition; determining the gradient adjustment value corresponding to the first category based on the global gradient issued by the
federated learning center; adjusting the classifier gradient according to the gradient adjustment value to obtain the adjusted classifier gradient; updating the first
artificial intelligence model based on the adjusted classifier gradient; and upon reaching a convergence condition, sending the classifier gradient obtained in each iteration to the
federated learning center so that the federated
learning center can update a second artificial intelligence model based on the received classifier gradient, resulting in a model for
processing recommendation tasks. This method can improve model
training performance.