Manuscript Offprint
arXiv:2610.02675One Photon, Many Worlds: Posteriors and Predictions with Single-Photon Cameras
HAEJOON LEE, Carnegie Mellon University, USA
MOHIT GUPTA, University of Wisconsin-Madison, USA
VIJAYAKUMAR BHAGAVATULA, Carnegie Mellon University, USA
ASWIN C. SANKARANARAYANAN, Carnegie Mellon University, USA
Many worlds --- conditional samples from posterior
Digits
Edges
QR

Faces
Increasing frame count
Fig. 1. SPAD cameras operated in binary-frame mode record at most one detection per pixel per exposure. The top four rows shows samples from the conditional posterior given a single (simulated) binary SPAD frame, shown in the first column where each pixel has measured, at most, one photon. In such photon starved regimes, the inverse problem of image reconstruction is one-to-many, leading to many worlds of possibilities in the output. This uncertainty reduces as we increase the number of binary SPAD frames, as seen in subsequent rows. The conditional samples were produced by training diffusion models for each of the four applications (digits, edges, QR codes, and faces), and empirically characterizes how uncertainty in photon arrivals map to uncertainty in reconstruction and inference. In the case of the faces data, notice how different features like sunglasses, gender, facial expression, and identity take different number of frames to resolve correctly.
Single-photon avalanche diode (SPAD) cameras operate fundamentally differently from conventional cameras due to their photon-counting nature. Each frame produces a binary image: pixels report zero if no photons arrived during exposure, and one if one or more photons arrived. Reconstructing a scene or inferring its properties from a single binary frame is difficult because many different images could produce the same measurement; thus, the inverse problem is fundamentally one-to-many. As we gather more binary measurements, the inherent uncertainty associated with the inverse problem and any associated inference diminishes. With sufficient photon counts, photon noise becomes negligible relative to the signal mean, enabling near-deterministic scene recovery and inference. This work characterizes the transition from stochastic to near-deterministic scene understanding as photon budget increases, analyzing how the stochasticity in photon arrival affects downstream inference tasks. Technically, we develop a conditional generative framework based on a Hypergeometric frame-thinning process for accumulated binary SPAD measurements. Generative models capture the one-to-many nature of photon-starved inverse problems, enabling empirical characterization of how this ambiguity diminishes with increasing measurements and its impact on downstream tasks like character recognition, QR code decoding, and facial analysis.
CCS Concepts: • Computing methodologies → Computational photography.
Additional Key Words and Phrases: Computational Imaging, SPAD Sensors, Generative models
1 Introduction
Imagine a photon counting sensor, capable of resolving light at the granularity of individual photons. Prior to exposure, this camera has no knowledge of the scene in front of it, and so there are multitude of possibilities on the image it could acquire. Once the first measurements are made, some pixels register photon arrivals, we have a binary sketch of the scene. This narrows the space of images that we could be imaging, albeit not by much. As the sensor gathers more measurements, the uncertainty in the image being observed decreases progressively. At some point, we enter the realm of well exposed photographs, where uncertainty is reduced so significantly that the acquired measurements convey a sense of determinism (although the uncertainty never quite goes to zero). This work examines this arc of how uncertainty in scene reconstruction and downstream inference changes as the photon budget increases; effectively, we seek to characterize how randomness in photon arrivals, through the photon-counting nature of single-photon cameras, manifests itself in reconstruction and inference tasks.
The central thesis of this work is how the photon budget determines the ability to interpret a scene and its properties, in the context of a single-photon avalanche diodes (SPADs), a specific kind of single-photon image sensor. Consider the scenario where a SPAD sensor is observing a (static) scene, making a sequence of measurements, where each measurement is a binary frame indicating whether photons arrived at each pixel during the exposure time. The stochasticity of such binary measurements is well understood. The measurement at a pixel in each binary frame is a Bernoulli random variable; at low flux, the mean of this random variable is equal to the incident light level. When the SPAD acquires multiple such binary measurements, their sum at each pixel is a binomial distribution which, at large measurement counts, is well approximated by a Poisson distribution. Both the mean and the variance of this Poisson distribution increase linearly with the number of measurements made by the sensor. This is the regime of a well-exposed photograph; although photon noise dominates, the signal-to-noise ratio of intensity at each pixel monotonically increases with accumulating SPAD measurements. Hence, the output of any deterministic operator on the image—say, a classifier or a regressor—becomes largely independent of the photon noise.
At low photon budgets, we encounter an entirely different problem. As an illustrative example, consider the extreme scenario of a single binary measurement from the SPAD sensor. As before, we have a precise characterization of the stochasticity of the measurement in terms of its probability mass function and its dependence on the incident flux at each sensor pixel. However, if we take an arbitrary natural image as the candidate for the scene being observed, then the posterior probability of this image given the measurement is likely similar to that of any other image. This reveals that the mapping from a single binary measurement to the space of images is fundamentally one-to-many. The problem persists as we gradually increase the number of measurements, with the one-to-many nature of the problem gradually collapsing to one-to-one in the limit when the signal-to-noise ratio goes to zero.
We are interested in characterizing the one-to-many nature of the image reconstruction problem underlying SPAD measurements at low photon budgets. Our primary insight is that generative models are uniquely suited for studying this problem as they can learn functional mappings between two random variables. This naturally aligns with our setting since we want to characterize how randomness in SPAD measurements maps to uncertainty in image space. By leveraging the generative aspects of these models, we can empirically sample the space of images that are tied to a single or multiple SPAD measurements. This allows us to characterize the nature of the one-to-many mapping problem, and how uncertainty in the image space evolves with the number of measurements. Consequently, we can also characterize the performance of classifiers and regressors acting on the measurements as uncertainty in the measurements and reconstructions are both reduced.
Contributions. This paper provides modeling tools and a range of empirical results that characterize uncertainty in reconstruction and inference with increasing photon budget.
-
A model for frame thinning in SPAD measurements. We show that frame thinning—the process of discarding binary measurements—can be modeled as a Markov chain with hypergeometric transitions. This allows us to convert large frame count measurements, progressively, into those made with small frame counts, in a gradual process that lends itself well to stable inversion.
-
Inverse Markov models for SPAD restoration. We design a reverse Markov process that inverts frame thinning while preserving Binomial marginals, implemented as a variational autoencoder-style conditional sampler.
• Empirical validation across multiple applications. We evaluate the approach on edge regression, optical character recognition,
Authors' Contact Information: Haejoon Lee, Carnegie Mellon University, Pittsburgh, PA, USA, haejoonl@andrew.cmu.edu; Mohit Gupta, University of Wisconsin-Madison, Madison, WI, USA, mohitg@cs.wisc.edu; Vijayakumar Bhagavatula, Carnegie Mellon University, Pittsburgh, PA, USA, vk16@andrew.cmu.edu; Aswin C. Sankaranarayanan, Carnegie Mellon University, Pittsburgh, PA, USA, saswin@andrew.cmu.edu.
QR code decoding, and facial reconstruction. For each task, we characterize how the one-to-many ambiguity resolves and how reconstruction and inference accuracy improve with increasing photon budget.
Figure 1 shows example reconstructions for the four applications we consider, and how the one-to-many nature of the inverse problem manifests itself in each instance.
Impact. These contributions provide tools to answer fundamental questions about single-photon imaging. While acquiring more photons intuitively improves results, the minimal photon budget required for reliable reconstruction or inference has remained uncharacterized. Our diffusion-based approach provides quantitative answers to these questions. We further characterize the one-to-many ambiguity by providing tools to quantify reconstruction uncertainty across photon budgets.
While Gaussian noise is the most common corrupting noise used in diffusion models, there has been work focused on models built around Poisson and binomial distributions. Nachmani et al. [2021] and Xie et al. [2023] expand the traditional models to mixture of Gaussian, Gamma distributions, and Poisson distributions arguing that this provides improved degrees of freedoms and improved results in generative modeling. Chen and Zhou [2023] used Poisson distribution for the marginal at each time step, defining a thinning process for the forward process, and a photon aggregation process for the reverse process. In the context of denoising single photon emission computed tomography (SPECT) sinograms, that have Poisson statistics, Lai et al. [2025] avoid Gaussian diffusion models to build a forward process where a normal dose (or high SNR) SPECT measurement is converted to a low dose one; this is done by removing Poisson random variables progressively (a process that is similar to the frame thinning approach we adopt). However, as they note in their work, the reverse model does not have a tractable distribution, which leads them to resort to inverse CDF sampling. In contrast to these approaches, we use a Binomial process that is perfectly tailored to SPAD measurements; for this distribution, we provide a principled approach to both the forward and the reverse process, carefully ensuring that all distributions involved are Binomial.
Denoising techniques with diffusion models. Since diffusion models provide a way to model a space of signals, they have been widely used to solve inverse problems [Zhu et al. 2023]. Chung et al. [2023] expand diffusion models, conditioned to solve inverse problems, to

Fig. 2. Example MNIST images simulated with the SPAD sensor model. The maximum expected photon level per binary frame is set to .
include Poisson measurement noise. Melidonis et al. [2025] expand the noise models beyond Poisson to include Binomial distributions, arguing that photon starved measurement require the use of such models.
Closely related to this paper is the use of diffusion models to denoise SPAD images, in order to remove the effects of photon noise. Quanta diffusion [Chennuri et al. 2025] study the use of diffusion models for video reconstruction from SPAD data; they adapt a standard Gaussian diffusion model, conditioned with noisy SPAD data, to recover a video. gQIR [Garg et al. 2026] fine-tune a pre-trained diffusion backbone and train it adversarially as a one-step deterministic reconstruction model. Recent work by Dvir et al. [2026] uses the likelihood model underlying the measurements made by SPAD sensors to derive a score function, which is used with a diffusion model to denoise the measurements.
While the prior work discussed above have explored diffusion models for inverse problems and photon-limited imaging, they have largely ignored the one-to-many nature of the inverse problem. For the most part, they treat the inverse problem as a one-to-one map, where the mean square error (or variants thereof) are used to guide the recovery, under the regularization provided by the diffusion process. In contrast, our work tackles the one-to-many nature of the inverse problem head on, developing a forward model based on frame thinning, and using a principled approach to learn the reverse process.
3 Overview
In this section, we describe the overview of our work.
3.1 SPAD Measurement Model
We begin with a brief description of how SPAD image sensors operate. Each pixel in a SPAD sensor is a photodiode operated beyond its breakdown voltage; as a result, a single photoelectron triggers an avalanche reaction that saturates the pixel. In effect, each SPAD pixel registers whether one or more photons arrived during the exposure time. Thus, the SPAD sensor produces a binary image in each exposure, with each pixel reporting zero if no photons arrived and one if one or more photons arrived.
Formalizing this, consider a SPAD sensor with pixels. Assuming a static scene that is focused on the sensor, let be the mean photon arrival rate for the sensor pixels, normalized such that , i.e., the brightest scene point is normalized to unit mean arrival rate. Assuming Poisson-distributed photon
Haejoon Lee, Mohit Gupta, Vijayakumar Bhagavatula, and Aswin C. Sankaranarayanan
arrivals, the probability of detecting at least one photon at pixel i is
Here, is a scalar that captures the effect of exposure time, quantum efficiency of the sensor, as well as overall scene brightness (since s is the normalized photon arrival rate). Thus, the measurement at a pixel i in a single frame is a Bernoulli random variable with success probability .
Suppose we acquire N such binary frames. Since the individual frames are statistically independent, their sum—denoted as —is the sufficient statistic for the underlying random variable. The i-th element of , denoted as , follows a Binomial distribution:
Here, we assume an ideal sensor with negligible dark current. Figure 2 shows MNIST examples simulated using this SPAD measurement model. The mean and variance of are given by
Under the definition , this gives
Therefore, increasing the number of binary frames improves measurement quality. As we will see next, the number of measurements we acquire also influences the nature of the inverse problem we will need to solve.
3.2 Photon Starvation Makes Restoration One-to-Many
We study the problem of estimating the noise-free image formed on the sensor. From Figure 2, we can immediately observe that this problem is extremely difficult when N, the number of binary frames, is small. In part, this is due to the measurement likelihood being flat over the space of images, i.e., there are a large collection of images which are equally likely to have resulted in the measurements that we observe. In this regime, the inverse problem of estimating the noise-free image is intrinsically one-to-many. For larger N, the measurements become inherently more informative and noise-free. Hence, the conditional distribution,
where , is broad for small and narrows as increases. This narrowing occurs at different rates for different image features. For example, as seen in Figure 2, digit identity is resolved for small (say, or 50), but a high quality reconstruction with pixel level details is only achieved at much larger (say, or so).
A deterministic denoiser cannot capture the one-to-many structure endemic to low . If a deterministic network is trained with loss to predict from , then the empirical-risk minimizer becomes the conditional mean:
When the conditional distribution is multimodal—comprising of multiple distinct digits or shapes—the conditional mean is extremely blurred, as illustrated in Figure 3. Since a deterministic network

Fig. 3. Deterministic restoration under photon starvation. For very small N, the same low-count SPAD observation is compatible with many high-count targets. A deterministic denoiser trained with a L2 reconstruction loss produces a single averaged output, which can be blurry and cannot represent the remaining conditional uncertainty.
always produces the same output for a given input, it cannot handle multiple plausible reconstructions; instead, the uncertainty only appears as blurriness in the output.
3.3 Solution Overview
The failure of deterministic models suggests that we should treat SPAD restoration, especially in photon-starved regimes, as a conditional image generation problem. Given a fixed low-count measurement , a conditional generator can produce multiple samples from an approximation to
By learning a mapping between the two random variables, we can sample from the conditional distribution and resolve the one-to-many nature of the inverse problem.
One can learn the conditional generator in several ways. Fixing to a large value, we can train a conditional diffusion model [Dhariwal and Nichol 2021] from scratch or implement a posterior sampler (e.g., [Chung et al. 2023]) with a pre-trained diffusion model generate samples from estimated posterior distribution. However, since is expected to vary, training individual generators for each would be computationally prohibitive. Alternatively, a single generator would need to span the full range from unconditional generation ( ) to near-deterministic recovery ( approaching ).
Figures 2 and 4 suggests a more principled route based on the physics of image formation. Consider the gamut of images that we observe as the photon budget changes. At one end, we have photon-starved images and, at the limit, a blank image that has registered no photons at all; at the other end, we have well-exposed and noise-free images where every pixel has gathered enough photons so that its mean vastly outweights its standard deviation. Traversing this photon ladder resembles the basic idea behind diffusion models: rather than map directly between two distinct distributions, one can learn to move along a sequence of simpler intermediate states [Ho et al. 2020; Sohl-Dickstein et al. 2015]. The difference is that our ladder is not constructed on an artificial Gaussian-noise schedule, but directly emerges from the SPAD image formation process. Specifically, moving downward the ladder corresponds to discarding binary
Frame-thining forward chain:

Learned frame-addition reverse chain:
Fig. 4. The overall process of conditional generator for SPAD image restoration.
frames—a frame-thinning operation that defines a Markov chain and preserves the Binomial marginal distribution. This gives a natural reverse problem in the form of learning to add frames back. Our pairwise reverse model—which learns transitions between frames with consecutive number of measurements—learns this local reverse transition. As we elaborate in Section 4, our technique uses a small set of frame-count anchors, in the same spirit as discrete diffusion models that learn reverse transitions over structured discrete states connected via a Markov chain [Austin et al. 2021].
This conditional generator also provides an empirical measure of determinism/stochasticity, both in the context of image reconstruction and task-specific inference. Given a measurement , we can generate multiple samples from our learned approximation to . The variation among these samples characterizes the breadth of the one-to-many map. We further examine the stochasticity of these samples through the lens of specific downstream tasks. If the samples disagree in task-relevant ways, the measurement remains stochastic at the task level. If the samples agree, the measurement has become effectively deterministic. This viewpoint lets us study not just when an image can be made visually clean, but also how many binary SPAD frames are needed before downstream tasks become stable. We study this transition across several applications: (1) regressing parameters of primitive edges from image patches, (2) an optical character recognition (OCR) proxy using the MNIST dataset, (3) QR code reconstruction, and (4) generation of human faces with landmark and pose estimation. Across all applications, we vary the input frame count and characterize how many binary SPAD measurements are needed before the downstream decision and image reconstruction becomes stable.
4 Conditional Image Generation
In this section, we describe the proposed method for learning the conditional generator, i.e., learn to sample from , where results in being a photon-noise-free image and being a highly noisy image. As mentioned before, our scope transcends the traditional denoising approach taken in prior work, in that, we tackle the one-to-many nature of the inverse problem.
Throughout this section, denotes a SPAD image formed from the summation of binary frames and denotes a realization of this random variable. We will also adopt the convention commonly used in diffusion models to define a discrete time index , where smaller values of correspond to “cleaner” images and larger values of correspond to “noisier” images. We realize this by linking each value of to a different frame count , and hence takes on a very high value, and progressively decreases in value as increases, i.e., . Finally, to simplify notation a bit, we write
and denote the i-th pixel of each as and , respectively.
4.1 Markovian Frame-Thinning Forward Chain
The SPAD measurement process naturally defines a ladder of images indexed by the number of accumulated binary frames. Let us consider two consecutive images and on this ladder corresponding to frame counts and , respectively. Since , frame thinning corresponds to uniformly retaining of the underlying binary frames. The transition is conditioned only on the count image , not on the full binary-frame stack. At each pixel,
Haejoon Lee, Mohit Gupta, Vijayakumar Bhagavatula, and Aswin C. Sankaranarayanan
the retained count follows a hypergeometric distribution:
This distribution describes the number of detections retained when sampling binary outcomes without replacement from outcomes containing detections. We assume that detections are independent across frames and pixels given . Applying this model across the entire image of pixels, we get:
For completeness, we can also establish that the frame thinning process as described above and modeled by the hypergeometric distribution provides marginal distributions for that are Binomial at each pixel conditional on , as we would expect from a physical realization of the random variable based on Eq. (2).
THEOREM 4.1 (SPAD FRAME THINNING IS A MARKOV CHAIN). Let
be a decreasing sequence of frame counts. Successively applying the thinning transition
defines a Markov chain. Moreover, if
then the random variable after this thinning transition also follows a Binomial distribution of the form
The proof is given in the Appendix. The main point is simple: uniformly discarding frames preserves the physical Binomial marginal at the new frame count. Therefore, the resulting sequence of SPAD measurements at different N values is a sensor-defined Markov chain.
Importantly, the reverse of this Markov chain is also Markovian. In short, our goal is to learn the reverse transition of the Markov chain to add frames back for conditional generation of the high-count image.
4.2 Conditional Structure of the True Reverse Chain
The reverse direction corresponds to the addition of missing binary frames. For , define
If the photon-detection probability were known, then the missing frames would be independent Bernoulli trials, so
In practice, is unknown. Let
denote the true posterior distribution of after observing . Marginalizing gives the exact reverse kernel:
(13)
Effectively, the true reverse kernel is the product of Binomial distributions, integrated over the posterior of the hidden photon-probability image . Therefore, a learned reverse model should represent the uncertainty over , while keeping the final count-generation step Binomial.
4.3 Latent Binomial Model
Equation (13) motivates a reverse model with two parts: first, a latent variable that estimates , which represents the remaining uncertainty on the photon-detection probability map conditioned on observing and, second, a Binomial sampler that increases the frame count from to . Based on this, we train a reverse predictive kernel of the form:
where and denote trainable parameters of models that we describe below.
4.3.1 The Reverse Kernel. The reverse kernel comprises two sampling steps built upon a prior encoder whose parameters are and a decoder with parameters . The prior encoder takes as input along with the frame counts and to predict the parameters of the distribution of a latent variable Z. Specifically, the encoder allows us to sample a latent vector using a network with trainable parameters :
We will discuss the construction of below. Given z, the decoder predicts the photon-detection probability map as follows:
where are the output logits of the network, and applying the sigmoid operator gives the photon map . With the predicted photon-detection probability map , we reverse the SPAD frame thinning process by adding back independent Bernoulli trials with probability :
The conditional reverse kernel given z is
Marginalizing the latent variable gives
Thus the learned reverse kernel is also a mixture of product Binomial distributions. The important point is that the model is trained to approximate the reverse predictive distribution of , not necessarily to recover the full posterior distribution of exactly.
4.3.2 Why not a direct approach? It is worth considering direct approaches to sample from the conditional distribution . Variational autoencoders (VAEs) [Kingma and Welling 2013] and generative adversarial networks (GANs) [Goodfellow et al. 2014] perform such sampling, but each suffers from limitations in the form of blurred generations in the case of VAEs or stale ones in the case of GANs.
An alternative approach would try to learn the posterior distribution
and then sample the SPAD increment accordingly. This is a valid approach, but it requires the generator to model a broad family of clean probability-map distributions: for very small , the task is close to unconditional image generation, while for large , the task is close to deterministic reconstruction.
Our model instead targets the local reverse kernel
This is the distribution that we actually need for Markov-chain reversion. For a local step, the target is only the missing-frame increment, and not the full clean probability map. Therefore, the model can learn the aspects of the hidden photon-probability image that matter just for the next SPAD count transition.
The natural optimization objective is
However, the marginal likelihood in Eq. (19) contains an integral over z. This integral is generally not available in closed form due to the complex form of the neural decoder. We therefore use a variational training objective.
4.3.3 Variational Training with a Posterior Encoder. We follow the standard VAE [Kingma and Welling 2013] and conditional VAE [Sohn et al. 2015] approach: a prior network is used at sampling time, and a posterior encoder is used only during training to provide useful latent samples. A schematic of the VAE architecture is shown in Figure 5.
We parameterize the prior as a Gaussian with diagonal covariance matrix,
(21)
During training, the posterior encoder also sees the target through the increment image:
It predicts
The pairwise evidence lower bound is

Fig. 5. Overview of the proposed latent binomial model for a single step. The prior encoder takes in the source SPAD image and the frame counts and to predict the parameters of the Gaussian prior distribution of the latent variable . The posterior encoder takes in the source SPAD image , the increment image , and the frame counts and to predict the parameters of the Gaussian posterior distribution. The decoder with a U-Net architecture takes in , the frame counts and , and to predict the photon-detection probability map . During sampling, is drawn from the prior, , and . Here denotes the set of latent groups described in Section 4.3.
where
(25)
The posterior encoder helps training because it can use to infer latent variables that explain the observed target. The KL term keeps this training-time posterior close to the prior that will be used at test time.
Hierarchical latent implementation. For clarity, the equations use one symbol z, but in practice we implement a hierarchical latent structure following the general direction of hierarchical VAEs [Child 2020; Sønderby et al. 2016b; Vahdat and Kautz 2020]. The z symbol now denotes a collection of latent groups, such as
where is a global latent and are spatial latent maps at decoder resolutions and . This lets the model represent uncertainty at multiple spatial scales. The prior and posterior encoders predict the parameters of only. The prior and posterior parameters of each spatial latent are predicted inside the decoder from its features at that resolution, and the posterior also uses the posterior-encoder features at the same resolution. Hence, each spatial latent is conditioned on and on the spatial latents at coarser resolutions. The ELBO has the same form after reading as this compound latent variable. The KL term is computed as the sum of groupwise Gaussian KL terms, each using the same diagonal-Gaussian formula. More technical details are provided in Appendix.
Haejoon Lee, Mohit Gupta, Vijayakumar Bhagavatula, and Aswin C. Sankaranarayanan
4.3.4 Practical Pairwise Loss. Using the Binomial logit form and dropping the combinatorial term that does not depend on the model parameters, the reconstruction loss is simplified as
where and
The factor 1/2 appears because is the log-variance, so
is the standard deviation. In practice, this expectation is estimated with one posterior latent sample per training example.
The Gaussian KL term has a closed form. For a single latent group,
The practical negative ELBO is
For hierarchical latents, the KL term is decomposed into groups,
where G indexes the global and spatial latent groups. In practice, we use groupwise KL weights,
where s is the optimizer step. The weights are increased during training to avoid suppressing the latent variables too early, a common issue in VAE training [Sønderby et al. 2016a]. Before the sum over r in (27), each coordinate term is floored at a constant (free bits).
When the training set contains transitions with very different frame gaps , we also use a gap-normalized reconstruction term:
This normalization only reweights the reconstruction term across transitions of different sizes. It does not change the generative model in (18). Its role is to prevent large frame-gap transitions from dominating the minibatch loss. More details and proofs are provided in the Appendix.
4.4 Anchor-point Markov Reverse Chain for Arbitrary Number of Measurements
To reverse the Markovian forward chain, the ideal approach would learn every adjacent reverse kernel (i.e., single binary frame addition) in the ladder, i.e., have . In practice, using many small steps would dramatically slow the generation process, as we expect to accumulate thousands if not tens of thousands of SPAD frames before the effect of photon noise is minuscule. We therefore use a short Markov reverse chain defined by a small set of anchor frame counts. Let
ALGORITHM 1 Training the shared pairwise SPAD reverse model
Require: Clean-image dataset; target frame count ; anchor frame counts
1: repeat 2: Sample a clean image 3: Compute 4: Sample from 5: Set source frame count: 6: Set target frame count: as defined in Eq. (31) 7: Sample
,
8: Predict prior and posterior Gaussian parameters using Eq. (21) and (23). 9: Sample 10: Decode logits and compute the pairwise loss in Eq. (30) 11: Update 12: until convergence
be a list of monotonically decreasing integers that define the values that take. For any integer , we can define the next anchor
Hence, if we start with a SPAD image measured with binary frames, then we set a reverse chain with frame counts
This allows us to progressively sample from the pairwise reverse kernel to transform low frame count SPAD measurements into high frame count ones. At each step, we sample from the shared pairwise reverse kernel:
Repeating the process, we trace out SPAD measurements with frame count in until we reach , and the final state is the generated high-count SPAD image.
This anchor chain is a compressed version of the full Markov reverse process. The anchors are chosen to balance two goals. Smaller steps make each local reverse problem closer to the physical frame-addition transition, while fewer steps keep sampling efficient and reduce the accumulation of local errors. The same pairwise model is trained and shared across all anchor transitions, so the method does not require a separate network for each edge of the chain.
We summarize the algorithm for training the latent Binomial model in Algorithm 1, and for sampling in Algorithm 2.
5 Case Study: Edges
Edges are primitive structures in natural images and provide a controlled setting for studying how geometric information becomes determined as the photon budget increases. In this case study, we generate synthetic straight-edge images, train the proposed conditional SPAD generator, and evaluate whether generated high-count
ALGORITHM 2 Sampling by anchor-point Markov reversion
Require: Input SPAD image corresponding to input frame count , Anchor frame counts
1: Determine such that the -th element of is
2:
3:
4: while do
5:
6:
7: Sample latent variable
8: Decode logits and probability map
,
9: Sample Binomial count increment independently for each pixel :
10:
11:
12: end while
13: Return
samples agree on task-relevant edge attributes: orientation and location.
5.1 Experimental settings
Synthetic edge dataset. We construct a synthetic dataset of two-tone straight-edge patterns on grayscale images. Each image is defined on normalized coordinates . For each sample, we draw an edge orientation and a point . The edge normal is , giving the separating line , where . Pixels on a randomly chosen side of the line are uniformly assigned to intensities of 1.0. The other side of the line are assigned to 0.1 for a realistic setting of getting photons from the dark side as well. The ground-truth attributes are the orientation and the line bias .
SPAD simulation. As described in Section 3.2, each pixel count is sampled from the Binomial SPAD model in Eq. (2), with photon-detection probability defined in Eq. (1). We set the light level to and use frames as the high-count target, to ensure few measurements don't contain too much information about the scene. During training, conditioning measurements are sampled with . The anchor counts we use are
5.2 Results
Qualitative generation. For each frame count , we fix one conditioning measurement and generate 200 samples from the conditional generator. Figure 6 shows the conditioning input, representative generated samples, and the sample mean and standard deviation maps.
When , the model receives no scene information and behaves as an unconditional generator, producing edges with different

Fig. 6. Conditional generation results for synthetic edge images. Each column fixes the same conditioning measurement at a given frame count , followed by several high-count samples generated conditioned on , their sample mean, and their sample normalized standard deviation.
orientations and locations. As increases, the generated samples become increasingly consistent. In the shown examples, even a few frames strongly constrain the edge geometry. The standard deviation maps further show that uncertainty becomes concentrated near the edge boundary, indicating that the remaining ambiguity is mainly in precise edge location rather than global structure.
Downstream task: edge prediction. To quantify task-level determinism, we train a CNN predictor on high-count target SPAD images with frames. The predictor estimates the edge orientation and line bias. We then generate a test set of 1,000 random edge images. For each image and each , we sample one conditioning measurement , generate high-count samples, and evaluate the CNN predictor on the generated outputs.
Figure 8 reports the angle error and bias error as functions of . The red dotted line shows the predictor performance on clean high-count SPAD images and serves as the performance ceiling. When a metric approaches this ceiling, the generated samples are effectively deterministic for that downstream attribute. The results show that different edge attributes become deterministic at different photon budgets. Bias estimation stabilizes early, around , while accurate orientation estimation requires roughly frames.
Results on real data. To validate the proposed method on real measurements, we printed a straight-edge target and captured it with a Pi Imaging SPAD camera. The captured SPAD measurements are downsampled to pixels to match the resolution used by the conditional generator.
Real SPAD sensors contain hot pixels, i.e., pixels with elevated dark-count rates that can produce detections even when no light is incident on the sensor. To suppress these artifacts, we first captured
Haejoon Lee, Mohit Gupta, Vijayakumar Bhagavatula, and Aswin C. Sankaranarayanan

Fig. 7. Conditional generation results on a real SPAD capture of a printed edge target. For each column, the figure shows the generated samples, their sample mean, and their sample standard deviation. At the rightmost corner, we show the photo of the printed target.

Fig. 8. Downstream edge-prediction results for generated samples as a function of the number of conditioning SPAD frames . The red dotted line denotes performance on high-count target SPAD images with frames.
100,000 dark frames with the sensor optically blocked and used them to estimate a bad-pixel mask. Pixels marked by this mask are excluded during the downsizing process.
Figure 7 shows the result on the real captured edge. The generated samples exhibit quality comparable to the simulated edge results in Figure 6, indicating that the proposed model can generalize to real SPAD measurements after simple hot-pixel masking and downsizing.
6 Case Study: Optical Character Recognition
We next study optical character recognition (OCR), where the downstream task depends primarily on recovering digit identity rather than exact pixel values. Using MNIST [LeCun et al. 2002], we construct a synthetic low-light digit dataset, train the proposed conditional SPAD generator, and measure how classification accuracy changes with the number of conditioning SPAD frames. This experiment lets us identify the photon budget at which digit identity becomes stable under conditional generation.
6.1 Experimental settings
Synthetic digit dataset. We construct the digit dataset by inverting MNIST images so that dark digits appear on a bright background, mimicking printed digits on paper. The images are then rescaled so that the maximum intensity is 1.0 and the minimum intensity is 0.05. This nonzero floor allows the dark digit regions to still produce photon detections, making the simulation more realistic than using completely black strokes. All images have resolution pixels.
SPAD simulation. We simulate SPAD measurements using the Binomial model in Eq. 2. The light level is set to , and the high-count target is frames. During training, conditioning measurements are sampled with . We use the intermediate anchor counts .
6.2 Results
Qualitative generation. Figure 9 shows conditional generations from fixed SPAD measurements. For each conditioning input , we draw 200 samples and visualize representative outputs together with their sample mean and standard deviation.
At very small , the same conditioning measurement can produce samples from different digit classes, reflecting strong uncertainty in digit identity. As increases, the samples concentrate on the target digit class. In the examples shown, most samples already agree with the target identity by . The standard deviation maps show that residual variation is concentrated around digit strokes and boundaries, suggesting that class-level ambiguity resolves before fine stroke location and shape become fully fixed.
Downstream task: digit classification. We quantify OCR-level determinism using a CNN classifier trained on high-count target SPAD images with frames. We form a test set of 1,000 digit images, uniformly distributed across the ten digit classes. For each image and each , we sample one conditioning measurement , generate high-count samples, and classify the generated outputs.
Figure 10 reports the average classification accuracy as a function of . Accuracy increases steadily with the conditioning frame count and exceeds 99% by .
Results on real data. We also evaluate the MNIST model on real SPAD measurements. We printed an grid of digit images and captured it with the SPAD camera. As in the edge experiment, hot pixels are identified from a dark calibration capture and excluded during preprocessing.
To align the printed grid with the model input, we manually clicked the four corners of the digit grid in a high-count reference image and estimated a homography. Using this homography, each captured SPAD count image is rectified onto a grid, corresponding to digit cells with pixels per cell. The rectified image is then partitioned into digit patches, which are used as conditioning inputs to the conditional generator.
Figure 11 shows restoration results for different numbers of SPAD measurements. As the number of measurements increases, more

Fig. 9. Conditional generation results for MNIST. For each fixed conditioning measurement , the figure shows generated high-count samples, their sample mean, and their sample standard deviation.

Fig. 10. Classification accuracy of generated MNIST samples as a function of the number of conditioning SPAD frames .
generated digits agree with the printed target grid, demonstrating the same stochastic-to-deterministic transition observed in simulation.
7 Case Study: QR Code Readers
QR codes are widely used to encode information in a compact and machine-readable form. Decoding QR codes under extreme low-light conditions is therefore important for applications such as real-time warehouse sorting and traceability [Chen et al. 2019], high-throughput conveyor-belt product tracking [Qian et al. 2017] where short exposure times are required to avoid motion blur. In this case study, we use a public QR-code dataset, simulate SPAD measurements, train the proposed conditional SPAD restoration model, and evaluate decoding accuracy as a function of the number of binary SPAD frames. We also compare single-step and multistep reverse generation to evaluate the benefit of intermediate anchor frames.
7.1 Experimental settings
Figshare QR code dataset. We use a subset of the Figshare QR Code Dataset V2 [yasin sancar 2025], which contains computer-generated QR codes with distortions designed to mimic scanner-induced effects. Each image is a single-channel grayscale QR code of size . We use 12,799 images for training and 3,200 images for validation/testing. The encoded payload lengths are evenly distributed across 12, 24, 36, and 48 characters. The payload strings are alphanumeric strings resembling hexadecimal sequences, where each character corresponds to four bits if interpreted as a hexadecimal symbol.
SPAD simulation. As in the previous case studies, each pixel count is sampled from the Binomial SPAD model. We set the light level to and use frames as the high-count target. During training, conditioning measurements are sampled with . The multistep model uses intermediate anchor counts .
7.2 Results
Qualitative stochasticity of multistep generation. We next visualize the conditional samples produced by the multistep model. Figure 12 shows repeated generations from a fixed conditioning measurement , together with the sample mean and standard deviation maps. At small , the generated samples vary substantially, and the standard deviation is concentrated around QR-code structures. As increases, the samples become more consistent, reflecting the transition from a stochastic to a deterministic regime for QR reconstruction.
Comparison with raw SPAD measurements. Finally, we compare decoding accuracy between restored QR-code samples and raw SPAD measurements without restoration. This comparison uses the same off-the-shelf QR-code decoder for both inputs. Figure 13 shows that raw SPAD measurements require approximately frames to reach stable decoding accuracy, whereas generated samples from the multistep model reach stable decoding with roughly frames. This result shows that the proposed generative restoration model enables task-level determinism at a much lower photon budget than raw SPAD measurements alone.
8 Case Study: Faces
As a final case study, we analyze the results of the proposed method on natural face images. We use grayscale images derived from the FFHQ dataset [Karras et al. 2019], train the proposed conditional SPAD generator, and evaluate whether generated samples preserve facial geometry through landmark detection and pose estimation.
8.1 Experimental settings
FFHQ-64 grayscale dataset. We use a pre-processed grayscale version of FFHQ derived from the raw PNG images, which contains 70,000 face images. We follow the train/validation split recommended by the official FFHQ release: images with index <60000
Haejoon Lee, Mohit Gupta, Vijayakumar Bhagavatula, and Aswin C. Sankaranarayanan

Target
Fig. 11. Conditional generation results with real captures in OCR task. We exhibit the restored grid of digits with selected number of measurements.

Fig. 12. Conditional QR-code generation results from the multistep model. Each column fixes the conditioning measurement at a given frame count , followed by generated samples, their sample mean, and their sample standard deviation. Each standard deviation map is normalized to have maximum value of 1.
are used for training and images with index >=60000 are used for validation, yielding 60,000 training images and 10,000 validation images. Each raw face image is converted to grayscale and resized to pixels.
SPAD simulation. Compared with the previous case studies, face images contain richer structure across multiple scales, from global pose and face shape to fine details such as eyes, mouth, and hair. We therefore use a higher light level, , and a larger high-count target of frames. During training, conditioning measurements are sampled with . We use intermediate anchor counts

Fig. 13. QR-code decoding accuracy of multistep generated samples compared with raw SPAD measurements. The generative model reaches stable decoding accuracy with far fewer conditioning frames.

(a) Landmark L2 distance grouped by facial regions
(b) Head pose angle error
Fig. 14. Facial-geometry errors for generated FFHQ samples. We compare MediaPipe landmarks and head pose estimated from generated samples against those estimated from high-count target images with frames.
8.2 Results
Downstream task: facial geometry prediction. To evaluate task-level determinism for faces, we measure whether generated samples preserve facial geometry. We apply the off-the-shelf MediaPipe Face Landmarker [Google AI Edge [n. d.]; Lugaresi et al. 2019] to both generated samples and high-count target images with frames. We then compare detected facial landmarks and estimated head pose.
Figure 14 reports the median landmark and pose errors, with the 25th–75th percentile range. As increases, both errors decrease and their distributions become tighter, indicating that the generated samples become more deterministic in facial geometry.
Figure 15 visualizes the detected landmarks on generated samples and raw SPAD measurements. MediaPipe detects landmarks on all generated samples, but fails on raw SPAD measurements until frames. In contrast, landmarks and pose on the generated samples are already mostly stable around . This shows that the generative model produces task-usable facial structure at much lower photon budgets than raw SPAD measurements.
Results on real data. Finally, we evaluate the FFHQ model on real SPAD measurements. We captured face images with the SPAD

Fig. 15. MediaPipe landmark visualizations on generated FFHQ samples and raw SPAD measurements. The generated samples support landmark detection at much lower frame counts than the raw SPAD inputs.
camera and performed the same preprocessing as the synthetic data: suppressing hot pixels and downsizing to pixels.
Figure 16 shows conditional generation results for the real captured face image. As expected, the generated samples are highly stochastic at small , but become increasingly consistent as the number of conditioning frames grows. Noticeably, we can observe that different facial features become stable at different photon budgets. In the shown examples, global structure such as face shape and pose becomes consistent with only a few frames, while finer details such as eyes, mouth, and hair require larger . In the second example, the presence of glasses is already consistent from a single binary SPAD measurement, and the sunglasses' appearance becomes stable by .
9 Discussions
A phase transition. Across multiple tasks, we see that there is a phase transition, typically between 20 and 50 frames, where the performance of classifiers or regressors is very close to its saturated value (i.e., the value at very large photon counts). That this phase transition occurs for such low photon counts is an important conclusion of this work. This has two immediate consequences. First, it suggests that operating SPAD sensors between four and six bits is a good operating point as far as inference performance is concerned; such higher bit depth readout provides significant reductions in the readout bandwidth. Second, if we are interested in reliable downstream inference, it suggests that we are likely to incur a to penalty in the time resolution of the sensor; given that commercially available sensors today operate at rates as high as 100 kHz, our work suggests that viable inference is possible in 2-5 kHz range.
Limitations. A key limitation of this work is that its conclusions are all empirical, and hence, subject to the specifics of the training dataset and vagaries of the protocols adopted. A theoretical counterpart to the phase transition results would help shed deeper insights
Haejoon Lee, Mohit Gupta, Vijayakumar Bhagavatula, and Aswin C. Sankaranarayanan

Fig. 16. Conditional generation results for real captured face images. For each fixed conditioning measurement , the figure shows generated high-count samples, their sample mean, and their sample standard deviation.
into the nature of the conditional posterior. However, such theory has remained elusive in other instances.
Another limitation is the intensive compute needed for successful training of the proposed conditional generative model. We reduced the resolution of images, especially for the faces dataset, to keep training times tractable/ For harder problems, such as natural images, we would also need to use more anchor frames, which would further acerbate the compute concerns.
The high flux regime. In high flux regimes, the probability of multiple photons arriving within each exposure becomes non-negligible. Surprisingly, this regime also results in a one-to-many problem since doubling or tripling the photon arrival rate doesn't results in a scaling of the SPAD measurements. The techniques developed in this paper are, in principle, capable of handling this scenario since the Binomial marginals applies just as well to the high flux case; a cavaet here is that we would need to train diffusion models capable of generating high dynamic range images.
Conclusion. This paper provides tools to model image synthesis over a photon budget landscape. We argue that in photon starved regimes the reconstruction problem is a one-to-many problem, a feature that has not been explored in prior work. To realize this, we develop a consistent theory of diffusion models with pixelwise Binomial distribution; this provides a toolbox for studying the one-to-many nature of the inverse problem, and how reconstruction and inference performance changes as the inverse problem becomes solvable. We believe this provide invaluable insights in the nature of SPAD sensors, in terms of practical operating points for them.
References
Jacob Austin, Daniel D Johnson, Jonathan Ho, Daniel Tarlow, and Rianne Van Den Berg. 2021. Structured denoising diffusion models in discrete state-spaces. Advances in neural information processing systems 34 (2021), 17981–17993.
Rongjun Chen, Yongxing Yu, Xiansheng Xu, Leijun Wang, Huimin Zhao, and Hong-Zhou Tan. 2019. Adaptive binarization of QR code images for fast automatic sorting in warehouse systems. Sensors 19, 24 (2019), 5466.
Tianqi Chen and Mingyuan Zhou. 2023. Learning to jump: Thinning and thickening latent counts for generative modeling. In International Conference on Machine Learning. 5367–5382.
Prateek Chennuri, Yiheng Chi, Enze Jiang, GM Dilshan Godaliyadda, Abhiram Gnanasambandam, Hamid R Sheikh, Istvan Gyongy, and Stanley H Chan. 2024. Quanta video restoration. In European Conference on Computer Vision. 152–171.
Prateek Chennuri, Dongdong Fu, and Stanley H Chan. 2025. Quanta Diffusion. In IEEE International Conference on Image Processing (ICIP). 229–234.
Rewon Child. 2020. Very deep vaes generalize autoregressive models and can outperform them on images. arXiv preprint arXiv:2011.10650 (2020).
Hyungjin Chung, Jeongsol Kim, Michael T McCann, Marc L Klasky, and Jong Chul Ye. 2023. DIFFUSION POSTERIOR SAMPLING FOR GENERAL NOISY INVERSE PROBLEMS. In International Conference on Learning Representations.
Prafulla Dhariwal and Alexander Nichol. 2021. Diffusion models beat gans on image synthesis. Advances in neural information processing systems 34 (2021), 8780–8794.
Lior Dvir, Nadav Torem, and Yoav Y Schechner. 2026. Diffusion in SPAD Signals. arXiv preprint arXiv:2601.07599 (2026).
Aryan Garg, Sizhuo Ma, and Mohit Gupta. 2026. gQIR: Generative Quanta Image Reconstruction. arXiv preprint arXiv:2602.20417 (2026).
Ian J Goodfellow, Jean Pouget-Abadie, Mehdi Mirza, Bing Xu, David Warde-Farley, Sherjil Ozair, Aaron Courville, and Yoshua Bengio. 2014. Generative adversarial nets. Advances in neural information processing systems 27 (2014).
Google AI Edge. [n.d.]. MediaPipe Face Landmarker. https://ai.google.dev/edge/mediapipe/solutions/vision/face_landmarker. Accessed: 2026-05-10.
Jonathan Ho, Ajay Jain, and Pieter Abbeel. 2020. Denoising diffusion probabilistic models. Advances in neural information processing systems 33 (2020), 6840–6851.
Tero Karras, Samuli Laine, and Timo Aila. 2019. A style-based generator architecture for generative adversarial networks. In Proceedings of the IEEE/CVF conference on computer vision and pattern recognition. 4401–4410.
Diederik P Kingma and Max Welling. 2013. Auto-encoding variational bayes. arXiv preprint arXiv:1312.6114 (2013).
Peng Lai, Ruifan Wu, Woliang Yuan, Haiying Li, and Ying Jiang. 2025. Poisson diffusion probabilistic model for low-dose SPECT sinogram denoising. Medical Physics 52, 6 (2025), 4250–4265.
Yann LeCun, Léon Bottou, Yoshua Bengio, and Patrick Haffner. 2002. Gradient-based learning applied to document recognition. Proc. IEEE 86, 11 (2002), 2278–2324.
Ruanan Liu, Lin Zhu, Xijie Xiang, Lizhi Wang, and Hua Huang. 2025. Noise-Modeled Diffusion Models for Low-Light Spike Image Restoration. In Proceedings of the IEEE/CVF International Conference on Computer Vision. 4080–4089.
Camillo Lugaresi, Jiuqiang Tang, Hadon Nash, Chris McClanahan, Esha Uboweja, Michael Hays, Fan Zhang, Chuo-Ling Chang, Ming Guang Yong, Juhyun Lee, Wan-Teh Chang, Wei Hua, Manfred Georg, and Matthias Grundmann. 2019. MediaPipe: A Framework for Perceiving and Processing Reality. In Third Workshop on Computer Vision for AR/VR at IEEE Computer Vision and Pattern Recognition.
Savvas Melidonis, Yiming Xi, Konstantinos C Zygalakis, Yoann Altmann, and Marcelo Pereyra. 2025. Score-based denoising diffusion models for photon-starved image restoration problems. Transactions on Machine Learning Research (2025).
Eliya Nachmani, Robin San Roman, and Lior Wolf. 2021. Non gaussian denoising diffusion models. arXiv preprint arXiv:2106.07582 (2021).
Jianping Qian, Xiaowei Du, Baoyan Zhang, Beilei Fan, and Xinting Yang. 2017. Optimization of QR code readability in movement state using response surface methodology for implementing continuous chain traceability. Computers and Electronics in Agriculture 139 (2017), 56–64.
Jascha Sohl-Dickstein, Eric Weiss, Niru Maheswaranathan, and Surya Ganguli. 2015. Deep unsupervised learning using nonequilibrium thermodynamics. In International conference on machine learning. 2256–2265.
Kihyuk Sohn, Honglak Lee, and Xinchen Yan. 2015. Learning structured output representation using deep conditional generative models. Advances in neural information processing systems 28 (2015).
Casper Kaae Sønderby, Tapani Raiko, Lars Maaløe, Søren Kaae Sønderby, and Ole Winther. 2016a. How to train deep variational autoencoders and probabilistic ladder networks. In 33rd International Conference on Machine Learning (ICML 2016).
Casper Kaae Sønderby, Tapani Raiko, Lars Maaløe, Søren Kaae Sønderby, and Ole Winther. 2016b. Ladder variational autoencoders. Advances in neural information processing systems 29 (2016).
Yang Song, Jascha Sohl-Dickstein, Diederik P Kingma, Abhishek Kumar, Stefano Ermon, and Ben Poole. 2020. Score-based generative modeling through stochastic differential equations. arXiv preprint arXiv:2011.13456 (2020).
Arash Vahdat and Jan Kautz. 2020. NVAE: A deep hierarchical variational autoencoder. Advances in neural information processing systems 33 (2020), 19667–19679.
Mian Wei, Sotiris Nousias, Rahul Gulve, David B Lindell, and Kiriakos N Kutulakos. 2023. Passive ultra-wideband single-photon imaging. In Proceedings of the IEEE/CVF International Conference on Computer Vision. 8135–8146.
Yutong Xie, Minne Yuan, Bin Dong, and Quanzheng Li. 2023. Diffusion model for generative image denoising. arXiv preprint arXiv:2302.02398 (2023).
yasin sancar. 2025. QR Code Dataset V2. (2 2025). doi:10.6084/m9.figshare.28424213.v1
Yuanzhi Zhu, Kai Zhang, Jingyun Liang, Jiezhang Cao, Bihan Wen, Radu Timofte, and Luc Van Gool. 2023. Denoising diffusion models for plug-and-play image restoration. In Proceedings of the IEEE/CVF conference on computer vision and pattern recognition. 1219–1229.
Haejoon Lee, Mohit Gupta, Vijayakumar Bhagavatula, and Aswin C. Sankaranarayanan
A Frame-Thinning Markov Chain
We prove Theorem 4.1. Let
where the first argument is the kept count, the population size is , the number of successes is , and the number of draws is .
PROOF. Define the forward path distribution by
Then
so the process is Markov by construction.
It remains to show that the Hypergeometric kernel preserves the Binomial marginal. It suffices to prove the scalar case. Suppose
and
For ,
(34)
Using
and setting , we get
(35)
The identity
with and gives
(36)
The sum equals 1, and
Therefore
Applying this independently over pixels proves
□
B Reverse Frame-Addition Kernel
Let and . Conditioned on , the missing binary frames are independent of the already retained frames. Hence
independently over i. Thus the oracle reverse kernel is
with support and .
If denotes the posterior distribution of after observing , then marginalizing gives
(39)
C ELBO Derivation
Let
denote the condition. The latent marginal likelihood is
For any variational posterior ,
(40)
The inequality is Jensen's inequality.
D Loss Terms
D.1 Binomial logit loss
Given , let and . Then
(41)
Using
we get
(42)
The first term is independent of the model parameters and is dropped in the practical loss.
D.2 Reparameterization
For a diagonal Gaussian posterior
a sample is written as
The factor 1/2 converts log-variance to standard deviation.
D.3 Gaussian KL
Let
Then
To see this, start from
For coordinate r,
Substitution into the Gaussian log densities gives (43).
D.4 Hierarchical latent groups
If the latent variable is grouped as
the prior and posterior are parameterized by one diagonal Gaussian per group. The total KL used in training is
where each groupwise term has the form (43), summed over all channels and spatial positions of that group.
D.5 Gap-normalized reconstruction loss
For one pixel, let and assume the oracle increment satisfies
The expected raw logit loss is
The excess risk above the optimum is
Thus the raw reconstruction term scales linearly with the frame gap . Dividing the reconstruction loss by removes this explicit scale factor. This is a training reweighting only; it does not change the generative kernel.
D.6 Single-step vs. multistep generation
We compare single-step and multistep reverse generation using QR decoding accuracy. Because the proposed pairwise model is conditioned on the source and target frame counts, it can be trained either to jump directly from to , or to reverse the SPAD ladder through intermediate anchor frames. The single-step model directly estimates
whereas the multistep model uses the anchor-based reverse chain described above.
For evaluation, we use the OpenCV WeChatQRCode decoder. We select 1,000 QR-code images from the validation set, simulate SPAD measurements, generate restored samples conditioned on each measurement, and compute the decoding accuracy. Figure 17 shows the results. The multistep model consistently achieves higher decoding accuracy than the single-step model in the stochastic regime, before performance saturates.
Figure 18 shows representative generations from the same low-count conditioning measurements. The multistep model produces sharper and more QR-like structures than the single-step model. These results support the use of intermediate anchors: decomposing a difficult restoration problem into smaller reverse transitions improves generation quality, consistent with the motivation behind multistep generative models such as diffusion and flow models.

Fig. 17. QR-code decoding accuracy of generated samples as a function of the number of conditioning SPAD frames .
Haejoon Lee, Mohit Gupta, Vijayakumar Bhagavatula, and Aswin C. Sankaranarayanan
Conditional Measurements
Single-step generation
Multistep generation



Target



Fig. 18. Comparison of single-step and multistep generated QR-code samples from the same low-count conditioning measurements.