The public’s confidence in legal institutions is frequently damaged by the unpredictable nature of court rulings, which also creates a divide between the public and judicial elites. Improving the predictability of rulings is essential for promoting overlapping consensus, bolstering judicial authority, and increasing public confidence in legal institutions. In order to increase the precision and interpretability of legal judgment forecasts, this study investigates the use of an optimized particle swarm algorithm. We suggest a hybrid model that combines particle swarm optimization with semantic and decision-element analysis methods using the CAIL2018 dataset, a sizable collection of criminal case records. According to experimental data, the revised algorithm improves accuracy, resilience, and convergence speed by 5% across a range of case circumstances. The suggested framework addresses issues of interpretability and decision-making support while greatly increasing the efficiency of legal judgment prediction by utilizing cutting-edge data mining techniques like matrix-based distributed representations and scaled dot-product attention mechanisms.