{'fraction_non_alphanumeric': 0.030215311004784688, 'fraction_numerical': 0.005334928229665072, 'mean_word_length': 4.818624721603563, 'pattern_counts': {'":': 0, '<': 0, '<?xml version=': 0, '>': 1, 'https://': 1, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
A method to challenge symmetries in data with self-supervised learning

Symmetries are key properties of physical models and of experimental designs, but any proposed symmetry may or may not be realized in nature. In this paper, we introduce a practical and general method to test such suspected symmetries in data, with minimal external input. Self-supervision, which derives learning objectives from data without external labelling, is used to train models to predict 'which is real?' between real data and symmetrically transformed alternatives. If these models make successful predictions in independent tests, then they challenge the targeted symmetries. Crucially, our method handles filtered data, which often arise from inefficiencies or deliberate selections, and which could give the illusion of asymmetry if mistreated. We use examples to demonstrate how the method works and how the models' predictions can be interpreted. Code and data are available at https://zenodo.org/record/6861702.


Introduction
If observations of nature refute a symmetry, then all models that imply that symmetry are wrong. Particularly in fundamental physics, important theoretical models and experimental designs do possess symmetries, but we are not always certain whether nature actually reflects those symmetries. Testing suspected symmetries in data is therefore of significant scientific value, since refuting a symmetry also indirectly challenges all physical hypotheses which imply it.
In this paper, we introduce a method which can perform such tests on a general class of symmetries for any form of computerized data, and without external labels or descriptions of those data. Implementing our method requires only data, knowledge of any filtering on those data, a way to transform those data according to the candidate symmetry, and an appropriate learning algorithm to model the asymmetries.
This method, which we name 'which is real?', begins by building pairs of data, each containing one real datum and one 'fake' copy that has been transformed according to the proposed symmetry. If we then build a machine that reliably predicts which entry in each pair is real, and which is fake, then the symmetry must be broken. We build and test such machines with modern learning algorithms according to standard machine learning practice: train with one portion of the data, and generate reliable results by testing in another independent portion.
Real data are messy. Not only do data take complicated shapes in various digital representations, they are usually also subject to lossy effects in collection and processing. Such inefficiencies, however, are often well understood, and that understanding is productively leveraged to select subsets of the data which have cleaner connections to their idealized modelling. To test symmetries in practice, it is therefore crucial that our method works seamlessly in the presence of such lossy effects or selections, which we describe collectively as filtering the data.
Note that asymmetry in data does not necessarily imply asymmetry in the fundamental physics of nature. Data arise from natural and artificial effects, and a proposed symmetry could be broken in any step in the chain of data preparation, such as hardware construction or software analysis. This is not necessarily a defect of our method; evidence for asymmetry indicates that either nature is asymmetric or that our experiments need recalibrating, and both lessons can be valuable.
Context Our 'which is real?' method uses an example of self-supervised learning, in which one trains models to perform tasks derived from the data themselves without external labels -with external labels, it would be supervised learning. In common practice, self-supervision helps to teach models about structures in the data, such that they later become more useful for other tasks [1][2][3][4][5][6][7]. Our emphasis is not on the training, however, but on the models' performance with the self-supervised 'which is real?' task itself.
Active research pursues ways to build symmetries into machine learning algorithms [8][9][10][11][12], with scientific applications including high energy physics [13][14][15][16][17][18][19] and astronomy [20,21]. Building symmetries into model architectures usefully encodes domain-specific prior information, and so improves performance by leaving less to learn from data. In contrast, this paper seeks to challenge those symmetric priors in contexts where they may or may not hold in nature.
If a symmetry of interest is considered to be normal or expected behaviour, then our method has an application in the automated detection of collective anomalies [22]. The study of anomaly detection has a substantial history in and outside of particle physics, including a modern emphasis on the use of machine learning tools [18,23,24].
Our method is a probabilistic recasting of ideas developed in a sister paper [19], which uses neural networks to approach similar tasks in the absence of filtering effects. We informally discuss some mathematical properties of symmetries that are formalized in another sibling paper [25]. We have also demonstrated the 'which is real?' method, which is introduced in this paper, as a tool to test for anomalous parity violation in simulated particle physics data [26].
Layout Before detailing the 'which is real?' method, we introduce what we mean by a symmetry and the notation we use to talk about it in Section 2. We use Section 3 to describe how a standard classification setup could alternatively be used to test symmetries, but also how it would struggle to handle filtered data. 'Which is real?' avoids this struggle; it is described in Section 4 and demonstrated with examples: a cylindrical particle detector in Section 5, and a  Figure 1: Some symmetries of discrete distributions. (a) A deterministic transition which cycles between three elements of a distribution; if each element has equal probability, then this transition is a symmetry since it only rotates the probability masses between the atoms. (b) A discrete distribution over two elements with an orbital symmetry which randomly transitions from each element to itself or to its neighbour. The dashed ring is an alternative illustration of the same transition, showing how each state transitions into the orbit, then back out to specific states within that orbit. (c) A discrete distribution with six elements partitioned into two similar orbits.
landscape with less trivial symmetry in Section 6. We briefly discuss extensions beyond the core method in Section 7, and Section 8 is a terse summary.

Symmetries
Without a precise definition of what we mean by a symmetry, the remainder of this paper would be quite unclear. This section provides general, measuretheoretic definitions for symmetries as we think of them here, along with our conventional notation. Wishing to capture any operation which has no observable effect on the distribution of data, we define a symmetry of a distribution to be any transformation which leaves that distribution unchanged. That is, although the transformation should change individual data, transforming all elements of a distribution together must preserve all statistical properties of the ensemble. 1 In notation, we consider data states x with probability distributions p(x). A candidate symmetry S defines a transformation τ S (x | x) which takes real data x to new, fake data x . For generality, τ S (x | x) is a probability distribution: it may randomly sample alternatives x , but can still specify non-random transitions by leveraging Dirac delta distributions. Transforming all elements of p through τ S induces a new distribution p S , and we define that S is a symmetry of p if and only if p S = p.
To illustrate this definition of a symmetry, Figure 1 displays examples in small discrete distributions; Figure 1a illustrates a deterministic symmetry that cycles probability mass between states, and Figure 1b illustrates a random transition between two elements. Parity symmetry, S P , is a physically important example that uses the operation x → x = −x, and could define the deterministic transition distribution Continuous rotational symmetry on a circle, S • with x ∈ [0, 2π), could be encoded by a random transition, which happens to be independent of x. (We include the dx terms as reminders of the coordinates in which these density functions live and the Jacobian factors that are necessary to change coordinates.) Although we do not attempt to formalize exactly how a conceptual symmetry should correspond to a transition function, we do note that there is an implication structure among transformations. For example, if a distribution is symmetric under all rotations, then it is also symmetric under rotations by π. So if a test indicates asymmetry under the transformation of rotating by π, then it also indicates violation of the more general rotational symmetry.
Analytically, the induced distribution for given p and τ S is calculable as the probability mass at each x is a mixture of all elements in the original distribution p, weighted by their transitions through τ S . The methods of this paper, however, use empirical distributions only, so do not require the direct computation of this integral. In matrix notation, this integral is p S = τ S p, where τ S is a left-stochastic transition matrix; our definition of a symmetry coincides with p being the stationary state of a Markov chain with transition matrix τ S .
Measure theory Although we prefer to avoid excessive formality, the above definitions may be formalizable in the language of measure theory: p is a probability measure, and p S is its pushforward through a measurable function τ S . Our definition of S being a symmetry of the distribution p then coincides with p being an invariant measure of τ S . Defining a measure-theoretic symmetry in this way naturally covers both continuous and discrete cases, and avoids any need for densities with respect to given coordinates, which alternative formulations could consider [24]. Measure theory also provides 'Radon-Nikodym' derivatives between measures, such as dp dp S (x), which is the relative density of p with respect to p S , and does not require intermediate coordinates against which to define that density [27]. Symmetry (p S = p) means that (dp/dp S )(x) = 1, and so our symmetry tests are essentially searches for examples where this derivative differs from unity.
Orbits Our definition of a symmetry is very general, and the 'which is real?' method works most efficiently for important special cases that we name the orbital symmetries. Not only do orbital symmetries permit a valuable simplification, they matter in practice because they include all of our intended applications. We define and explore orbital symmetries here, and will see their benefit to the 'which is real?' method in Section 4. Orbital symmetries are symmetries which partition the data space into subsets, called orbits, within which all accessible states share a common transition distribution; to illustrate this concept, Figures 1b and 1c display orbital symmetries in two simple discrete systems.
For example, rotational symmetry about a (θ, z) cylinder has an orbit for each z, at which τ S could be a distribution over new points (θ , z) with uniform density in θ , independent of the original θ. The circular example of Equation 2 is an orbital symmetry with one orbit covering all data, and parity symmetry can be tested as an orbital symmetry if its transition distribution is adapted from Equation 1 to a sum of deltas at both +x and −x.
Group symmetries are particularly important in physics, and therefore orbital symmetries are also physically important because every group symmetry is an orbital symmetry.
To show this, we first define each transition function of a group symmetry to be a distribution over the set accessible by operating with elements of a group on the given datum. More precisely, suppose that each x comprises a group element x g with some baggage x b that identifies a group G b . That is, } (up to a permutation by Cayley's theorem, but we are not interested in order). The set is therefore independent of x g within G b , satisfying our definition of an orbital symmetry.
Finally, we note that the transition distribution of an orbital symmetry does not depend precisely on the original datum x, but on the orbit to which it belongs; that is, an orbital τ S (x | x) depends only on x and Orbit(x), and therefore only on x since Orbit(x) = Orbit(x ). This reduced dependency simplifies the 'which is real?' method, and the general applicability to group symmetries gives us confidence in its practical use.

Standard classification
For standard binary classification, a dataset contains data of two classes that are sampled from two distributions, and the task of a classification model is to predict the class labels of given data. One can test symmetries in such a classification setup by constructing two classes, one of 'real' for data that are observed from p, and another of 'fake' for data that we sample from the transformed distribution p S ; the key to our methods is that if an algorithm successfully classifies these real and fake data, then the two distributions must differ, and the symmetry must be broken.
How should success be quantified? Perhaps 95% classification accuracy sounds like a great success, but if the dataset contains 95% real data, then it is actually a failure since naive guessing would do equally well. More precisely, then, our classifier is only successful if it does better than an alternative that assumes parity symmetry. Our classifiers model asymmetry between the distributions, and we compare them against that alternative symmetric hypothesis through likelihood ratios on their label predictions.
We can only train and test example classifiers, but predictions from the symmetric hypothesis are in fact uniquely determined: since symmetry requires p = p S , the symmetric hypothesis learns nothing from the data, and can only assign all label probabilities equally by their proportions in the distribution at large. For example, if we choose to sample real and fake data in equal proportions, then the symmetric model always assigns probability 1/2 to each label. To predict labels better than this, our asymmetric classifiers must use information from the data themselves.
The remainder of this section discusses how such classifiers can be trained, how we report their likelihood ratios, and how this standard approach unfortunately struggles to handle data filtering.
Odds Our machine learning tools are general function approximators that construct functions with values on the real line, but we use them to assign label probabilities, and probabilities are awkwardly constrained between 0 and 1. It is therefore practical (and entirely standard) to first approximate log odds ratios with these functions, then convert those to probabilities. We develop that conversion here.
A log odds function φ(x) relates to the data distributions as which is comfortably unbounded on the real line, so suitable for learning. Note that to derive this relationship, we have used the alternative notation of p(x) = p(x | real) and p S (x) = p(x | fake). Similarly, the prior label probabilities p(real) and p(fake) are the relative the rates with which one samples from p(x) and p S (x) respectively. We choose to use equal parts real and fake: p(real) = p(fake) = 1/2. In general, however, these rates are a free choice that could be tuned to each application; they control both the distribution of the data, which affects how well algorithms will learn, and the distribution of labels, which affects the precision in testing. For example, p(fake) > 1/2 could help by providing more training data in regions with more fakes, but the extreme choice that p(fake) = 1 would provide no information in testing.
Given an assigned log odds function φ(x) and equal label proportions, some probability algebra recovers that which is well known as the logistic function, and that maps our learned log odds to a likelihood function over labels.
Learning can follow the gradients of a loss function defined in the standard way as the negative mean log likelihood on a batch of n data, which we write as where i ∈ {real, fake} are the labels on data.
Model comparison Data contribute to model comparison through ratios of likelihoods, which in this case are ratios of the probabilities assigned to the labels on data. To quantify these ratios in a manner that can converge towards a fixed value as the number of data n increases, we define a 'quality' function Q as the mean log likelihood ratio: where the learned asymmetric model assigns p( i | x i ), which compare against the symmetrical assignment of 1/2. Evidently, this relates to the loss function of Equation 7 by Q = log 2 − L. This quality function Q may be recognized as a difference of binary crossentropies [28], and is invertible to the likelihood ratio for known n. (So n should always be reported!) With perfect predictions, the model attains L = 0 and the maximum Q of log 2 ≈ 0.69, which is the expected loss of the symmetric hypothesis, and equivalently the entropy of the binomial likelihood that we controlled (and maximized) by choosing equal label probabilities. Finally, Q is not bounded from below, since a bad model can approach assigning zero probability to an observed label, and that mistake is severely punished in the loss function.
Since the model does not change during testing, the summands in Q are independent, and standard estimation methods can assign reasonable uncertainties to its limiting value. To inform uncertainty judgements, we therefore report Q with the standard deviation of its summands per √ n. If Q (more precisely, the corresponding log likelihood ratio) is large and positive, then the model is predicting more accurately than symmetry would allow, indicating that the symmetry is violated. If, however, the data obey the symmetry, then one should expect Q to be negative, since learning algorithms are unlikely to find the ideal p( | x) = 1/2 solution. Similarly, small Q does not confirm the symmetry, but indicates that it is not refuted by this attempt with these data and this learning algorithm.
Filtering and weighty problems Without filtering, it is straightforward to prepare datasets with real and fake data sampled from p and p S respectively: just transform random subsets of the data under τ S , and label them appropriately.
Practical experiments, however, usually do not record all possible data, due to holes, inefficiencies, or selections which filter the data before analysis. We describe filtering effects with a function L(x), which assigns a probability that data generated at x are accepted. For example, an unreliable sensor might have L(x) = 0.1, and hard removal under a selection requirement would have L(x) = 0.
We assume in this work that L(x) is exactly known. If it is not, then a fixed approximation should be assigned at training time, and although such an approximation may not be optimal, it may be practical. In testing, however, an inaccurately approximated filter could falsely indicate asymmetry if mistreated, so filter uncertainties should be respected in the testing phase. We do not fully develop the handling of filter uncertainties in this paper, but review them briefly in Section 7.
With filtering, data are not observed directly from p(x) but from the filtered distribution f (x) ∝ L(x)p(x). Since we are interested in symmetries of data distributions, not of filters, fakes should be sampled as if pure data were collected from p(x), resampled from τ S (x | x), and then filtered by L(x ). Applying these relations, the filtered distribution of fakes is Since we can only approximate df (x) with an ensemble of real filtered data, the simplest strategy to sample this distribution would be to transform each entry through τ S (x | x) and weight it by something proportional to this ratio of filter functions.
Although that ratio cannot cause division-by-zero errors, since no data can be observed with L(x) = 0, we do have a problem when data survive tight filtering, leading to unboundedly large weights when L(x ) L(x). In extreme cases, large weights can dominate the estimated fake distribution, giving an unappealing imbalance and poor statistical precision. This is the primary problem with weights on data, which we use the 'which is real?' method to avoid.
A secondary problem of unbounded weights is that they cause a little dependency between data. Independence is valuable because rigorous testing requires independent data on which to test, and because learning from independent mini-batches is efficient: computationally, to reduce data transfer rates, and algorithmically, given the empirical successes of stochastic learning. Weights must be normalized to fix the label proportions p(real) and p(fake), and the problem arises because their normalization constants can only be estimated from finite data. Suppose, for example, that we estimate normalization with a running average that updates as each mini-batch is consumed in training. When a new, highly weighed observation is included, then it should suddenly change the weights on all other data, in all batches, in a clearly non-independent fashion. Although we expect that normalization from moderately sized batches would normally be practical, this risk of domination by extreme outliers leaves a little awkwardness.
Many cases will have well-behaved weight distributions, and this standard classification strategy can be used effectively in practice. For these cases and others, the 'which is real?' method tests symmetries similarly, but with the benefits that it acts without weights and with full independence between data.

Which is real?
Rather than comparing two classes in a mixed distribution, the 'which is real?' method tests symmetries through a self-supervised task of discriminating each data entry from a transformed 'fake' clone of itself, and avoids weights by not attempting to undo any filtering, but by applying the filter a second time when sampling the fake.
For each datum x, 'which is real?' samples one fake x from the transition distribution τ S (x | x) to form an x -x pair, and from that pair, the method derives two labels corresponding to its two possible orderings: fake-real (x is real and was transformed to x ; x ← x), and real-fake (x is real and was transformed to x; x ← x ).
Unlike standard classification, the choice of fake-real and real-fake proportions does not change the data distribution, so we have reason to construct them in unequal proportions and choose p(fake-real) = p(real-fake) = 1/2 always. In this way, we extract from each datum a binary bit which discriminates itself from its fake clone, and use that bit as the gem of information to be predicted by a classifier.
Since the classification problem is now to predict which label, fake-real or real-fake, is correct, a naive and approach could learn a label probability on the joint x -x space in the standard way. However, that would mean working with an input space of pairs (comprising real and fake data together) that are twice as large as the original data, and that can easily incur costs in both learning performance and interpretability. For orbital symmetries, however, we show that the problem shrinks to learning a smaller function ζ(x) on the original data space, and which assigns probabilities through differences ζ(x) − ζ(x ).
Classification To clarify the following analysis, we use p(x ← x) as shorthand for p(x -x | fake-real) which corresponds to the observation of a real x that was subsequently transformed into x to produce the pair x -x. Given this sequential construction, the joint probability of a fake-real ordered data pair factors into the steps of observation and transformation: From this, we construct a log odds over real-fake and fake-real ordering labels, as we did for standard classification. Unlike standard classification, however, that log odds now splits into an exchange-odd difference of two similar terms, since φ(x , x) = log dp(x ← x) dp(x ← x ) = log dp To be explicit, (dp/dτ S )(x | x ) is the relative density of p(x) with respect to τ S (x | x ), and ξ(x, x ) is the learnable function which should approximate its logarithm up to an additive constant. We have also dropped the prior label probabilities, which vanish because we have assumed them to be equal. Although ξ(x , x) depends on the (big) joint space of x and x, that shrinks if we consider only orbital symmetries. For an orbital symmetry, any accessible x-x pair lives within one orbit, and ξ(x , x) does not depend directly on x, but only on the orbit to which both x and x belong. Since we can deduce the orbit from either x or x , we can replace ξ(x , x) for an orbital symmetry with a new learnable function ζ(x ), and use the simpler assignment This construction from a difference ensures that φ(x, x ) is correctly antisymmetric under exchange of its arguments, meaning that there is no difference between x-x labelled real-fake and x -x labelled fake-real; both cases give identical results, so there is no reason to shuffle the orderings. We therefore choose to always order all pairs fake-real, without cost. Again, the logistic function of Equation 6 relates the log odds to the label probability, and the loss function to minimize in training for the 'which is real?' task is again a negative mean log likelihood which is recognized as the binary cross-entropy for classification in the special case that its label is constant, and that its log odds is exchange-odd between the x and x inputs. Following its definition in Equation 8, the corresponding quality is Q = log 2 − L, as before. Note that pairs with x = x are constant in this loss function, so they can optionally be excluded for efficiency.
Filtering To handle filtering, we now generate fakes not by undoing the initial filter, but by applying it a second time after the transition, leading to the filtered transition distribution Sampling from such an arbitrary distribution can be challenging, but practical strategies exist: most simply, one can follow its construction by sampling from τ S (x | x) and accepting each sample with probability L(x ); this is known as 'rejection sampling'. Rejection sampling can be inefficient when L(x ) rejects most samples, but efficiency can be improved by adapting the initial sampling towards f S , and again rejecting a proportion of events to correct for remaining differences. Taking this further, ideal adaptation is achieved though 'inverse transform sampling' in which one inverts a cumulative distribution function to map from the unit uniform distribution onto f S with no rejections. Viewed as Bayesian computation, this is an ordinary case of posterior sampling from a prior τ (x | x) constrained by a likelihood L(x ), so various Markov Chain Monte Carlo algorithms are available for the most challenging cases [29][30][31][32].
With this choice to sample fakes in proportion to L(x )τ S (x | x), the same filter function applies to both real and fake data. Therefore, and all four instances of the filter cancel in the filtered log odds: leading back to Equation 11 as if there were no filtering. Learning now proceeds as before, with the loss function of Equation 15, in ignorance of any filtering except in how it changes the available distribution of data. This means that any successful learning algorithm should continue to approximate the unfiltered result wherever it receives enough data.
Wrap-up Symmetry testing with 'which is real?' works as for the more general case of standard classification: train a model with one portion of the data, and test it on another by evaluating Q according to Equation 8. Now, however, the model attempts to discriminate each data entry from a faked version of itself that is sampled according to the product of the transition distribution with a filter function. For orbital symmetries, learning produces a function ζ(x), from which differences give the fake-real log odds, which translate to probabilities through the logistic function, whose logarithmic mean gives the differentiable loss function of Equation 15 for use in training. We do not specify which learning algorithms should use that loss function because the method itself is indifferent; in any application, it is the task of the user to apply a practical algorithm that is appropriate to their context, be it a linear model, neural network, decision tree or something completely different.
The following examples exercise the 'which is real?' method in some toy environments that include much of the complexity of real data. Standard machine learning tools perform well on these examples with minimal tuning, although this is no surprise given the examples' simple nature.

Example 1: Cylindrical detector
To illustrate a filtered cylindrical symmetry, as might arise in particle detector experiments, we design a broken ring that is illustrated in Figure 2. This detector is imagined to record point data on its surface, which could be estimates of the points where energetic particles interacted with sensitive materials.
The visible holes in this detector imply a clear form of filtering in which all data are lost. We additionally design that the smaller panels miss 90% of possible data, perhaps because of their construction from thinner material. The filter function is therefore L(x) = 1 for x in a large panel, L(x) = 0.1 for x in a small panel, and L(x) = 0 otherwise in the gaps.
The candidate symmetry is of rotation about the axis of the cylinder. We The sinusoidal offset is removed, and fresh data are sampled. Since the asymmetric model assigns non-1/2 probabilities to data from a symmetric distribution, it does worse than the symmetric model. Here, negatively spiking Q i bins indicate where data are denser; the dashed orange line shows the mean in each bin times 100, demonstrating that the model does not perform worse on average, but that these spikes result from the accumulation of many data. More details are given in the text of Section 5.
describe data by their longitudinal position z and angle θ from the vertical axis, so x = (θ, z), and assign a transformation distribution τ S• (x | x) that is uniform for θ between 0 and 2π, as in Equation 2, around orbits of fixed z.
For this example, we have assigned a non-trivial data distribution p(x), but do not describe it in detail here since the purpose of this method is to test for symmetries in data without needing to know the details of their distribution. We specify distributions and filters in discrete coordinates, and sample them with discrete inverse transform sampling to choose pixels, followed by direct uniform sampling within those pixels.
With these models and methods, we sample two sets of 5000 fake-real data pairs for training and testing respectively, from which Figure 2(left) shows a scatter plot of the training data.
From these training data, we learn ζ(x) functions with LightGBM [33] 2 since it is a robust and efficient learning algorithm. Like other boosted decision tree models [36], its output is a weighted sum of step functions acting on trees of inequalities in the input coordinates, for which the algorithm learns weights and locations from the first two derivatives of the loss function of Equation 15, with respect to ζ(x) and ζ(x ).
A ζ(x) function learned by LightGBM is displayed in the middle plot of Figure 2. In this figure, a large black hole has appeared where training data are lacking; there, the model has learned that any data are probably fake, having been rotated in from other angles. Circular rings of high data density are visible in the scatter plot, and these rings match with dark purple and bright yellow fringes that swap sides between the front and back panels. This suggests an apparent misalignment between those dense rings and the axis of the cylinder, as if data in these rings on the front panel are shifted to the left in z, and those on the back panel are shifted to the right.
In the small panels, where data are sparse due to filtering, ζ(x) is smoother but shows similar structures to the main panels; despite the filtering in these small panels, the algorithm has still learned towards the same underlying structure, but does so with less precision where it has fewer data.
Test results are displayed in the rightmost plot of Figure 2, in which the histogram shows contributions to the Q sum (of Equation 8) from bins along the z axis, each of which accumulates contributions from orbits around θ in its range. This figure shows positive contributions in bins lined up with the edges of the dense rings in data; in these locations, there are many data, and the fakes identify themselves due to angular variations in the rings that are breaking rotational symmetry. The accumulated total of Q = 0.198 ± 0.007 strongly indicates violation of rotational symmetry, since it corresponds to a huge log likelihood ratio of nQ = +990 in favour of the learned asymmetric model.
After considering the results of this first analysis, we re-examine our imaginary detector and decide that the patch with no data in the back panel is a gap in the hardware, much like the known hole on the front panel, and so it was an error to not include it in the modelled filter function.
For a second phase, we therefore include that hole as a patch of zeros in the filter function and repeat the experiment. Results from this repeat are displayed in Figure 3a, and they correctly indicate a reduced asymmetry due to our correction of this one source of experimental error. Elsewhere, the ζ(x) function has not substantially changed; this is a positive sign for the method, since it indicates that the filter is being handled sensibly. The remaining positive contributions to Q, however, indicate the presence of other sources of asymmetry.
Thirdly, we imagine adjusting some knobs to recalibrate the alignment of our detector, perhaps with respect to a beampipe, and repeat the experiment once more. Results from this third test are displayed in Figure 3b, and now show no sign of asymmetry; the learned model receives a negative Q, saying that the symmetric hypothesis of p(fake-real | x) = 1/2 is slightly more accurate.
The histogram to the right of Figure 3b shows negative contributions to Q in spikes at the dense rings. This is not because the model has learned poorly there, but because those rings are dense, so contain more data to accumulate in the sum. To demonstrate this, we overlay an orange-dashed histogram showing the average contribution per data entry, and that average is in fact closer to zero training. Figure 4: Symmetrical contours: the height map symmetry of Section 6 asserts that the data are translationally invariant within each contiguous blob of constant brightness in this image. That is, the terrain comprises discrete jumps and flat planes, as if it were made of stacked foam boards or voxels in a computer game. Data displayed in Figure 5a are sampled with density that increases with the brightness of this landscape.
in these dense rings than elsewhere.
For this third test, the data were in fact sampled from a rotationally symmetric distribution with the dense rings aligned exactly around the cylinder, so the learned asymmetric model was doomed to fail.

Example 2: Height map
For cylindrical symmetry, and other common examples of orbital symmetries, symmetric transformations reduce to simply re-sampling one or more natural coordinates of x. But this need not be the case; symmetries and their orbits may be non-trivial. To demonstrate this, we propose a translational symmetry within contours of constant height on a topographical map that is Figure 4. In this figure, each contiguous area of constant brightness defines an orbit, within which we test translational symmetry with the 'which is real?' method by assigning τ S (x | x) to be uniform in the plane within each orbit.
For this example, we simulate two experiments with data sampled from different distributions. The first experiment has data density which is uniform in the plane within each orbit, and which increases with brightness, so that it does obey the symmetry. The second experiment violates the symmetry by taking the data density from this first experiment and scaling it by a sinusoidal function to produces waves along the horizontal axis. Plausibly justified by sparse observational coverage towards the edges of the map, we implement a filter that removes 80% of data in a narrow bordering region of each experiment.
As in the example of Section 5, we use LightGBM models 3 , and sample two batches of 5000 data for training and testing by inverse transform sampling into pixels, followed by uniform sampling within each chosen pixel.  Figure 5: Results of applying the 'which is real?' method to data with the height-map symmetry from Figure 4. Data in the visible bordering band pass the filter with 20% probability. (a) The sampling density of data increases with height-map brightness and obeys the height-map symmetry. For these symmetric data, Q = −0.002±0.001, so the model has not learned exact symmetry and does worse than the symmetric model. (b) The data distribution violates the heightmap symmetry since its density is scaled by sinusoidally varying waves. The model has learned these waves in its ζ(x) function, and the largest contributions to Q come from contours which contain many data and have orbits which span large variations of those waves. For these asymmetric data, Q = 0.066 ± 0.004. In both cases, n = 5000. More details are given in the text of Section 6.
Data and results from these experiments are displayed in Figure 5. The first, symmetric experiment is shown in Figure 5a, and achieves a negative Q, correctly indicating no evidence for asymmetry. As anticipated, the model has imperfectly learned from noise in the finite data. In the second experiment, those sinusoidal waves with which we broke the symmetry are visible in Figure 5b, both in the scatter plot of data and in the learned ζ(x) function. Here also, the method succeeds by indicating asymmetry with a large positive Q.
On the right of this figure, we see that the largest contributions to Q are attributable to orbits containing both many data and large asymmetry. In particular, that asymmetry is driven by oscillations of the waves we introduced, so orbits with too little horizontal extent see less asymmetry than those that span more than half a wavelength or so.

Extensions
Although we described the 'which is real?' task with only one fake per data entry, multiple fakes can also be used by including them additively in the loss function. While we previously averaged the loss function over n data, if we now repeat each entry k times with newly sampled fakes, then we should average their n × k terms into log(1 + e −(ζ(xi)−ζ(x i,j )) ).
Using multiple fakes can reduce testing variance, particularly for discrete symmetries with few equivalent states, but might help or hinder training since stochastic optimization algorithms can benefit from additional noise. Adding multiple fakes does add computational costs, but implementations can be efficient since ζ(x) need only be evaluated once for the real entry and once for each fake. Uncertainty in the filter function is also important since uncertainty is likely to occur whenever L(x) is not deliberately introduced, and inaccuracies will impact test results if our methods learn about errors in the filter function. Filter uncertainty means we have two different filter functions in play: one approximate filter used to simulate fakes, and one imperfectly known filter that acted on the data before their observation. With uncertainty, training can continue with the fixed approximate filter, since although filter inaccuracies may lead to suboptimal learned models, we do not require that models are optimal. Any model that predicts successfully in rigorous testing comprises evidence of asymmetry, so it is the rigorous testing that must respect the filter uncertainty, and this means that the log odds should be modified to allow for variations in the ratios between these two filters.
Introducing different filter functions for data and fakes leads to new, additive terms in the log odds of Equation 18, and those terms should be allowed to vary according to some described uncertainty on the filter. In testing, the accumulated likelihood over all predicted labels then depends on those variations, for both the symmetric hypothesis and our learned asymmetric models. That is, we have likelihood functions that vary under uncertain prior predictions; while interesting, this is a standard and context-dependent data-analysis problem [29], which we do not develop further here.

Summary
We have introduced a practical and general method for challenging symmetries in data, which uses machine learning algorithms to train models to perform the self-supervised task of answering 'which is real?' between real data and 'fake' transformed clones. The method seamlessly handles data that are subject to known filtering effects, and avoids weighting data with that filter by applying it twice, once to real data and once to fakes. Where the trained models answer successfully on independent testing data, they reveal where they have found asymmetry and indicate its scale. Success on the non-trivial examples of this paper demonstrates that the method is ready to challenge theoretically or experimentally proposed symmetries in real applications.