---
title: First-Hitting Sampler (FHS)
url: https://www.emergentmind.com/topics/first-hitting-sampler-fhs
type: topic
---

# First-Hitting Sampler (FHS)

A First-Hitting Sampler (FHS) is a class of probabilistic sampling algorithms that generate random samples from the distribution of a stochastic process at the *first time* it reaches a specified target set or boundary. This framework generalizes the classical idea of strong stationary times and is applied to both discrete and continuous Markov processes (including diffusion models and Markov chains), underpinning unbiased simulation in rare-event analysis, generative modeling, sequential decision problems, and more. FHS fundamentally exploits the path decomposition at the first hitting time, offering rigorous guarantees, sharp error bounds, and practical efficiency in high-dimensional and structured spaces.

## 1. Foundational Principles of First-Hitting Sampling

FHS leverages the explicit pathwise decomposition of Markov processes at the stopping, or hitting, time of a target set. In discrete-time Markov chains, for a set $G$ in state space $X$, the first hitting time $T_G$ is the minimum $t$ such that $X_t \in G$. In diffusions or continuous time Markov processes (CTMCs), the first hitting time $\tau$ is defined analogously as the infimum over $t$ for which the process enters the absorbing boundary.

The FHS approach arises from the study of *strong stationary times* and their generalizations. The latter, especially *Conditionally Strong Quasi-Stationary Times* (CSQST), allow one to decompose the first-hitting probability law into a "mixing phase" toward a quasi-stationary regime and an independent geometric (or exponential) tail, which can be sampled exactly under explicit, verifiable conditions (e.g., ergodicity, primitivity) [1606.07244]. In continuous spaces, parametrix expansions or Doob’s $h$-transform are employed to represent exit-time densities and bridge laws [1609.09327, 2209.01170].

## 2. FHS in Discrete Markov Chains and Quasi-Stationarity

In a discrete Markov chain $(X_t)$ with transition matrix $P$, target/absorbing set $G$, and complement $A$, FHS exploits the quasi-stationary structure of $[P]_A$. After initial mixing to the quasi-stationary law $\mu^*$ in $A$ (CSQST $\tau$), the residual time until hitting $G$ is exactly geometric with parameter $1-\lambda$ (where $\lambda$ is the spectral radius of $[P]_A$). The joint law of $(T_G, X_{T_G})$ is then

\[
T_G = \tau + \delta_\alpha + R,
\]
with $R\sim\mathrm{Geom}(1-\lambda)$ and $\delta_\alpha$ a computable shift. This separation underpins an exact sampling algorithm: first mix to quasi-stationarity via the minimal CSQST, then simulate a geometric tail to the first hit, sampling the exit location from $w(y)$, the quasi-stationary exit distribution [1606.07244]. All components are computable from the underlying chain's eigenstructure, with pathwise and probabilistic correctness guarantees.

## 3. FHS for Continuous Diffusions and Stochastic Differential Equations

For stochastic differential equations (SDEs) and continuous diffusions, the FHS method is grounded in the parametrix expansion of hitting-time densities and Doob’s $h$-transform for path conditioning. Specifically, for a diffusion stopped at an absorbing boundary $L$, the joint law of $(\tau, X_\tau)$ is represented as a convergent series of density kernels (frozen bridge densities, Levy densities, and parametrix corrections), each admitting Gaussian-type bounds and analytic expressions involving Hermite polynomials [1609.09327]. The Monte Carlo FHS simulates Poisson-distributed random inter-arrival times and propagates "frozen" Euler bridges between these times, terminating upon hitting $L$ and correcting for bias through analytic weights—yielding an unbiased estimator for expectations involving $(\tau, X_\tau)$. This method is robust to regularity, supports heavy-tailed or truncated parametrix series, and achieves finite expected computational cost proportional to the mean hitting time.

## 4. FHS in Diffusion-Based Generative Modeling

The FHS paradigm has recently found impactful use in discrete latent diffusion models for generative modeling of symbolic data, such as text sequences and categorical images. In the *masked diffusion* setting, the process is described by a CTMC on $[S]^d$ with mask-absorbing rates for each coordinate. FHS here proceeds by iteratively unmasking coordinates in continuous time, exactly matching the jump-time and jump-index laws of the reverse CTMC. The sampling path is described by sequences of $(\tau_k, i_k, a_k)$, with randomness realized by uniform variables $u_n$ and coordinate selections [2602.22505].

Crucially, error analysis reveals that FHS’s sampling discrepancy is solely attributable to score estimation (e.g., the error in predicting conditional token probabilities by the learned network), with no discretization or surrogate-initialization error. This is in contrast to standard $\tau$-leaping Euler schemes, where discretization error persists even with perfect scores. The pathwise KL bound for FHS is

\[
\KL(q_0 \| \mathrm{Law}(x_0)_{\mathrm{FHS}}) \leq \varepsilon_{\text{score}},
\]
which is tight in an information-theoretic sense [2602.22505]. This dimension-free, vocabulary-free guarantee is significant for high-dimensional symbolic domains.

## 5. Algorithmic Formulations and Implementation

Several algorithmic variants of FHS exist, corresponding to discrete chains, diffusions, and masked CTMCs. Key components include:

- Precomputation of transition eigendata $(\lambda, \mu^*, y)$ and the local separation curve $s_\alpha(t)$ (discrete setting).
- Sampling of CSQST and geometric components for the total hitting time (discrete Markov chains).
- Poisson grid simulation, frozen bridges, and unbiased reweighting for one-dimensional diffusions [1609.09327].
- Direct jump-time computations, coordinate selection, and neural score predictions for masked diffusion models [2602.22505].
- Conditioning SDEs on exit locations via Doob’s $h$-transform and absorbing-surface boundary laws for FHS in generative modeling [2209.01170].

A table summarizing key FHS algorithmic elements in various settings:

| Setting                | Path Decomposition         | Practical Steps               |
|------------------------|---------------------------|-------------------------------|
| Discrete Markov chains | CSQST + geometric tail    | Eigenproblem, separation, sampling CSQST/tail [1606.07244]     |
| 1D Diffusions          | Parametrix series, Poisson grid | Simulate Poisson events, Euler bridges, weight corrections [1609.09327] |
| Masked Diffusion CTMCs | Exact unmasking sequence  | Sample jump-times/indices, neural score prediction per event [2602.22505] |

## 6. Convergence, Error Bounds, and Complexity

FHS often delivers strong, explicit guarantees. In masked diffusion models, the dimensionality and vocabulary size do not affect error bounds or convergence rates; the only source of statistical error is the score estimation accuracy ($\varepsilon_{\text{score}}$), as opposed to schemes like Euler/τ-leaping that incur additional initialization and discretization errors. Moreover, the information-theoretic lower bound for FHS matches the upper bound, confirming the tightness of analysis [2602.22505].

For elliptic diffusions, Gaussian-type bounds and complete control over the variance of Monte Carlo weights ensure practical unbiasedness and finite computational overhead for moderate parametrix truncation or Poisson intensity parameter choice [1609.09327]. In discrete metastable regimes, the CSQST is typically much shorter than the mean hitting time, making FHS computationally near-optimal [1606.07244].

## 7. Applications and Empirical Outcomes

FHS has demonstrated substantial benefits in a variety of domains:

- In generative modeling on point clouds, graphs, and categorical images, FHS (and the associated First Hitting Diffusion Models, FHDM) achieves higher sample quality and substantially reduces the number of diffusion steps required—often by an order of magnitude—compared to fixed-time, non-adaptive schedulers [2209.01170].
- In rare-event simulation and stochastic process analysis, FHS enables exact estimation of hitting-time distributions even in complex, non-reversible Markov chains or SDEs with general drift/diffusion structure [1606.07244, 1609.09327].
- In masked language modeling and large-scale symbolic data, FHS's guarantee of zero discretization error and tight convergence is particularly advantageous for scalability and sharp performance control [2602.22505].

A plausible implication is that future methodologies for generative modeling and rare-event simulation across a broad array of discrete and continuous domains will increasingly standardize on algorithms grounded in first-hitting path decompositions, supplanting classical fixed-time diffusion or decoupled sampling paradigms.

---

**References:**  
- [2602.22505] Sharp Convergence Rates for Masked Diffusion Models  
- [2209.01170] First Hitting Diffusion Models for Generating Manifold, Graph and Categorical Data  
- [1609.09327] On the first hitting times of one dimensional elliptic diffusions  
- [1606.07244] Strong times and first hitting

Source: https://www.emergentmind.com/topics/first-hitting-sampler-fhs