Trust-Weighted Alignment of Magnetically Deflected Cosmic Rays

Charged cosmic rays are bent by magnetic fields on their way to Earth, so a single source shows up as a smear of arrival directions. How far each particle is bent depends on its energy divided by its electric charge. Neutral messengers such as gamma rays, along with written source catalogs, point straight back to where they came from. Matching the two kinds of observation is a multimodal learning problem with an unusual property: for each charged event, physics tells us roughly how far its observed position can be trusted. We propose to build that knowledge into two standard tools for aligning modalities in a shared embedding space. The first keeps each modality's internal geometry intact while aligning. The second closes the "modality gap," the tendency of contrastive models to park each modality in its own separate region of the space. We weight geometry preservation by a physics-derived trust score for each event. We close the gap between a source and the distribution of its events, not between each source and each individual event.

This setting is also a clean scientific instrument for the machine learning question. Recent work assumes either that within-modality neighbors are reliable or that every true pair should be pulled together. Magnetic deflection is a distortion we can simulate exactly, tune continuously from "almost straight" to "fully scrambled," and pair with ground-truth source labels. That lets us measure where those assumptions break, which photographic benchmarks cannot do.

Core Claim

Two existing ideas each fail in a specific, predictable way once the cross-modal distortion is physical and one-to-many. The first is the principle that intra-modal neighbors can anchor noisy cross-modal links, shown by Intra-Modal Neighbors Never Lie. It fails because low-rigidity cosmic rays from different sources land next to each other on the sky, so their neighbors do lie. The second is the pair-pulling term of ModGap from Closing the Modality Gap Aligns Group-Wise Semantics. It fails because forcing every deflected event onto its source's embedding asks the encoder to undo a scrambling that the inputs cannot determine, which should collapse or distort the event space.

Our claim is that both failures are repaired by the same quantity. That quantity is an event's expected deflection scale, computed from its energy and from a posterior over its nuclear charge obtained from air-shower depth.

Concretely, for event $i$ with energy $E_i$ and charge posterior from shower depth, let $\sigma_i = \kappa\,\mathbb{E}[Z \mid X_{\max,i}]/E_i$. Here $\kappa$ is a field-strength constant, and the form follows from the deflection $\delta \propto Z/E$ described in Abreu et al.. Define a trust weight $w_i = \exp(-\sigma_i^2/\ell^2)$, where $\ell$ is the angular scale at which neighborhoods are meaningful. The training objective is

$$ \mathcal{L} = \mathcal{L}_{\text{NCE}} + \lambda \sum_{i,j} w_i w_j \big(\|z_i - z_j\| - d_{ij}\big)^2 + \mu \sum_s \Big\| g_s - \tfrac{\sum_{i \in s} w_i z_i}{\sum_{i \in s} w_i} \Big\|^2 . $$

The terms are as follows. $\mathcal{L}_{\text{NCE}}$ is the usual contrastive loss between events and candidate sources. $z_i$ is the event embedding. $d_{ij}$ is the input-space distance between events, combining angle, energy and shower depth. $g_s$ is the embedding of source $s$ from the neutral modality. The middle term preserves event geometry only where both events are trustworthy. The last term closes the gap at the level of trust-weighted centroids, not individual pairs, so scrambled events may spread around their source without being forced onto it.

Relation to Prior Work

Three papers supply the components we modify. Augmenting X-ray Astronomical Representations aligns Chandra photon-event latents with language-model summaries using InfoNCE plus an unweighted mean-squared distance-preservation penalty. It reports 93.3% nearest-neighbor retrieval at $k=1$. Its photons travel in straight lines, so a uniform penalty is reasonable there. We replace it with a trust-weighted version because our inputs are sheared by an amount that varies per event.

ModGap (Closing the Modality Gap) proves that InfoNCE prefers a nonzero gap. It closes the gap by pulling true pairs together while spreading centroids apart, which raises MS-COCO clustering V-measure from about 13.0 to 23.63 and shrinks the gap from 0.47 to 0.03. It assumes one-to-one pairs. Our centroid term is the one-to-many generalization.

IN²R (Intra-Modal Neighbors Never Lie) uses intra-modal neighbor graphs to repair corrupted pairs. It reports 458.8 rSum at 80% noise on Flickr30k, where NCR collapses to 21.0. Its noise is random shuffling, whereas ours is structured and scales with rigidity. IN²R also acknowledges that it over-smooths minority populations. In our setting, the rare high-rigidity events are exactly the minority that matters.

Two other methods motivate what we do not do. FSAlign (Fractal Spectral Geometry) shows that global centroid shifts damage local neighborhoods, but its heat-kernel matching assumes isotropic spread. The Diffusion Bridge (Diffusion Bridge) treats the gap as Gaussian noise, which is wrong for a deterministic $Z/E$ shear.

Cross the Gap shows that contrastive training alone leaves within-modality distances uncalibrated. That is the failure our middle term targets.

On the physics side, CRPropa 3 provides the simulator, including magnetic lensing matrices for the Galactic field. The Auger multiplet search (Abreu et al.) constrains expectations: in 1,509 events above 20 EeV, the largest multiplet was a 12-plet with a 6% chance probability under isotropy. Real-data gains will therefore be modest. This is why we treat simulation as the main arena.

Research Program

We will generate CRPropa 3 sky realizations. Each one places sources drawn with a chosen density and mixed composition, propagates them through a regular Galactic field model plus a turbulent component of adjustable strength, and records each event's arrival direction, energy and simulated shower depth. Shower depth is smeared to reflect the hadronic-model uncertainty that prevents event-by-event charge assignment (Abbasi et al.).

The neutral modality is a source descriptor: true position, spectral index and extension, in the style of the LHAASO catalog, optionally augmented with short text descriptions. An event encoder (a small multilayer network) and a source encoder are trained with the objective above.

The key controlled variables are turbulence strength, which sets the scrambling, and source density. We will also deliberately misspecify the field: train on one field model and test on another.

As a secondary check that the idea is not astrophysics-specific, we will apply the centroid-level gap term to MS-COCO. There each image has several captions, which is a mild one-to-many case. We will compare against ModGap's reported 23.63 V-measure. Because there is no physical trust score in that setting, $w_i$ is set uniform. This isolates the centroid term alone.

Baselines

The naive reference point is plain InfoNCE on event–source pairs, with no structure term and no gap term. It is trained on the same simulated skies with the same encoders, optimizer and hyperparameter search budget as every other method.

The strongest learned competitors are two existing methods ported to this data. The first is the uniform-distance structure regularizer of Augmenting X-ray Astronomical Representations. The second is ModGap's pair-pull plus centroid-uniformity loss from Closing the Modality Gap. For both, the regularizer weights are tuned on the same validation skies with an equal number of trials.

The strongest non-learned competitor, and the real threat, is physics back-tracking. Events are de-deflected through CRPropa's lensing matrices, marginalizing over the charge posterior from shower depth, and then assigned to the source with highest likelihood. This baseline is given the true regular field in the matched condition and the wrong one in the misspecified condition.

Two ablations isolate our ingredients. The first sets $w_i \equiv 1$, leaving the structure and centroid terms unweighted. The second keeps the weights but swaps the centroid term for ModGap-style per-pair pulling.

There is no reported result on Lacuna for event-to-source association on CRPropa simulations. The quantitative bar is therefore set internally. Beating the learned competitors means higher association accuracy and higher V-measure for clustering events by true source at every turbulence level. Against back-tracking, the claim is narrower and stated in advance: we expect to roughly match it under a correct field model and to beat it under field misspecification. If it wins there too, the learned method has no physics use case.

Why not just…?

Why not just back-track events through a known Galactic field model? If the field and charges were known, back-tracking would be close to optimal, and in the matched-field condition we expect it to be hard to beat. But charge is only known as a broad posterior, and an iron nucleus is bent 26 times more than a proton at the same energy (CRPropa 3). The Auger null result (Abreu et al.) is consistent with turbulent components that regular-field models omit. The misspecified-field experiment settles this directly. If back-tracking degrades less than our method when the field is wrong, we will report that the physics approach suffices and that the contribution is only the diagnostic one.

Why not just discard low-rigidity events with an energy cut? This is a real threat, because the trust weight is a soft version of a cut. A hard cut throws away most of the statistics, and it cannot use shower depth to rescue high-energy events that are probably heavy. We include energy cuts and depth-informed cuts, each tuned on validation, as baselines. If a tuned cut matches the weighted loss, the weighting is not worth its complexity.

Why not just train a supervised network on simulations to predict source positions? Supervised regression ties the model to one simulated field and composition. The LHAASO-KM2A diffuse measurement found Galactic-plane flux about three times above model predictions, a reminder that the simulations are imperfect. Our method is equally trained on simulations, so this objection applies to us as well. The cross-field-model transfer test is where any advantage of geometry-preserving embeddings over direct regression must appear. We will run a supervised regressor under identical transfer conditions.

Proposed Experiments

The decisive experiment sweeps turbulence strength from near-coherent to fully scrambling. At each setting it measures association accuracy, source-clustering V-measure, the centroid-level modality gap (distance between source and event centroids, as defined in ModGap), and a neighbor-trustworthiness score: the fraction of an event's embedding neighbors that share its true source.

Our predictions are as follows. Unweighted structure preservation should help at low turbulence and actively hurt at high turbulence, which would be a measurable instance of "intra-modal neighbors lie." Per-pair gap closing should collapse event-embedding variance as scrambling grows. The trust-weighted, centroid-level version should degrade gracefully, approaching isotropic-chance performance only when the physics says no information remains.

A second check runs every method on isotropic simulated skies to confirm that none of them invents source associations. The Auger chance probabilities serve as the calibration reference.

A third check transfers between field models.

The final check applies the trained event encoder to the 1,509-event Auger sample with LHAASO-catalog candidates. Its only purpose is to verify that the method does not claim associations that are significant against isotropy where the dedicated multiplet search found none. Agreement with the null result is the expected and acceptable outcome.