Stellar collisions are common in dense clusters and galactic nuclei, and they matter for everything from blue stragglers to the formation of massive black holes. Analytic fitting formulae that describe the likely outcome of a collision exist, but they do not generalize well across encounter energies or stellar evolutionary phases.

Smoothed particle hydrodynamics (SPH) can resolve the internal structure of colliding stars, yet even modest-resolution runs are too expensive to call on the fly inside an N-body calculation that may produce thousands of collisions. To solve this, we built collAIder, an open-source Python package that contains a machine learning model trained on a large set of SPH simulations of stellar collisions to predict the outcome of a stellar collision.

GitHub Website

In González Prieto et al. (2026) we assembled a grid of 27,720 StarSmasher SPH calculations of main-sequence star collisions. The grid spans stellar mass, age (from zero-age to terminal-age main sequence), relative velocity, and impact parameter, with stellar structures drawn from MESA evolutionary models.

We trained and compared nearest neighbors, support vector machines, and neural networks on two tasks: classifying the collision outcome, and regressing the final remnant masses. Neural networks reach a classification balanced accuracy of 98.4%, with relative errors of 0.11% and 0.15% for the two remnant masses. In the figure below, we show the performance of each method on the classification task in a confusion matrix.

Confusion matrices for collision classification
From left to right, confusion matrices for the test data using k-nearest neighbors (k-NN), support vector classifier (SVC), and neural network (NN). The accuracy and total number of samples in each class are shown. Labels (0,1,2) indicate the number of surviving stars, and label 3 corresponds to a stellar collision where one star gets destroyed and the other stripped.

We also explore a combined architecture using a Mixture of Experts model, which achieves a comparable classification balanced accuracy of 98.5%, with relative errors of 0.27% and 0.75% for the two remnant masses.

Mixture of Experts error comparison
Distributions of absolute errors in the final predicted masses using the neural network (NN) and the Mixture of Experts (MoE) model. Each panel shows the distribution of absolute errors for the final masses of star 1 on the left and star 2 on the right of the violin plot, for data with a specific ground-truth classification label. Small errors are rounded to 10−10. Labels (0,1,2) indicate the number of surviving stars, and label 3 corresponds to a stellar collision where one star gets destroyed and the other stripped.