In view of the shortcomings of the low convergence speed and the easiness to fall into local optimal solution when the tunicate swarm algorithm is applied to network intrusion detection systems,an improved tunicate swarm algorithm for XGBoost parameter optimization and feature selection was proposed.The Tent chaotic mapping and adaptive step were applied to accele-rate the convergence of the algorithm,and the Levi's flight strategy was integrated to enhance the path perturbation of indivi-duals to help the algorithm better jump out of the local optimal solution.Simulation results show that the improved optimization algorithm converges faster,is more stable,and has higher optimization accuracy.Compared with other machine learning algo-rithms,the application of the improved algorithm on XGBoost achieves better detection results and effectively improves the per-formance of network intrusion detection.