Elevation data - which is most accurate and why?

I found a run in Alltrails with an elevation gain of 547m.

I exported it as a GPX file, and imported into Garmin Connect as a course, which showed a total ascent of 391m. So I assumed some Garmin Elevation Correction was applied.

I then ran the course staying on course, over a couple of hours. My Instinct Solar, with altimeter in auto mode, produced a Total Ascent of 360m (but with wildly different starting and finishing altitudes which doesn’t inspire confidence for a loop starting and ending in the same spot).

So I applied Garmin Elevation Correction to the activity in the Garmin Connect website - which gave me a total ascent of 278m (and descent of 279m).

Can anyone please explain to me which data point is likely to be most accurate and why? Thank you!