# Learning to Test: Latent Representation Learning for Dynamic Instability Detection

arXiv: https://arxiv.org/abs/2604.10967 · HTML: https://mlsanity.com/paper/2604.10967/

## Key facts

- No citing papers in the map yet (data through 14 Oct 2026).
- Builds on 33 of its 91 references that are in the map.
- First posted on arXiv 13 Apr 2026.

## Builds on (most cited first, 30 of 33)

- [Attention Is All You Need](https://mlsanity.com/paper/1706.03762/) (2017)
- [Flow Matching for Generative Modeling](https://mlsanity.com/paper/2210.02747/) (2022)
- [Neural Ordinary Differential Equations](https://mlsanity.com/paper/1806.07366/) (2018)
- [Empirical Evaluation of Gated Recurrent Neural Networks on Sequence Modeling](https://mlsanity.com/paper/1412.3555/) (2014)
- [Variational Inference with Normalizing Flows](https://mlsanity.com/paper/1505.05770/) (2015)
- [On the Properties of Neural Machine Translation: Encoder-Decoder Approaches](https://mlsanity.com/paper/1409.1259/) (2014)
- [Can You Trust Your Model's Uncertainty? Evaluating Predictive Uncertainty Under Dataset Shift](https://mlsanity.com/paper/1906.02530/) (2019)
- [Universal Differential Equations for Scientific Machine Learning](https://mlsanity.com/paper/2001.04385/) (2020)
- [Smart "Predict, then Optimize"](https://mlsanity.com/paper/1710.08005/) (2017)
- [Revisiting Classifier Two-Sample Tests](https://mlsanity.com/paper/1610.06545/) (2016)
- [Learning to Optimize](https://mlsanity.com/paper/1606.01885/) (2016)
- [Decision-Focused Learning: Foundations, State of the Art, Benchmark and Future Opportunities](https://mlsanity.com/paper/2307.13565/) (2023)
- [Neural Flows: Efficient Alternative to Neural ODEs](https://mlsanity.com/paper/2110.13040/) (2021)
- [Decision-Focused Learning: Through the Lens of Learning to Rank](https://mlsanity.com/paper/2112.03609/) (2021)
- [End to end learning and optimization on graphs](https://mlsanity.com/paper/1905.13732/) (2019)
- [Classification accuracy as a proxy for two sample testing](https://mlsanity.com/paper/1602.02210/) (2016)
- [MMD-FUSE: Learning and Combining Kernels for Two-Sample Testing Without Data Splitting](https://mlsanity.com/paper/2306.08777/) (2023)
- [An Online Learning Approach to Interpolation and Extrapolation in Domain Generalization](https://mlsanity.com/paper/2102.13128/) (2021)
- [Two-sample Testing Using Deep Learning](https://mlsanity.com/paper/1910.06239/) (2019)
- [Dynamic Sparse Network for Time Series Classification: Learning What to "see''](https://mlsanity.com/paper/2212.09840/) (2022)
- [Sequential Predictive Two-Sample and Independence Testing](https://mlsanity.com/paper/2305.00143/) (2023)
- [A Learning Based Hypothesis Test for Harmful Covariate Shift](https://mlsanity.com/paper/2212.02742/) (2022)
- [Gen-DFL: Decision-Focused Generative Learning for Robust Decision Making](https://mlsanity.com/paper/2502.05468/) (2025)
- [Towards out of distribution generalization for problems in mechanics](https://mlsanity.com/paper/2206.14917/) (2022)
- [MINN: Learning the dynamics of differential-algebraic equations and application to battery modeling](https://mlsanity.com/paper/2304.14422/) (2023)
- [Innovations Autoencoder and its Application in One-class Anomalous Sequence Detection](https://mlsanity.com/paper/2106.12382/) (2021)
- [Learning Neural Differential Algebraic Equations via Operator Splitting](https://mlsanity.com/paper/2403.12938/) (2024)
- [Global-Decision-Focused Neural ODEs for Proactive Grid Resilience Management](https://mlsanity.com/paper/2502.18321/) (2025)
- [Sequential Change Point Detection via Denoising Score Matching](https://mlsanity.com/paper/2501.12667/) (2025)
- [Recurrent Neural Goodness-of-Fit Test for Time Series](https://mlsanity.com/paper/2410.13986/) (2024)

## Abstract (arXiv)

Stability assessment is central to safety-critical systems governed by differential-algebraic equations (DAEs), whose dynamics are constrained by physical laws and admissibility conditions. These systems operate under stochastically varying environmental inputs, so stability must be reassessed as the context distribution shifts, yet repeated large-scale DAE simulation is prohibitive in high-dimensional or real-time settings. We propose a test-oriented learning framework that tests a trajectory-level chance constraint from deployment contexts alone. Rather than re-estimating physical parameters or re-solving the DAE, we learn a latent representation from baseline context-trajectory data that retains stability-relevant information and is regularized toward a tractable reference distribution, and calibrate a latent discrepancy test over the composite safety null. We establish exact validity for oracle calibration and asymptotic validity for its empirical implementation under class-conditional latent invariance, and show that the guarantee degrades gracefully when this invariance holds only approximately. On simulated dynamical systems and a power-system real-world example, our approach strikes a balance between validity and power, whereas other baseline methods each fail in at least one regime. An ablation that injects controlled violations of the invariance assumption shows that decisions stay correct while the violation is below the safety margin, as the theory predicts.
