---
title: Neural Importance Resampling (NIR)
url: https://www.emergentmind.com/topics/neural-importance-resampling-nir
type: topic
---

# Neural Importance Resampling (NIR)

Neural Importance Resampling (NIR) is a sampling strategy for neural quantum states (NQS) that combines importance resampling with a separately trained autoregressive proposal network, so that variational Monte Carlo can sample from the target distribution \(p_\theta(s)\propto |\psi_\theta(s)|^2\) without forcing the NQS itself to be autoregressive [2507.20510]. It is designed for settings in which Markov chain Monte Carlo (MCMC) mixes slowly and direct autoregressive NQS impose undesirable architectural constraints, especially for symmetry-aware and determinant-based multi-state ansätze. The acronym is not unique: in medical imaging, “NIR” also denotes “Neuron Incidence Redistribution,” a fairness regularizer unrelated to sampling or resampling [2605.19393].

## 1. Definition and problem domain

In NQS-based variational Monte Carlo, the central computational task is repeated sampling from the probability law induced by the current wave function. For a single-state ansatz \(\psi_\theta(s)\), where \(s\) is a basis configuration, the required sampling distribution is
\[
p_\theta(s)=\frac{|\psi_\theta(s)|^2}{\sum_{s'}|\psi_\theta(s')|^2}.
\]
NIR replaces direct sampling from this distribution by a two-network scheme: the primary NQS represents the wave function, while an auxiliary autoregressive model \(q_\phi\) proposes configurations that are then corrected by importance resampling. The method is therefore a learned sampling wrapper around an unrestricted NQS, not a restriction on the wave-function parameterization itself [2507.20510].

The immediate motivation is architectural decoupling. Standard MCMC is asymptotically correct but can suffer from slow mixing, autocorrelation, equilibration problems, local trapping, and dependence on hand-designed proposals. Autoregressive NQS avoid MCMC by exact ancestral sampling, but they enforce a sequential factorization of the variational ansatz and make symmetry enforcement, global constraints, and determinant-based multi-state constructions harder. NIR is explicitly presented as a way to retain direct neural sampling while leaving the NQS architecture unrestricted [2507.20510].

## 2. Motivation from single-state and multi-state neural quantum states

The single-state target law is the usual \(p_\theta(s)\propto |\psi_\theta(s)|^2\). The multi-state setting is more demanding and is central to the method’s motivation. For \(K\) states, the paper considers a determinant construction
\[
\mathbf{\Psi}(s^1,\ldots,s^K)=
\det\!\begin{pmatrix}
\psi_1(s^1) & \cdots & \psi_K(s^1) \\
\vdots & \ddots & \vdots \\
\psi_1(s^K) & \cdots & \psi_K(s^K)
\end{pmatrix},
\]
with corresponding target distribution
\[
p(s^1,\ldots,s^K)\propto |\mathbf{\Psi}(s^1,\ldots,s^K)|^2.
\]
By construction this law is permutation-invariant in the order of the \(K\) configurations. Sampling from it is difficult for both local MCMC and direct autoregressive NQS, even when each constituent single-state network is itself autoregressive [2507.20510].

This difficulty is especially acute in sharply multimodal regimes. The paper emphasizes the ferromagnetic phase of the two-dimensional transverse-field Ising model, where dominant configurations can be far apart in configuration space. A local Markov chain then mixes poorly, whereas a learned autoregressive proposal can generate configurations in distinct modes and the resampling step can correct the residual proposal mismatch. This suggests that NIR is best understood as a response to a specific bottleneck of variational NQS algorithms: sampling, rather than wave-function evaluation, becomes the limiting factor in difficult many-body regimes [2507.20510].

## 3. Algorithmic structure and correctness

NIR introduces a separate autoregressive proposal model
\[
q_\phi(s)=\prod_{j=1}^N q_\phi(s_j\mid s_1,\ldots,s_{j-1}),
\]
with its own parameters \(\phi\). For a sampling batch, one first draws a pool of \(N_q\) candidates
\[
s^1,\ldots,s^{N_q}\sim q(s).
\]
Each candidate is assigned an importance weight
\[
w_j=\frac{p(s^j)}{q(s^j)}.
\]
Because NQS targets are often known only up to normalization, the implementation uses unnormalized weights such as
\[
\tilde w_j\propto \frac{|\psi_\theta(s^j)|^2}{q_\phi(s^j)}
\]
for single-state NQS, or
\[
\tilde w_j\propto \frac{|\mathbf{\Psi}_\theta(s^j)|^2}{q_\phi(s^j)}
\]
for the multi-state determinant case. Final outputs are then resampled from the candidate pool with probabilities
\[
\mathbb P(\text{select }s^j)=\frac{w_j}{\sum_{k=1}^{N_q}w_k}.
\]
If \(N_p\) target-like samples are required, the algorithm repeats this categorical draw \(N_p\) times [2507.20510].

The paper notes that plain importance sampling with self-normalized estimators is an alternative:
\[
\mathbb E_p[f(s)]
=
\frac{\mathbb E_q\!\left[f(s)\frac{p(s)}{q(s)}\right]}
{\mathbb E_q\!\left[\frac{p(s)}{q(s)}\right]},
\qquad
\hat{\mathbb E}_p[f]
=
\frac{\sum_{j=1}^{N_q}w_j f(s^j)}{\sum_{j=1}^{N_q}w_j}.
\]
It nevertheless adopts resampling for implementation reasons: once resampled configurations are produced, the rest of an existing VMC code can treat them approximately as direct target draws, so downstream local estimators, energy calculations, and parameter gradients need no additional reweighting logic. In this form NIR has no chain state, no warmup, no thinning, and no serial dependence between successive samples [2507.20510].

The correctness argument is the standard one for importance resampling. If \(q(s)>0\) whenever \(p(s)>0\), then weighting by \(p/q\) corrects proposal mismatch, and as \(N_q\to\infty\) the empirical weighted measure converges to the target measure. The paper uses the term “unbiased” to indicate that NIR does not impose architectural bias on the NQS and uses exact proposal correction through importance weights, but it also notes that finite-\(N_q\) resampling is only asymptotically exact rather than exactly unbiased for all nonlinear estimators [2507.20510].

## 4. Proposal network, online adaptation, and overlap control

The proposal is an autoregressive Transformer that outputs probabilities directly rather than amplitudes. Each site value is embedded, positional embeddings are added, causal masking is used, and the input sequence is shifted by prepending a learnable token and dropping the last token so that prediction at site \(j\) depends only on previous sites. In the multi-state determinant setting, the proposal acts on tuples \((s^1,\ldots,s^K)\), and proposal training randomly permutes the order of the \(K\) states so that the model learns the permutation invariance of the determinant target [2507.20510].

Proposal training is online and adaptive because the target distribution changes as the NQS evolves. The paper considers both forward and backward KL objectives,
\[
L_\mathrm{f}=\sum_s p(s)\log\frac{p(s)}{q(s)},
\qquad
L_\mathrm{b}=\sum_s q(s)\log\frac{q(s)}{p(s)},
\]
with gradients
\[
\frac{\partial L_\mathrm{f}}{\partial \theta_j}
=
-\left\langle
\frac{\partial}{\partial\theta_j}\log q(s)
\right\rangle_{s\sim p},
\qquad
\frac{\partial L_\mathrm{b}}{\partial \theta_j}
=
\left\langle
\bigl(\log q(s)-\log p(s)\bigr)
\frac{\partial\log q(s)}{\partial\theta_j}
\right\rangle_{s\sim q}.
\]
The implemented method uses the forward KL. The stated reason is that forward KL is mean-seeking and penalizes missing target support, which is aligned with the requirement \(q(s)>0\) whenever \(p(s)>0\). Backward KL was easier to optimize but tended to produce mode collapse, with some high-probability target regions assigned very small proposal mass and thus becoming effectively unrecoverable by resampling [2507.20510].

To monitor overlap, the paper experimented with effective sample size diagnostics but found a simpler statistic more useful: the standard deviation of
\[
\log\frac{p(s)}{q(s)}.
\]
In the ideal case this quantity is constant across samples, so the standard deviation is zero. NIR defines a threshold \(\alpha_{\mathrm{thr}}=3.0\); when the observed standard deviation exceeds that threshold, the proposal network is retrained until overlap improves again. This makes the proposal an amortized but nonstationary sampler that tracks the current NQS rather than a frozen auxiliary model [2507.20510].

## 5. Integration into variational Monte Carlo and empirical performance

Within VMC, NIR simply supplies the samples needed for local estimators and gradients. For an operator \(\hat O\), the local estimator is
\[
O_{\mathrm{loc}}(s)=\sum_{s'} \frac{\psi(s')}{\psi(s)} O_{s,s'},
\]
and observable expectations are estimated by averages over samples distributed according to \(\psi^2\). For the energy gradient with respect to variational parameters,
\[
\frac{\partial E}{\partial\theta_j}
=
2\Re\!\left\{
\left\langle
H_{\mathrm{loc}}(s)\,
\frac{\partial}{\partial\theta_j}\log\psi^{*}(s)
\right\rangle
-
\left\langle H_{\mathrm{loc}}(s)\right\rangle
\left\langle
\frac{\partial}{\partial\theta_j}\log\psi^{*}(s)
\right\rangle
\right\},
\]
NIR contributes only by providing the sampling mechanism. Because the implementation uses resampled target-like configurations rather than explicit downstream importance weights, existing VMC code can remain largely unchanged [2507.20510].

The experiments focus on the two-dimensional transverse-field Ising model
\[
\hat H = -\sum_{\langle j,k\rangle}\hat\sigma_z^j\hat\sigma_z^k - g\sum_j \hat\sigma_x^j.
\]
Most calculations use an \(8\times 8\) lattice with open boundaries. The multi-state ansatz searches for the three lowest-energy states using a determinant construction with \(K=3\). Each constituent NQS is a 4-layer MLP of width \(256\) with layer normalization and GELU activations. The proposal is a Transformer with embedding dimension \(64\), four attention heads, and four Transformer layers. Both NQS and proposal are optimized with Adam; the NQS additionally uses minSR. The batch size is \(512\), and total NQS training runs for \(10{,}000\) steps [2507.20510].

The principal sampler comparison is against MCMC in the deep ferromagnetic regime \(g=0.1\). On \(3\times3\) and \(4\times4\) lattices, both samplers perform similarly. On the \(8\times8\) lattice, MCMC becomes highly unstable and often gets trapped in an excited state with energy far above the sum of the three lowest levels, whereas NIR remains stable. Against DMRG with bond dimension \(100\), NQS+NIR agrees well on the absolute energy scale across \(g\in[0,6]\), captures the closing and reopening of the gap for \(g\in(2,3)\), matches DMRG to numerical precision in the ferromagnetic regime, and is described as most advantageous near the phase-transition region before that advantage diminishes again in the easier paramagnetic regime [2507.20510].

## 6. Conceptual position, adjacent usages, and limitations

NIR occupies a specific place among learned sampling and resampling methods. In particle filtering, neural resampling has meant a differentiable set-to-set particle transformer that maps weighted particles to equally weighted particles; that method is a learned transport-style resampler, not classical importance resampling over NQS configurations [2004.11938]. In off-policy reinforcement learning, “importance resampling” denotes replay sampling proportional to policy-ratio weights followed by ordinary updates, again a distinct use of resampling from the NQS setting [1906.04328]. In rendering, several neural methods learn proposals or warps rather than resample candidate pools, including primary-sample-space warping [1808.07840], many-light proposal learning [2505.11729], and neural BRDF sampling by reparameterization [2505.08998]. These comparisons suggest that the distinctive feature of NIR in the NQS sense is not merely that it is neural or that it uses resampling, but that it uses a separately trained autoregressive proposal to correct sampling for an unrestricted variational wave function.

The limitations are equally specific. NIR depends critically on sufficient proposal–target overlap; if \(q_\phi\) misses important regions of \(p_\theta\), the weights become extremely uneven and resampling degenerates. Proposal retraining is therefore an additional moving part and a genuine computational overhead. The threshold \(\alpha_{\mathrm{thr}}\), batch size, proposal architecture, and KL objective matter in practice. The paper reports that forward KL was more robust than backward KL because backward KL became mode-seeking and collapsed onto only part of the target support. More broadly, NIR is presented as a practical sampling method, not as a universal cure: its empirical success relies on maintaining a good amortized proposal throughout VMC optimization [2507.20510].

A further source of ambiguity is terminological. The same acronym appears in unrelated domains, most notably “Neuron Incidence Redistribution” in fairness-aware medical image classification, where NIR denotes a regularization term on penultimate-layer activations rather than any form of importance sampling or resampling [2605.19393]. For that reason, the unqualified term “NIR” is domain-sensitive. In the NQS literature, however, it refers specifically to the learned proposal-plus-resampling strategy introduced for variational many-body quantum simulation [2507.20510].

Source: https://www.emergentmind.com/topics/neural-importance-resampling-nir