Viscosity is one of the most important fundamental properties of fluids. However, accurate acquisition of viscosity for ionic liquids (ILs) remains a critical challenge. In his study, an approach integrating prior physical knowledge into the machine learning ML) model was proposed to predict the viscosity reliably. The method was based on 16 quantum chemical descriptors determined from the first principles calculations and used as the input of the ML models to represent the size, structure, and interactions of he ILs. Three strategies based on the residuals of the COSMO-RS model were created as the output of ML, where the strategy directly using experimental data was also studied for comparison. The performance of six ML algorithms was compared in all strategies, and the CatBoost model was identified as the optimal one. The strategies employing the relative deviations were superior to that using the absolute deviation, and the relative ratio revealed the systematic prediction error of the COSMO-RS model. The CatBoost model based on the relative ratio achieved the highest prediction accuracy on the test set (R
2 = 0.9999, MAE = 0.0325), reducing the average absolute relative deviation (AARD) in modeling from 52.45% to 1.54%. Features importance analysis indicated the average energy correction, solvation-free energy, and polarity moment were the key influencing the systematic deviation.