TL;DR
The authors introduce Constrained Posterior Sampling (CPS), a novel, training-free framework for generating realistic time series data that strictly adheres to complex domain or physical constraints. By projecting the posterior mean estimate rather than noisy intermediate latents during the diffusion denoising process, CPS satisfies up to hundreds of constraints simultaneously without degrading sample quality. Empirically, it outperforms state-of-the-art baselines by roughly 70% in sample realism and 22% in similarity to real-world data.
What Problem Does This Paper Address?
Generative models like Diffusion Models (DMs) and Generative Adversarial Networks (GANs) excel at creating realistic synthetic data. However, applying them to engineering, financial, or safety-critical time series introduces a major hurdle: hard constraints. For instance, synthetic stock market data must respect natural Open-High-Low-Close (OHLC) bounds (e.g., the opening price cannot exceed the highest price of the day), and power grid simulations must adhere to strict physical laws or peak demand limits.
Existing methods to enforce these rules fall short:
- Training-based approaches lack scalability; a model trained to respect a specific mean value cannot easily adapt to an
argmaxconstraint without full retraining. - Guidance-based approaches rely heavily on hyperparameter tuning (guidance weights), which becomes computationally intractable when dealing with dozens or hundreds of constraints.
- Post-processing projections often push data off the natural "noise manifold," severely degrading sample quality and diversity.
CPS bridges this gap by providing a scalable, hyperparameter-free, and training-free solution for constrained time series generation.
Methods
CPS builds upon the standard deterministic reverse sampling process of Diffusion Models (specifically DDIM). The core innovation lies in where and how the constraints are enforced during denoising.
Instead of projecting the noisy intermediate latents ($z_t$) directly onto a constraint set—which ruins sample diversity—CPS computes the posterior mean estimate ($\hat{z}_0$), which represents the model's current guess of the final clean sample. It then solves an unconstrained optimization problem to project this clean estimate closer to the feasible constraint set ($C$) using off-the-shelf convex optimization solvers (like CVXPY).
Crucially, the algorithm employs a time-varying penalty schedule ($\gamma(t)$). Early in the denoising process, when the signal-to-noise ratio is low, the constraints are enforced loosely. As the process approaches the final steps ($t \to 1$), the penalty increases exponentially, ensuring strict constraint satisfaction. Because noise is added back to the projected clean estimate to generate the next step's latent ($z_{t-1}$), the pre-trained denoiser naturally corrects any artifacts introduced by the projection step.
Datasets
The authors evaluated CPS across six diverse settings, encompassing both conditional and unconditional generation:
- Stocks: A multivariate financial dataset consisting of 6 channels (including OHLC prices) spanning 96 daily timestamps.
- Air Quality: The Beijing Multi-Site Air-Quality dataset, featuring multivariate environmental factors.
- Traffic: The Metro Interstate Traffic Volume dataset, representing univariate traffic flow.
- Waveforms: A synthetic dataset of 64,000 sinusoidal waveforms with varying amplitudes, phases, and frequencies used to test peak/valley tracking.
Key Insights and Ideas
- Don't Project Noisy Latents: Prior methods like PDM project intermediate noisy states ($z_t$) onto clean constraint boundaries. This eliminates valid sample paths and confuses the denoiser. Projecting the estimated clean sample ($\hat{z}_0$) preserves the underlying noise structure.
- Diffusion as a Natural Realism Enforcer: You don't need an external critic network to maintain realism after a projection. The subsequent denoising steps naturally "heal" the sample, nudging it back onto the data manifold.
- Annealed Enforcement: Trying to force strict constraints on pure noise at the beginning of the diffusion process is counterproductive. Gradually ramping up the constraint penalty as the sample takes shape yields much higher fidelity.
Key Results
CPS demonstrated substantial improvements over competitive baselines (such as Guided DiffTime, PDM, and PRODIGY) in both constraint adherence and statistical realism.
- Sample Realism: CPS improved the Discriminative Score (DS)—a metric evaluating how easily a classifier can distinguish synthetic data from real data—by 70% over the best baselines.
- Data Similarity: It achieved a 22% improvement in Dynamic Time Warping (DTW) distance, showing that the generated samples closely track the trajectories of real-world test data.
- Strict Adherence: While guidance-based methods frequently suffered from high constraint violation magnitudes, CPS consistently achieved a constraint violation magnitude of 0.0 across real-world datasets.
Limitations and Future Work
The primary trade-off for CPS's high fidelity is inference latency. Because it solves an optimization problem at each denoising step, the sampling time increases. For multivariate datasets like Stocks and Air Quality, CPS takes roughly 2× longer to generate a sample compared to guidance-based methods.
To mitigate this, the authors suggest optimization strategies such as capping the number of projection steps during early denoising phases or skipping the projection step across certain intervals. For future work, they plan to extend CPS to dynamic constraints in robotics trajectory generation and explore its utility in time-series style transfer.
Summary updated