An improved deep neural network algorithm is proposed to predict the compressive strength and corrosion resistance of low-carbon ultra-high-performance concrete (UHPC) using carbide slag fly ash composite materials, and optimize the mix design. Firstly, 226 sets of sample datasets were collected from UHPC compressive strength and corrosion resistance test data, and preprocessed. Using principal component analysis weighting method to assign weights to input variables, randomly select some data as training and testing sets. Secondly, an improved deep neural network model is constructed by introducing weighted cross entropy loss to reduce class imbalance, and supervised contrastive learning is designed to enhance the model’s feature extraction capability. Use Matlab software to train the model and analyze the prediction results. Empirical evaluations demonstrate that the optimized deep neural network architecture exhibits superior predictive performance and enhanced robustness when benchmarked against its predecessor. Specifically, the model achieves a 17.11% and 41.04% reduction in root mean square error (RMSE) values, coupled with corresponding decreases of 28.35% and 44.25% in mean absolute error (MAE) metrics. The proposed computational framework demonstrates exceptional predictive capacity for both mechanical (compressive strength) and durability (corrosion resistance) properties of ultra-high-performance concrete (UHPC) formulated with carbide slag-fly ash composites. This advancement enables data-driven optimization of mixture proportions tailored to specific strength requirements, thereby establishing a theoretical foundation for rational design of advanced cementitious composites.