Cement composition can influence the cement slurry’s main mechanical properties, such as compressive strength (CS). This study focuses on the evaluation of the effect of cement composition materials (SiO2, Al2O3, CaO, and Fe2O3) on the slurry compressive strength along with the size effect of silica content using nano-silica (NS) and silica-fume (SF). Thus, four different models, including linear regression (LR), pure-quadratic (PQ), interaction (IA), and full quadratic (FQ), were used to predict the CS of the cement slurry using 355 datasets collected from the literature. The precision and validation of modeling were assessed using correlation coefficient (R2), root mean squared error (RMSE), mean absolute error (MAE), and scatter index (SI). Several parameters were considered when evaluating the CS of the NS and SF-modified cement slurries, such as cement chemical composition (SiO2, 18.31–23.06%; Al2O3, 2.75–6.2%; CaO, 60.76–65.72%; Fe2O3, 1.9–6.19%), water-to-binder (w/b) ratio (0.22–1), NS content (0–12%) and SF content (0–40%), curing time (0.333–400 days), and curing temperature (3–270 °C). The findings of the current work report that the FQ model had superior effectiveness and accuracy according to the assessment criteria, while the IA model exhibited the lowest residual error. In addition, models were utilized to analyze the dataset according to the morphology and dimensions of the specimens. The sensitivity analysis identifies the water-to-binder ratio and curing time as the key criteria for accurately forecasting the compressive strength using this dataset. Replacing cement with NS improves cement strength with an optimum replacement percentage of up to 7% and cement replacement with SF of up to 22%. Despite initial cost increases, long-term benefits and sustainability make it economically viable and aligned with green construction practices. Furthermore, the study indicates that using NS and SF significantly enhances compressive strength, with up to a 20% increase in strength observed under optimal replacement conditions, demonstrating the potential for improved performance and cost-effective sustainability in cement-based materials.