Tweedie's Formula for Testing: Score Identities from Hypothesis Tests to Diffusion Models
Abstract
Tweedie's formula expresses the posterior mean under Gaussian noise as the observation shifted by the score of the log-marginal density. The same identity connects two developments that have evolved separately: Rubin's decision-theoretic view of Bayes hypothesis testing and the denoising step at the heart of modern diffusion generative models. We develop the testing side. Under a spike-and-slab hypothesis, the Tweedie posterior mean decomposes into posterior signal probability times conditional signal mean. The associated local false discovery rate rule is equivalent to Bayes-factor thresholding and satisfies an oracle screening consistency theorem. The key observation is that in a diffusion model with Gaussian forward process, the score network's denoised prediction equals the posterior signal mean under the training prior. For out-of-distribution detection, the training score can be used to recover the training log density, which can then be compared with a specified null density; the fdr-BF equivalence supplies principled false discovery rate thresholds without heuristic calibration.