Many deployed models predict quantities that are known to obey hard rules. Regional forecasts must add up to the national total. A simulated heat field must conserve energy. Loan records must satisfy accounting identities. Current practice either throws away rule-breaking predictions (rejection sampling) or "snaps" each prediction onto the nearest rule-abiding point (a projection layer). Either way, the amount by which the raw prediction broke the rule is discarded. We argue this discarded quantity is a monitoring signal. The true outcome always satisfies the rule, so the gap between a raw prediction and the rule is a known function of the model's unknown error. It can therefore be computed the moment a prediction is made, long before any label arrives. When concept drift sets in (the input–output relationship the model learned stops holding), this residual should grow in step with the error. Projection layers hide that growth: their outputs stay perfectly valid while getting steadily worse.
The proposal joins two literatures that rarely meet. Work on rejection-sampling inefficiency treats a low acceptance rate as a cost to engineer away. Work on concept drift struggles to tell, without labels, whether a shift in the data actually hurts the model. We claim the first literature's nuisance is the second literature's missing signal. A detector built on constraint residuals should fire on drift that damages predictions and stay quiet on harmless input shifts, which input-space tests cannot distinguish.
Core Claim
Let $A y = b$ be a linear equality constraint that every true outcome $y_t$ satisfies, for example a hierarchical summing matrix. Let $\hat y_t$ be the model's raw prediction before projection. The residual is then an exact linear image of the error:
$$ r_t = A\hat y_t - b = A(\hat y_t - y_t). $$
For inequality-defined feasible sets $F$, such as the non-convex linear-arithmetic regions handled by the Disjunctive Refinement Layer, the true outcome lies in $F$. So the distance a projection moves the prediction is a lower bound on the error:
$$ \mathrm{dist}(\hat y_t, F) \le \lVert \hat y_t - y_t \rVert. $$
The probabilistic version of this distance is the probability that the base predictive distribution falls outside $F$. That probability is exactly the rejection rate a naive rejection sampler would suffer. A rising rejection rate is therefore a certificate of rising error, computable without labels.
The claim has a known blind spot, which we treat as part of the research question rather than hide. Errors that happen to satisfy the constraint, meaning those in the null space of $A$ (say, every series off by an amount that still sums correctly), are invisible to $r_t$. How much of real drift-induced error lands in the visible part is an empirical question, and the proposal is designed to measure it.
Relation to Prior Work
The rejection-sampling literature motivates the signal and supplies the machinery. Several papers document why naive rejection fails under hard constraints. Gogate et al. describe valid regions as needles in a haystack. Li et al. and Tavares et al. show that equality constraints have zero probability of being hit. This is why we use a projection distance rather than an acceptance rate for equalities.
The fixes themselves fall into two groups. Adaptive samplers include CARS, which caches dead-end prefixes in a tree, and AWRS, which caches rejected tokens and keeps estimates unbiased. Projection layers include DRL, which compiles mixed AND/OR linear rules into sequential bounds and snaps outputs to them, and ProbHardE2E, whose layer (DPPL) projects distribution parameters in closed form. Every one of these methods aims to drive violations to zero, and none monitors violations over time. We reuse DPPL's and DRL's projections unchanged and read off the quantity they already compute.
The drift literature constrains what counts as a contribution. Incremental Kolmogorov-Smirnov gives a fast univariate unsupervised test on inputs. Sequential classifier two-sample tests give a multivariate input-shift test with exact false-positive control. Both detect changes in the inputs $P(X)$. Neither can say whether a change hurts the model, which the file lists as the open "verification catch-22." Our statistic is a scalar stream, so it can be fed directly into either test's sequential machinery. The contribution is the statistic, not a new test. Test-Time Training with Masked Autoencoders updates a model on unlabeled test data with a generic self-supervised loss. We use the constraint residual as a task-grounded alternative to that loss in a secondary experiment.
Adaptation methods such as Ada-DeepAR and CURE decide what history to train on or keep in context, but they are not concerned with constraints. In this proposal they are downstream consumers of an alarm, not competitors. The closest bridging works use rejection on static data: Ada-RS filters training responses with a length penalty, and CuTS uses soft penalties for constrained tabular generation. Neither treats constraint violation as information about a moving distribution.
Research Program
The work has three parts.
The first is a masking study. We train probabilistic forecasters with and without DPPL on hierarchical benchmarks and stream them over held-out future periods. We measure how error grows over time while the post-projection constraint error stays at zero. ProbHardE2E reports a constraint error of exactly 0 on the Stefan problem, which is the mechanism by which validity can hide degradation.
The second is the detector. We compute the pre-projection residual (a Mahalanobis norm of $r_t$ under the model's own predictive covariance) or the snap distance at each step. We calibrate it on a reference window and wrap it in two sequential tests: the incremental Kolmogorov-Smirnov test, and the evaluate-then-train two-sample test with Clopper-Pearson intervals. This lets false-positive control be inherited rather than re-derived. We also estimate the visible error fraction, $\lVert A e\rVert^2 / \lVert e\rVert^2$, offline on labeled history, to predict in advance which domains the method will work in.
The third is closing the loop. On alarm, we trigger an existing adapter (Ada-DeepAR-style history reweighting or retraining on the recent window). Separately, we test minimizing the residual on unlabeled incoming data as a test-time update of the base network, compared against generic self-supervised test-time training.
Baselines
The naive reference is a fixed model with no monitoring, plus a version that retrains on a fixed calendar schedule. Any detector must beat calendar retraining at equal retraining cost, measured as number of retrains, to be worth deploying.
The strongest input-space competitor is the sequential classifier two-sample test of Jang et al., run on the model's input windows. It reports needing only 190 shifted samples to reach an 80% detection rate on ImageNet multi-shift while holding false-positive rate within 1%, against 640–720+ for data-splitting and Wald baselines. There is no reported result on Lacuna for this test on hierarchical forecasting or PDE streams, so we will run it ourselves. The incremental Kolmogorov-Smirnov test, applied per feature with a Bonferroni-corrected alarm, is the cheap input-space baseline.
The strongest label-free model-space competitor is predictive-uncertainty monitoring: the predictive variance, or the model's self-assessed CRPS spread, tracked with the same sequential test.
The topline is a supervised error monitor that sees labels after their natural delay, the forecast horizon.
Fairness rules apply to all detectors. Every detector uses the same reference window, the same sequential test wrapper, and a threshold calibrated to the same 1% false-positive rate on no-drift streams. Each gets an equal tuning budget for window size.
The key ablation replaces the true hierarchy matrix with a shuffled hierarchy of the same rank and sparsity. Truth no longer satisfies this matrix, so its residual measures input change rather than error. If the shuffled version performs as well as the true one, the "residual equals projected error" mechanism is not what drives the results.
Beating the baselines means two things at matched 1% false-positive rate. On shifts that raise forecast error by a preset margin, the method must have shorter detection delay than the two-sample test. On shifts that do not raise error, it must have a lower alarm rate. It must also reach a higher AUROC for predicting a window-level error increase.
Why not just…?
Why not just monitor inputs with the two-sample test? That test answers a different question: whether the inputs changed, not whether predictions got worse. On harmless shifts it should alarm correctly and thereby trigger useless retraining. The harmful-versus-harmless shift suite below measures this directly. If the input test's alarms turn out to track error as well as ours, our claim fails.
Why not just monitor predictive variance? This is the real threat. Uncertainty is free and label-free too. But a model's variance is learned from the training regime, and under concept drift a model can be confidently wrong. The residual, by contrast, is tied to the truth through the constraint. The decisive comparison is AUROC for error increase on drift where the model stays confident. We will report it even if variance wins, and we will test whether combining the two statistics adds anything.
Why not just wait for labels? In forecasting, labels arrive after the horizon, so a label-based monitor is late by construction. The supervised topline quantifies how much lead time we buy. If that lead time is negligible at short horizons, we will say so and restrict the claim to long horizons.
Why not just use the rejection rate of a naive sampler as the alarm? For inequality constraints it is the same quantity, but estimated by Monte Carlo. It is zero-informative for equalities, where acceptance is always zero, and it needs many samples per step when the valid region is small, as the XML fuzzing result for CARS illustrates. The closed-form projection distance gives the same information in one pass.
Proposed Experiments
The main testbed is the hierarchical forecasting suite used by ProbHardE2E: LABOUR, TRAFFIC, TOURISM/TOURISM-L and WIKI. Models are trained on an early period and streamed over the rest, which captures natural drift.
On top of this we inject two shift families. Harmful shifts change the dynamics of a random subset of bottom-level series, which is concept drift. Harmless shifts apply rescaling that the model's input normalization absorbs, verified offline to leave error unchanged.
A second testbed uses the conservation PDEs (heat, porous medium, Stefan) with physical parameters drifting slowly or abruptly along a stream. This gives full control over when error should rise. The PDEs also include adversarial cases where drift-induced error is constructed to lie mostly in the constraint's null space, to map the blind spot.
Metrics are detection delay at 80% detection, false-positive rate on no-drift and harmless streams, AUROC for window-level CRPS increase, and, for the closed loop, cumulative CRPS and number of retrains against calendar retraining and against Ada-DeepAR (which reports an 8.4% average improvement over base DeepAR on its own shift benchmarks; there is no reported result on Lacuna for it on hierarchical data).
The decisive checks are three. The residual detector must beat both the two-sample test and variance monitoring on harmful-versus-harmless discrimination at fixed false-positive rate. The shuffled-hierarchy ablation must lose most of that advantage. And the offline visible-error fraction must predict, across datasets, where the method helps. If the third check fails, the method has no usable rule for when to deploy it.
References
- Approximate Inference in Probabilistic Graphical Models with Determinism
- Dynamic Scaled Sampling for Deterministic Constraints
- Soft Constraints for Inference with Declarative Knowledge
- Constrained Adaptive Rejection Sampling
- Fast Controlled Generation from Language Models with Adaptive Weighted Rejection Sampling
- Beyond the convexity assumption: Realistic tabular data generation under quantifier-free real linear constraints
- End-to-End Probabilistic Framework for Learning with Hard Constraints
- Fast Unsupervised Online Drift Detection Using Incremental Kolmogorov-Smirnov Test
- Sequential Covariate Shift Detection Using Classifier Two-Sample Tests
- Test-Time Training with Masked Autoencoders
- Adaptive Sampling for Probabilistic Forecasting under Distribution Shift
- Bounded Context Management for Tabular Foundation Models on Stream Learning
- Ada-RS: Adaptive Rejection Sampling for Selective Thinking
- CuTS: Customizable Tabular Synthetic Data Generation