LagFormer: Regressing Periods from Sparse, Irregularly Sampled Series

Tejas Lohia, Matthew Graham, Andrew Drake, Ashish MahabalarXiv 2026

TL;DR

Finding the repeating period of a sparsely sampled signal—like a flickering star observed only once every few nights—usually means brute-forcing through a million trial frequencies. LagFormer skips the frequency grid entirely by asking a simpler question: at what time lags does the signal resemble itself? By computing an exact, interpolation-free correlogram on a logarithmic lag axis and reading off each period's harmonics at fixed offsets, it beats classical periodograms on both accuracy and speed.

What Problem Does This Paper Address?

Imagine trying to figure out the rhythm of a song when you only hear one random note every few minutes. In astronomy and other time-domain sciences, observations are sparse, irregular, and riddled with gaps and noise. In the real-world survey data used here, the median series has about 1,066 observations spread across more than 8,700 cycles—meaning you can't just connect the dots to see the wave.

The standard approach is a grid search: test ~1,000,000 trial frequencies per series using methods like Lomb–Scargle periodograms or Phase Dispersion Minimisation (PDM), and pick the best-scoring one. This is slow, scales poorly with longer records, and frequently trips over harmonics (confusing a period $P$ with $2P$ or $P/2$). Previous neural networks either inherited these massive frequency grids or struggled to learn periodicity directly from raw irregular timestamps.

Methods

LagFormer flips the problem from the frequency domain to the time-lag domain. If a signal repeats every $P$ days, it should look like itself at lags of $P, 2P, 3P$, and so on.

Figure 1: LagFormer first-stage architecture. A transformer encodes the irregular observations and pools representations across depth. An exact log-lag correlogram of the raw value and learned channels is gathered at fixed harmonic offsets for each output period bin. A shared comb network and decoder combine harmonic and fundamental-lag features to produce a posterior over log-period and a continuous estimate.

The first stage works in four steps:

  1. Transformer Encoder: Each observation $(t_i, m_i, e_i)$—timestamp, value, and measurement error—is encoded into a token using sinusoidal time encodings. An 8-block transformer lets each point incorporate context from its temporal neighbors and uncertainty, outputting 23 learned feature channels alongside the normalized raw value (24 channels total).
  2. Exact Log-Lag Correlogram: Every pair of observations is binned by its time difference $\Delta t_{ij}$ into 3,224 logarithmically spaced lag bins. Using prefix sums on time-sorted data, this is computed exactly without interpolation or subsampling in linear time with respect to series length.
  3. Harmonic Comb: Because the output period grid is 4× coarser than the lag grid, the multiples of any candidate period ($P, 2P, \dots, 218P$) sit at fixed index offsets. A 1D convolutional network gathers these harmonic slices for all 512 candidate period bins simultaneously.
  4. Decoder & Loss: A dilated 1D CNN combines the harmonic comb summary with the fundamental-lag correlogram to output a probability distribution over log-period, trained with a soft Gaussian target and a hinge loss that explicitly penalizes harmonic errors ($P/2, 2P, P/3, 3P$).

Because aligning thousands of cycles requires extreme precision (~$2 \times 10^{-5}$ relative error), a second stage takes the winning harmonic and refines it locally using a learned contraction network followed by a Gauss–Newton polish.

Datasets

  • Synthetic Corpus: Generated by painting known waveform templates onto the real sampling patterns and noise of donor light curves. The model is trained exclusively on this synthetic data, with a template-disjoint test split of 60,227 series.
  • Real Survey Data: 174,337 forced-photometry light curves from the Zwicky Transient Facility (ZTF), with 17,129 held out for evaluation. Because catalogue periods (from SCoPe) are themselves estimates from a classical search, the authors also evaluate against independent periods from the Catalina and Gaia DR3 surveys.

Key Insights and Ideas

  • Logarithmic lags make harmonics shift-invariant: On a log-lag axis, $2P$ is always a fixed distance from $P$, regardless of whether $P$ is 0.1 days or 100 days. This turns harmonic aggregation into a simple, fixed-offset gather.
  • Learned features beat raw values under noise: While raw-value autocorrelation alone gets close on clean synthetic data, adding the transformer's learned channels makes the model far more robust to outliers and corrupted nights—improving accuracy by +9.2 percentage points when 10% of observations are corrupted.
  • Encoders alone aren't enough: Swapping out the correlogram, comb, and decoder for a standard MLP on top of LagFormer's own transformer encoder drops accuracy from 90.2% to 16.4%. The lag-domain readout is what makes period estimation work.

Key Results

  • Synthetic Accuracy: LagFormer's first stage finds the true period within 10% ($\text{Acc}_{10}$) on 90.2% of held-out synthetic series, outperforming Lomb–Scargle (69.3%), PDM (85.0%), and Conditional Entropy (82.2%), at 2.7–16× lower median CPU cost.
  • Real-World Fold Quality: On real ZTF data, LagFormer agrees with the SCoPe catalogue 80.6% of the time. When both pick the same multiple, LagFormer's refined period produces a tighter phase fold in 51.9% of cases (7,168 vs. 6,587 series).
  • Fewer Harmonic Mistakes: Using a label-free statistical test for periods that are provably too short, LagFormer fails on 6.7% of real series compared to 13.0% for PDM. It also leads all baselines when compared against independent periods from Catalina (41.5% vs. 28.4% for PDM) and Gaia DR3 (69.9% vs. 64.5% for PDM).

Limitations and Future Work

LagFormer assumes the input signal is periodic, and its accuracy drops when a series has fewer than ~300 observations. Additionally, for long periods above $T/218$ (where $T$ is the record length), fewer of its 218 harmonic multiples fit inside the observation window. Finally, because synthetic periods were drawn independently of waveform shape, any real-world correlation between a star's shape and its period is only tested at evaluation time.

Summary updated

BibTeX
@misc{lohia2026lagformer,
  author = {Tejas Lohia and Matthew Graham and Andrew Drake and Ashish Mahabal},
  title = {{LagFormer: Regressing Periods from Sparse, Irregularly Sampled Series}},
  year = {2026},
  eprint = {2612.01103},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2612.01103},
}
Figure