Accurate prediction of short-time cab speed is a prerequisite for identifying abnormal acceleration and deceleration behaviors of drivers, which helps to improve passenger safety and comfort. The XGBoost-based short-time cab speed prediction model is studied based on the real-time movement speed of cabs in cities. The cab speed data set is divided into a training set and a test set, a sliding time window is constructed, the time series of historical cab speed within the time window is used as the input variable, and the current time cab speed is used as the output variable. The model parameters are quickly optimized by using the hyperopt module based on Bayesian algorithm to obtain the optimal combination of model parameters, and the prediction results of the model are compared with the non-parametric regression model and neural network model based on the cab GPS trajectory data set of Shenzhen city on October 22, 2013. It is shown that the mean absolute error (MAE) of the constructed short-time cab speed prediction model is $9.841$ and the root mean square error (RMSE) is 12.711, which are lower than those of the nonparametric regression model and the neural network model, improving the prediction accuracy of cab speed; due to the lack of regularity of cab speed series, the adjusted $R^{2}$ is $0.592$, and compared with the other two models, the XGBoost model has a better fitting effect near the time point when the cab speed changes sharply, avoiding the degradation of prediction accuracy caused by overfitting.