This paper presents a gain tuning method for servo drives that combines machine learning model (LightGBM) and optimization algorithm (PSO). The LightGBM model can predict the response characteristics of the servo system under different gain parameters of the servo drive. Then, the PSO will tuning the gain parameters to obtain the best performance. A new performance criterion for evaluating the servo drive is proposed. It consists of several time-domain position response characteristics, such as percentage of overshoot and settling time etc., and the servo drive performance can be optimized by utilizing those characteristics. The experimental result shows that the appropriate gain parameters can be obtained through this proposed AI tuning method.