To improve the efficiency of using the random finite element method(RFEM)for calculating the safety factor of tunnel horizontal convergence in spatially variable soil,a spatial attention-convolutional neural network(SA-CNN)is proposed as a surrogate model for RFEM.This surrogate model takes spatially variable soil parameters as input and the tunnel horizontal convergence safety factor as output,learning the relationship between soil parame-ter random fields and the tunnel safety factor from a limited number of RFEM samples.It then replaces the RFEM method for calculating safety factors on larger samples.Tested on a Shanghai metro tunnel,the model shows a rela-tive error of less than 2%compared to RFEM,with MAPE,RMSE,and MAE values below 10%,0.12,and 0.10 re-spectively,and R2 above 0.8,meeting engineering accuracy requirements.Additionally,the calculation efficiency of the surrogate model is approximately 880 times higher than RFEM.