As spectroscopic surveys grow, estimating galaxy properties such as metallicity, star formation rate, and redshift becomes computationally cumbersome. Methods of estimating such properties rely on template spectra or curated redshift catalogs, which fail to represent the diversity of objects seen in large-scale surveys. We present UnEZ, a fully unsupervised, physics-informed machine learning model that can predict spectroscopic redshifts and line strengths with no prior redshift or line strength labels. An encoder predicts emission and absorption line amplitudes/widths, and a fixed deterministic decoder constructs a unique template, estimated redshift, redshift confidence curve, and spectral model. UnEZ was tested on the Sloan Digital Sky Survey (SDSS) Data Release 18 due to its large dataset and thoroughly vetted redshift catalog which serves as an independent benchmark. Despite the lack of templates, line strength labels, or redshift labels, UnEZ's performance competes with modern redshift estimation algorithms. At SNR > 10, UnEZ achieves an outlier fraction of 0.459% and a normalized median absolute deviation (NMAD) of 1.237×10−4. At SNR > 3, UnEZ achieves an outlier fraction of 3.89% and an NMAD of 1.471×10−4. Furthermore, we demonstrate how UnEZ's line strength and redshift predictions can be utilized for various purposes such as constructing template spectra required in traditional redshift estimation algorithms. UnEZ illustrates how a fully unsupervised neural network can allow redshift, among other galaxy properties, to emerge naturally from the spectra themselves, providing a template-free, label-free approach that scales to the demands of future surveys.
Figures & tables
Figure 1: Diagram of the UnEZ neural network. The blue embedding block has learnable parameters while orange blocks are fixed deterministic functions with no learnable parameters.
Figure 2: Diagram of the embedding layer in Figure 1 . The red blocks contain a max-pooling layer while the cyan blocks do not. The last cyan blocks feed into the multi-headed attention mechanism, with the right-side block being the keys and the left-side block being the queries. Detailed specifications and hyperparameters are listed in Table 1 .
Stage
Layer
Configuration
Output shape
Parameters
Input
InputLayer
—
(N,9400,1)
0
Conv Block 1
Conv1D
64 filters, k=5
(N,9400,64)
384
MaxPooling1D
pool size =2
(N,4700,64)
0
Dropout
rate =0.2
(N,4700,64)
0
Conv Block 2
Conv1D
128 filters, k=11
(N,4700,128)
90240
MaxPooling1D
pool size =2
(N,2350,128)
0
Table 1: Architecture of the UnEZ model ( N = batch size). All Conv1D layers use same padding and ReLU activation. A uniform dropout rate p=0.2 is applied after every Conv1D. The line branch provides the attention query; The depth branch provides the key and value.
SDSS
BOSS
Native Min/Max Wavelength
3800Å–9200Å
3600Å–10400Å
Native Resolution
1500 at 3800Å, 2500 at 9000Å
Native Pixel Spacing
10−4 dex
Resampled Pixel Spacing
4.84 ×10−5 dex
Resampled Min/Max Wavelength
3600Å– 9400Å
Table 2: Native and resampled spectral properties including resolution and wavelength range, and pixel spacing.
Figure 3: (top) Raw SDSS spectrum. (middle) Spectrum with bad pixels such as skylines, zero variance pixels, and cosmic rays removed. (bottom) Final preprocessed spectrum with the continuum removed that has been interpolated into uniform wavelength bins and clipped at the ends to remove edge effects. Bad pixels are denoted by the gray shaded region.
Figure 4: Comparison of SDSS catalog redshifts with UnEZ predictions for objects with 0.003<z<1.0 and SNR >10 . Top: Distribution of catalog redshifts, highlighting the dominance of galaxies (blue) and the increasing prevalence of quasars (orange) at higher redshift. Middle: Predicted versus catalog redshift, with the red dashed line marking the 1:1 relation. The concentration along this line indicates accurate recovery, while horizontal and parallel features mark common misidentifications. Bottom: Δζ and Δv (in [ km⋅s−1 ]) versus catalog redshift showing how the spread trends with increasing redshift. UnEZ achieves NMAD = 1.24×10−4 with an outlier fraction of 0.46% across 771,086 spectra.
Figure 5: As Figure 4 , but for the lower SNR >3 sample. All panels, colors, and symbols are identical to Figure 4 . At this cut, UnEZ achieves NMAD = 1.47×10−4 with an outlier fraction of 3.89% across 1,817,847 spectra. Skyline contamination becomes markedly more prevalent as noise increases, and the strongest line-confusion degeneracies appear as ridges parallel to the 1:1 relation.
Figure 6: (top) Outlier fraction as a function of signal-to-noise ratio. (middle) NMAD as a function of SNR. The dashed lines in these plots correspond to NMAD and outlier fraction values shown in the main plot of Figure 4 . (bottom) Distribution of SNR across the entire dataset, with the dashed line representing the cutoff for how many points are needed for a meaningful measure of outlier fraction and NMAD and their errors. Performance quickly degrades with lower SNR regardless of quasar (orange) or galaxy (blue) classification.
Figure 7: Distribution of Δζ for galaxies (blue) and quasars (orange). The outlier threshold is highlighted by the red dashed line at Δζ=0.0015 or Δ v = 450 km⋅s−1 .
Class
Sample Size
Inlier %
NMAD
QSO
45,516
97.1%
4.112×10−4(123km⋅s−1)
Galaxy
725,391
99.7%
1.194×10−4(36km⋅s−1)
Total
771,086
99.5%
1.237×10−4(37km⋅s−1)
Table 3: Sample size, inlier fraction, and NMAD of each spectral class at SNR > 10.
Class
Sample Size
Inlier %
NMAD
QSO
147,326
94.5%
3.471×10−4(104km⋅s−1)
Galaxy
1,670,069
96.3%
1.407×10−4(42km⋅s−1)
Total
1,817,847
96.1%
1.471×10−4(44km⋅s−1)
Table 4: As Table 3 , but for the SNR > 3 sample.
Figure 8: Inlier examples. (top) Starburst Galaxy. (middle) Quasar. (bottom) Quiescent Galaxy. SDSS spectra are shown in black while UnEZ’s spliced template is shown in red. The right panels show the SDSS photometry for each object with the fiber placement overlaid in cyan.
Figure 9: As Figure 8 , but for outliers. (top) Superimposed objects at different redshifts with multiple distinct sources in the photometry. (middle) Iron low-ionization broad absorption line (FeLoBAL) quasar spectrum. (bottom) Superimposed objects at different redshifts with the second source not visible in the SDSS photometry.
Figure 10: UnEZ’s predicted loss landscape for superimposed galaxies shown in the bottom panel of Figure 9 .
Category
N
Percentage
SDSS correct
625
63.8%
UnEZ correct
125
12.8%
Both (superimposed)
88
9.0%
Close
58
5.9%
Neither
51
5.2%
Unknown
33
3.4%
Table 5: Visual classification of 980 inspected UnEZ redshift outliers.
Figure 11: Comparison of emission line fluxes predicted by UnEZ ( FUnEZ ) with those from the SDSS catalog ( FSDSS ) for H β , [O III] λ 5008, H α , and the [N II] λλ 6550,6585 doublet. Only redshift inliers with SDSS line SNR > 5 and a non-zero UnEZ amplitude are shown. N gives the number of objects in each panel. UnEZ fluxes are computed using Equation 14 . The [N II] doublet is the sum of both line fluxes in each catalog. The color bar shows the normalized count per bin. The thick and thin contours enclose 68% and 95% of the objects, while the dashed line marks the 1:1 relation.
Figure 12: BPT Diagram composed from UnEZ’s predicted line strength ratios with SDSS catalog line strength ratios overlaid. The red dashed line is an AGN diagnostic line separating AGN from starburst galaxies ( Kewley et al., 2001 ) .
Figure 13: SOM map showing redshift topology across the map indices. The color represents the median zUnEZ of the spectra belonging to that node. The red scatter points, labeled by their corresponding template spectrum, are the cluster centroids of the map’s node weights, while the white outlines show the cluster boundaries.
Figure 14: SOM map showing velocity dispersion topology across the map indices. The color represents the median velocity dispersion, predicted by UnEZ, of the spectra belonging to that node. The red scatter points, labeled by their corresponding template spectrum, are the cluster centroids, while the white outlines show the cluster boundaries.
Figure 15: Three templates constructed from median spectrum of each cluster predicted by UnEZ line strengths.
QSO → QSO
Galaxy → Galaxy
QSO → Galaxy
Galaxy → QSO
13,778
475,533
929
1083
Table 6: Table of SDSS classifications compared to UnEZ classifications.
Appendix figures & tables3 assets
Supplementary material from the paper’s appendix.
Appendix
#
Species
λvac (Å)
Cl.
#
Species
λvac (Å)
Cl.
1
O vi
1033.82
B
23
H γ
4341.68
B
2
Ly α
1215.24
B
24
[O iii ]
4364.44
E
3
N v
1240.81
B
25
H β
4862.68
B
4
O i
1305.53
E
26
[O iii ]
4932.60
E
5
C ii
1335.31
E
27
[O iii ]
4960.30
E
6
Si iv
1397.61
E
28
[O iii ]
5008.24
E
Appendix
Table 7: Spectral lines used as physics priors in UnEZ. Wavelengths are rest-frame vacuum values from the SDSS spectro1d line table ( Sloan Digital Sky Survey, 2008 ) . Classifications: E = emission-only, A = absorption-only, B = emission or absorption.
Figure 16: As Figure 5 but for the brute force method. Line confusion degeneracies and skyline contamination become much more prevalent using the brute force method.
Figure 17: As Figure 6 with the brute force method plotted as well. Only 100,000 random spectra were selected for each method due to the long compute time required for the brute force method. UnEZ consistently performs better across the entire SNR range and converges toward peak performance at a lower SNR.