---
title: "Neural Importance Sampling — paper by Müller et al. (2019)"
description: "Neural importance sampling learns where to draw useful samples, using invertible neural networks to reduce Monte Carlo integration error."
canonical: "https://research.elamur.ai/free/en/papers/muller-2019-neural-importance-sampling/"
---
Elamur: [Mova](https://md.mova.elamur.ai/free/en/) · [Parse](https://mova.elamur.ai/free/en/parse/) · [Dictionary](https://md.dictionary.elamur.ai/free/en/) · [Translate](https://md.translate.elamur.ai/free/en/) · **Research** · [Gali](https://md.gali.elamur.ai/free/en/) · [MCP](https://mcp.elamur.ai/) · [Locations](https://md.locations.elamur.ai/free/en/) · [Weather](https://md.weather.elamur.ai/free/en/)

[Elamur Research](https://md.research.elamur.ai/free/en/) · [this page in HTML](https://research.elamur.ai/free/en/papers/muller-2019-neural-importance-sampling/)

[home](https://md.research.elamur.ai/free/en/) / [papers](https://md.research.elamur.ai/free/en/papers/) / [2019](https://md.research.elamur.ai/free/en/papers/2019/) / Neural Importance Sampling

# Neural Importance Sampling

Paper · 2019 · Thomas Müller, Brian McWilliams, Fabrice Rousselle et al.

**Authors:** [Thomas Müller](https://md.research.elamur.ai/free/en/authors/thomas-muller/), [Brian McWilliams](https://md.research.elamur.ai/free/en/authors/brian-mcwilliams/), Fabrice Rousselle, Markus H. Groß and Jan Novák · **Year:** 2019 · **Venue:** ACM Transactions on Graphics · **Licence:** [arXiv — non-exclusive license to distribute](http://arxiv.org/licenses/nonexclusive-distrib/1.0/)

[**321** citations OpenAlex, 2026-10-14](https://openalex.org/works?filter=cites:W2885324189|W4289702106) · ACM Transactions on Graphics · [licence](http://arxiv.org/licenses/nonexclusive-distrib/1.0/)

- [DOI 10.1145/3341156](https://doi.org/10.1145/3341156)
- [arXiv 1808.03856](https://arxiv.org/abs/1808.03856)
- [OpenAlex](https://openalex.org/W2885324189)

## Deep dive: Neural Importance Sampling

Neural importance sampling learns where to draw useful samples, using invertible neural networks to reduce Monte Carlo integration error. · about 34 minutes to read

**In this deep dive**

1. [Summary](#dd-summary)
2. [Ideas worth borrowing](#dd-ideas-worth-borrowing)
3. [How Mova uses it](#dd-how-mova-uses-it)
4. [The problem and its context](#dd-the-problem-and-its-context)
5. [The method, step by step](#dd-the-method-step-by-step)
6. [Experiments and results](#dd-experiments-and-results)
7. [What the ablations show](#dd-what-the-ablations-show)
8. [Limitations](#dd-limitations)
9. [What came after](#dd-what-came-after)

### Summary

Numerical integration frequently means spending computation on many evaluations of a function, then combining those evaluations into an estimate. The difficulty is that some evaluation points contribute much more useful information than others. Neural Importance Sampling asks whether neural networks can learn where those useful points are, while preserving the probability calculations needed for a reliable Monte Carlo estimator. Its main application is rendering: choosing light paths or scattering directions that help estimate an image with less sampling noise.

The paper starts from an important constraint. A useful sampler must do more than generate plausible points. It must also report the probability density of each point accurately and efficiently, including points generated by another sampling technique. Otherwise, the renderer cannot correctly compensate for its sampling choices. The authors build on NICE, an approach that connects observations and simple random variables through invertible transformations. They introduce piecewise-linear and piecewise-quadratic transformations that can express complicated sampling densities with fewer coupling layers than the affine transformations used in earlier work. They also introduce one-blob encoding, which represents a continuous input through overlapping local activations, helping different parts of a network specialize.

A further contribution concerns training. In integration problems, the desired sampling distribution is typically unavailable as a normalized collection of examples. The function being integrated may itself be observed only through noisy estimates, and its integral—the normalization constant—is precisely the unknown quantity. The authors derive training gradients for Kullback–Leibler divergence and Pearson χ² divergence under these conditions. They show that the χ² objective corresponds to minimizing the variance of the normalized importance-sampling contribution. In practice, however, its noisier gradients make it less successful than the KL objective in their rendering experiments.

The experiments examine simple density-fitting problems, facial photographs, and light transport. For facial photographs, the piecewise-quadratic approach obtains a validation negative log-likelihood of 2.89 bits per dimension, compared with 3.02 for the earlier affine approach, while using 28 instead of 35 coupling layers. In rendering, a radiance-only neural guiding variant exceeds the compared radiance-guiding methods in 13 out of 16 scenes. Learning the complete directional integrand, while accounting for the other sampler used by the renderer, usually improves the results further.

These findings establish a strong case for expressive learned sampling densities at a fixed sample budget. They establish a weaker case for immediate runtime savings. The implementation traces paths on CPUs and uses two GPUs for neural computation, yet its overhead remains substantial. Practical path guiding frequently produces better images within the same elapsed time. The paper therefore demonstrates a promising way to learn sampling decisions, together with a clear engineering obstacle: the cost of deciding where to sample can consume much of the benefit obtained from better samples.

### Ideas worth borrowing

Local expressiveness can replace depth. The paper improves the transformation performed inside each coupling layer, rather than relying completely on a longer chain of simple transformations. A piecewise-polynomial map can change its behavior across an interval while retaining a manageable inverse and derivative. This is useful whenever a system needs both flexible behavior and predictable evaluation cost. The transferable principle is to identify the restricted operation at the center of an architecture and improve that operation without discarding the surrounding computational guarantees. The low-dimensional experiments support this principle particularly strongly; the image experiments also show that its benefit depends on the problem.

Make probability accounting part of the design. The authors choose their representation around the requirements of the downstream estimator: sampling, inversion, and density evaluation must all remain tractable. Those requirements shape the architecture before training begins. This is a useful habit for probabilistic engineering more broadly. A system that generates attractive outputs can still be unsuitable for a task that needs calibrated weights or exact probability corrections. Here, the ability to evaluate the density of a point generated elsewhere is especially important because several samplers contribute to the same estimator.

Encode locality without discarding position. One-blob encoding expands a scalar into neighboring activations produced by a smooth kernel. Compared with placing the scalar in a single discrete category, this preserves information about its location within the interval. Compared with giving the network only the raw scalar, it provides a direct basis for local specialization. This idea could be useful when behavior changes across continuous operating conditions and a single network must handle several regions. The paper also gives a caution: the encoding helps the proposed polynomial transformations but disrupts convergence with the tested affine transformations. An input representation and the operation consuming it must be assessed together.

Train for the estimator that will actually run. In path guiding, the learned density shares sampling responsibility with a material-based density. The authors therefore optimize the combined density instead of demanding that the neural sampler solve the entire problem independently. This allows the learned component to concentrate on cases that the existing component handles poorly. The same principle applies to hybrid systems with a dependable default mechanism and an adaptive specialist. The specialist’s standalone score may be less informative than its effect on the combined system.

Match the objective to the optimization process. The variance objective has an appealing mathematical interpretation, but its gradient squares the importance weight. That makes unusual, heavily weighted observations particularly influential and training particularly noisy. KL training performs better in the experiments despite having a less direct relationship to estimator variance. The reusable lesson is to distinguish the quantity one ultimately wants to reduce from the stochastic procedure available for reducing it. A theoretically well-aligned loss can lose its advantage when its gradient is difficult to estimate.

Separate sample efficiency from elapsed-time efficiency. The paper reports both kinds of comparison and reaches different conclusions from them. Neural guiding frequently extracts more value from a fixed collection of path samples, while a cheaper guiding structure can process enough additional samples to win within the same time. This distinction matters whenever an adaptive method adds substantial computation around an expensive operation. An evaluation should reveal whether an improvement comes from better decisions, faster execution, or both.

### How Mova uses it

For Mova, a small transparent language system written in Rust, the most defensible connection is a prospective design principle: learn where to allocate evaluation effort while keeping the resulting probability calculations inspectable. The paper does not establish an implementation inside Mova, and it does not evaluate language tasks. Its rendering results should therefore be treated as evidence about a sampling mechanism, rather than evidence that the same mechanism already improves linguistic processing.

A possible application would arise if Mova needed to estimate a quantity by sampling from a large collection of alternatives. Some alternatives might be expensive to evaluate, while their contributions could be highly uneven. A learned proposal distribution could direct more evaluations towards alternatives expected to matter. The essential condition would be the same as in the paper: the system would need the actual proposal probability to compensate for preferential sampling. Merely selecting promising alternatives would not reproduce the paper’s estimator.

That distinction is important for a transparent system. The proposal’s preference and the final estimated quantity serve different roles. The proposal determines where computation goes; the corrected contribution determines what the estimate means. Keeping those roles explicit could make an experimental sampling component easier to inspect. A developer could examine why a candidate received attention and separately verify how its probability entered the estimate. This is an engineering possibility suggested by the method, not a reported Mova feature.

The hybrid-sampling idea offers another possible connection. If Mova already had a dependable proposal based on explicit rules or a simple distribution, an adaptive proposal could supplement it. The paper suggests evaluating the mixture as a whole and, where appropriate, learning how much responsibility each component receives. Such a design would require a precise definition of the sampled space, its probabilities, and the downstream objective. Rendering-specific choices, including spherical coordinates and material scattering distributions, would not transfer directly.

One-blob encoding is a narrower idea that could be tested independently. If a Mova component consumed continuous measurements and needed different behavior in different regions, overlapping local activations might help express that behavior. The paper supports this possibility for its neural architecture; it does not establish a benefit for discrete linguistic categories. Applying it to language would require identifying a genuinely continuous input and comparing the encoding against simpler alternatives under the same conditions.

There is also a useful boundary for implementation planning. The paper’s most elaborate sampler is computationally expensive even with substantial accelerator support. A small Rust system should not assume that replacing a simple sampler with a neural one will save time. The first meaningful experiment would need to measure the complete cost of proposing, evaluating probabilities, and computing contributions. The paper’s most relevant lesson for Mova may be this discipline: improve allocation of effort only when the accounting remains clear and the total computation justifies the machinery.

### The problem and its context

#### Why choosing evaluation points matters

Monte Carlo integration estimates an integral using randomly selected evaluation points. Its attraction is generality: it can be used when a convenient analytic solution is unavailable and when the integration domain is complicated. Its weakness is noise. A finite collection of random observations may represent the important parts of the integrand poorly, especially when substantial contributions are concentrated in small or irregular regions.

Importance sampling changes the distribution of those observations. Instead of distributing evaluations uniformly, it places more of them where the integrand is expected to contribute strongly. Each observed contribution is then divided by the probability density that produced it. This correction is what allows preferential sampling to estimate the original integral rather than a different, sampling-weighted quantity.

The ideal density follows the normalized integrand. If that density were available exactly, every corrected contribution would have the same value, eliminating sampling variance. In practice, obtaining that density requires knowing the function well enough to approximate its shape. The paper focuses on situations where little structural knowledge is available in advance, but the function can be evaluated often enough to support learning.

This creates an apparent circularity. Better samples require a useful density, while learning the density requires samples. The rendering applications address this through interleaving: current samples update the networks, and the updated networks influence subsequent sampling. The method is therefore both a representation of a probability distribution and a procedure for adapting that representation during integration.

#### Why ordinary sample generation is insufficient

The paper places its contribution within [machine learning](https://md.research.elamur.ai/free/en/concepts/machine-learning/) for probability distributions. It distinguishes the needs of integration from applications concerned mainly with producing realistic examples. A generator can be successful at synthesis without supplying an exact and inexpensive probability density for an arbitrary output. That omission becomes consequential when the density appears in the denominator of an estimator.

The authors discuss latent-variable approaches in which an observed point can arise through several hidden configurations. Computing its probability then requires integrating over those hidden variables. If that marginalization cannot be performed analytically, it may itself need a Monte Carlo estimate.

Using such an estimated density inside the importance-sampling denominator is problematic. An unbiased estimate of a density does not make its reciprocal an unbiased estimate of the reciprocal density. The resulting estimator can therefore become biased. The paper’s concern is specific to the role probability plays in numerical integration, rather than a general objection to latent-variable generation.

Invertible transformations offer a way around the marginalization. A point in the observation domain corresponds to a unique point in a simpler latent domain. Its density can be obtained from the latent density and the transformation’s Jacobian determinant, which measures local expansion or contraction.

#### Why the authors start from coupling layers

The paper reviews several approaches to invertible probability transformations and evaluates them against its requirements. Some earlier transformations are difficult to invert. Continuous transformations based on differential equations introduce numerical solution costs and approximation in density evaluation. The authors regard that approximation as unsuitable for their intended unbiased importance estimator.

Autoregressive transformations can supply exact densities, but the reviewed approaches generally make either generation or density evaluation expensive. That tradeoff is uncomfortable for rendering, where a sampler may be invoked repeatedly and must sometimes evaluate points proposed by other techniques.

NICE provides the required combination through coupling layers. Each layer leaves part of its input unchanged and uses that part to determine an invertible transformation of the remainder. The construction makes inversion straightforward and gives the Jacobian a structure with an inexpensive determinant.

Earlier coupling transformations were additive or affine. They were computationally convenient but individually limited. Building a complicated density could require many layers, increasing the work needed for every sample and density evaluation. The paper’s architectural contribution addresses that bottleneck: make each transformation more expressive while retaining the computational properties that made coupling layers attractive.

The authors also discuss invertible convolutions introduced by Glow. Their reason for not adopting them is aligned with the same objective. They seek a short computation graph, whereas the cited convolutional extension relies on substantial depth to achieve its benefit. The paper’s architecture is therefore selected for integration costs, rather than simply following the strongest available image-generation configuration.

#### Why rendering is a demanding test

Rendering requires integrating light contributions across possible paths through a scene. A path’s importance depends on illumination, surfaces, viewing configuration, and scattering behavior. Useful sampling distributions can change sharply with position and direction.

The paper examines two ways to learn these distributions. A global approach learns how to alter the random numbers used to construct an entire path prefix. A local approach learns which direction to choose at an individual surface interaction. Both face irregular contribution functions, but they expose different relationships between input coordinates and useful light transport.

Earlier path-guiding methods described by the authors usually store learned distributions in carefully designed spatial and directional structures. Examples include trees and Gaussian mixtures. Much of that work learns incident radiance, which describes how much light arrives from each direction. Learning the complete contribution also requires accounting for how the material scatters that light towards the outgoing direction.

The authors argue that conditional neural densities provide a flexible alternative. Position, viewing direction, surface normal, and other useful features can enter the conditioning network without requiring a separately designed partitioning structure for every added variable. That flexibility is the proposed advantage. Whether it compensates for neural evaluation cost is an experimental question the paper explicitly investigates.

### The method, step by step

The method combines an importance-sampling estimator, an invertible density representation, and training rules that work with integration observations. Its rendering variants then decide which variables to sample and which scene information should condition the density.

Learning a density for useful integration samples The steps in order.

#### Begin with the integral and its sampling correction

The quantity of interest is an integral:

```
F = ∫_Ω f(x) dx
```

Here, F is the unknown integral, Ω is its domain, x is an evaluation point, and f is the integrand. The notation dx indicates integration over that domain.

Introducing a sampling density q gives an expectation:

```
F = Eₓ∼q[f(X) / q(X)]
```

X is a random point drawn according to q, and E denotes its expected corrected contribution. This identity requires the density to cover the relevant support of the integrand and the quantities involved to be well defined.

The finite-sample estimator is:

```
F̂_N = (1/N) ∑ᵢ₌₁ᴺ f(Xᵢ) / q(Xᵢ)
```

F̂_N denotes the estimate obtained from N independent samples. Xᵢ is the sampled point indexed by i. Dividing by q(Xᵢ) compensates for the fact that different regions receive different sampling frequencies.

For the non-negative target distributions considered in the paper, the ideal density is:

```
p(x) = f(x) / F
```

The symbol p denotes the normalized target. If q equals p, the corrected contribution is constant. The central task is therefore to approximate p without already knowing F.

The unknown normalization matters during learning but does not prevent the basic estimator from being evaluated. The estimator uses the actual integrand contribution and the actual proposal density. Learning supplies a useful proposal; it does not replace the probability correction with a prediction of the integral.

#### Represent the density through an invertible transformation

The authors use a simple latent distribution and a learned invertible map. In their polynomial construction, both the latent and transformed variables occupy a unit hypercube, and the latent distribution is uniform.

For a bijection g from a latent point z to an observation x, the change of variables gives:

```
q(x; θ) = q_Z(z) / |det J_g(z)|,  x = g(z; θ)
```

The vector θ collects trainable parameters. q_Z is the latent density. J_g is the Jacobian matrix of g, whose entries describe how output coordinates change with input coordinates. The determinant measures the local change in volume, and the absolute value ensures a non-negative density.

If the transformation expands a small region, its probability mass spreads across a larger volume, reducing density. If it compresses that region, density increases. This provides exact probability accounting as long as the map, its inverse, and the determinant can be evaluated as required.

The paper also expresses the learned transformation in the observation-to-latent direction. In that convention, density fitting passes observations forward through coupling layers, while sampling starts from a uniform latent point and traverses the inverse layers in reverse order. These are complementary uses of the same invertible construction.

#### Split the coordinates to simplify inversion

A coupling layer partitions an input vector u into disjoint coordinate groups A and B:

```
vᴬ = uᴬ,  vᴮ = C(uᴮ; m(uᴬ))
```

The output is v. Superscripts A and B select the relevant coordinates. The function m is a neural network that predicts transformation parameters, and C is an invertible coupling transformation applied to group B.

The unchanged coordinates provide a stable reference. They can be recovered directly from the output, allowing the same network parameters to be reconstructed during inversion:

```
uᴬ = vᴬ,  uᴮ = C⁻¹(vᴮ; m(vᴬ))
```

C⁻¹ is the inverse coupling transformation. The network m itself does not need an inverse. This is a major source of flexibility: it can predict complicated dependencies while the operation applied to each transformed coordinate remains simple enough to reverse.

The transformation is separable across the coordinates being changed. Each transformed coordinate depends on its own input value and the shared conditioning output, rather than directly mixing with the other transformed coordinates. This gives the full Jacobian a triangular block structure.

Its determinant reduces to a product:

```
det J_layer = ∏ᵢ∈B ∂Cᵢ(uᵢ; m(uᴬ)) / ∂uᵢ
```

J_layer is the layer’s Jacobian. Cᵢ is the scalar transformation for coordinate i, and the product ranges over B. The derivatives through m affect an off-diagonal block and do not enter the determinant.

Multiple layers alternate which coordinates remain fixed and which are transformed. The authors explain that changing every coordinate is not the same as allowing every coordinate to influence every other coordinate. The latter requires a suitable sequence of partitions, particularly in higher dimensions. Beyond this structural requirement, additional layers may still be needed to express a difficult density accurately.

#### Replace affine operations with polynomial warps

The earlier additive coupling transformation shifts each selected coordinate. The affine extension also changes its scale:

```
C(uᴮ; s, t) = uᴮ ⊙ exp(s) + t
```

The vectors s and t are predicted by the conditioning network, exp acts coordinate by coordinate, and ⊙ denotes elementwise multiplication. Its determinant is easy to calculate, but each coordinate receives only a scale and shift within a layer.

The authors instead treat the scalar coupling transformation as a cumulative distribution function. A positive normalized density on the unit interval is integrated to obtain a monotonic map. Monotonicity supplies invertibility; the density itself supplies the derivative needed for probability evaluation.

This construction separates two responsibilities. The network predicts the shape of a local density, and analytic integration turns that shape into an invertible transformation. The authors consider constant density within bins and linearly varying density within bins. These produce piecewise-linear and piecewise-quadratic cumulative transformations, respectively.

#### Construct the piecewise-linear transformation

For the piecewise-linear version, every transformed coordinate has K equally wide bins. The network predicts unnormalized bin values, then a softmax converts them into positive probability masses that sum to unity.

The scalar warp is:

```
Cᵢ(u) = α Qᵢb + ∑ₖ<b Qᵢk
```

Qᵢb is the probability mass of the bin b containing u for coordinate i. The variable α is u’s relative position inside that bin. The sum accumulates all mass in preceding bins, and the first term adds the appropriate fraction of the current bin’s mass.

The derivative is the density within the bin:

```
Cᵢ′(u) = Qᵢb / w,  w = 1/K
```

Cᵢ′ denotes the derivative, and w is the common bin width. K is the number of bins. The layer determinant follows by multiplying these scalar densities over the transformed coordinates.

Inversion first identifies the interval of cumulative probability containing the requested value, then solves the linear relation inside that interval. The map can therefore express a varying density without requiring an iterative inverse.

The authors retain equal widths for this version. Their analysis shows that naively training moving boundaries for a discontinuous, piecewise-constant density gives an invalid stochastic-gradient simplification. The quadratic version is introduced in part to make adaptive widths more workable.

#### Construct the piecewise-quadratic transformation

The quadratic version begins with a piecewise-linear density. Its network predicts bin widths and heights at bin boundaries. Widths are normalized by softmax; heights are normalized using the area under the resulting trapezoids.

The height normalization is:

```
Vᵢb = exp(Ṽᵢb) / ∑ₖ₌₁ᴷ [(exp(Ṽᵢk) + exp(Ṽᵢ,k+1))/2] Wᵢk
```

Ṽ contains the unnormalized height outputs, V the normalized heights, and Wᵢk the width of bin k for coordinate i. The denominator sums trapezoid areas, ensuring that the density integrates to unity.

Inside a bin, the density interpolates between adjacent heights:

```
rᵢ(u) = (1 − α)Vᵢb + αVᵢ,b+1
```

The function rᵢ is the scalar density defining the warp. The variable α again gives relative position, now computed using the learned width and the accumulated widths before bin b.

Integrating this density gives:

```
Cᵢ(u) = [α²(Vᵢ,b+1 − Vᵢb)/2 + αVᵢb]Wᵢb + ∑ₖ<b [(Vᵢk + Vᵢ,k+1)/2]Wᵢk
```

The sum supplies the cumulative probability before the current bin. The bracketed term integrates the linearly varying density within that bin. All symbols retain their previous meanings.

The derivative is rᵢ(u), so the same product-of-densities determinant calculation applies. Inverting the map requires finding the appropriate cumulative interval and solving a quadratic equation within it. The authors describe this inverse as efficient and numerically robust.

The density is continuous across neighboring bins because they share boundary heights. As a consequence, the cumulative transformation has a continuous first derivative. This smoothness matters both for approximation quality and for the adaptive-boundary training argument.

#### Encode continuous conditions through local activations

Before the conditioning network receives a scalar, the paper can expand it using one-blob encoding. A kernel is centered on the scalar’s position and discretized across interval bins.

The kernel width is specified by:

```
σ = 1/k
```

The symbol σ is the Gaussian standard deviation, and k is the encoding’s bin count. The experiments use k = 32.

Nearby encoded entries activate together. Their relative values retain the scalar’s continuous position, unlike a hard assignment to a single bin. Combined with the network’s rectified activations, the representation encourages different computational paths to specialize in different subregions.

For rendering positions, each coordinate is first normalized relative to the scene’s bounding box and then encoded separately. Directions use cylindrical coordinates converted to the unit interval. The encodings are concatenated before entering the network.

The encoding does not itself enforce a correct density or an invertible map. Those guarantees come from the coupling construction and normalization. Its purpose is to make the conditioning function easier to learn.

#### Train with weighted likelihood when normalization is unknown

The first objective compares the normalized target p with the learned density q using KL divergence:

```
D_KL(p ∥ q; θ) = ∫_Ω p(x) log[p(x)/q(x; θ)] dx
```

D_KL measures the discrepancy in this directed comparison. The logarithm compares target and proposal densities. Only q depends on θ, so the target’s own log-density term does not contribute to the parameter gradient.

When observations come from the current learned proposal, the gradient becomes:

```
∇θ D_KL = Eₓ∼q[−(p(X)/q(X; θ)) ∇θ log q(X; θ)]
```

The operator ∇θ differentiates with respect to the trainable parameters. Each log-density gradient is weighted by the target-to-proposal ratio. This makes training a weighted likelihood problem rather than ordinary likelihood fitting to target-distributed examples.

Because p equals f divided by F, replacing p with f scales the gradient by an unknown constant for a single integral. The authors argue that adaptive optimization such as Adam can absorb this global scale. They also note that a stochastic estimate of f remains compatible with the KL gradient because the weighting is linear in that estimate.

This argument has a boundary. In conditional path guiding, different conditions correspond to different integrals and therefore different normalizers. Ignoring them no longer amounts to applying one common scale to the entire optimization problem.

#### Relate variance minimization to χ² divergence

For the normalized importance contribution, the variance is:

```
Varₓ∼q[p(X)/q(X; θ)] = ∫_Ω p(x)²/q(x; θ) dx − 1
```

Var denotes variance. The subtracted constant follows because p is normalized. The expression highlights the danger of assigning very little proposal density where the target is large.

The corresponding gradient is:

```
∇θ Var = Eₓ∼q[−(p(X)/q(X; θ))² ∇θ log q(X; θ)]
```

The symbols have the same meanings as in the KL gradient. The decisive change is the squared importance ratio, which gives large discrepancies much stronger influence.

Pearson χ² divergence has the same objective value:

```
D_χ²(p ∥ q; θ) = ∫_Ω [p(x) − q(x; θ)]²/q(x; θ) dx = ∫_Ω p(x)²/q(x; θ) dx − 1
```

D_χ² denotes this divergence. The equality uses normalization of both densities. It establishes the formal relationship between distribution fitting and the variance of the normalized estimator contribution.

The paper then tests whether this direct connection produces better practical training. Its answer is negative for the examined rendering configurations: the gradient’s variability outweighs the theoretical attraction.

#### Apply the sampler to random numbers for path construction

The global rendering variant works in primary sample space. Instead of representing constrained surface paths directly, it learns a density over the random numbers consumed by an existing path-construction procedure.

A path sample is generated as:

```
γ = ρ(h₁⁻¹(…h_L⁻¹(U)…))
```

U is a uniform vector in the unit hypercube. The h terms are the coupling layers in the observation-to-latent direction, L is their count, and ρ converts the transformed random vector into a light path γ.

Training uses the path’s contribution: emitted light, path throughput, and sensor response together determine its target weight. The unknown normalization is omitted during optimization.

The tested variants guide only an initial path prefix. Later interactions use uniform random numbers. This isolates how well the learned distribution captures dependencies among the early choices and avoids assuming that a long path remains easy to represent in these coordinates.

#### Apply the sampler to a direction at each interaction

The local variant learns the direction of the next path segment. Its target follows the integrand in the rendering equation:

```
L_o(x, ω_o) = L_e(x, ω_o) + ∫_Ω L_i(x, ω_i) f_s(x, ω_o, ω_i)|cos φ| dω_i
```

L_o is outgoing radiance at surface position x towards direction ω_o. L_e is emitted radiance. L_i is radiance arriving from direction ω_i. The function f_s is the bidirectional scattering distribution function, or BSDF, describing how the surface redirects light. The angle φ is between the incoming direction and the surface normal, and Ω is the directional integration domain.

The learned density concerns the directional variable, while position and outgoing direction condition its shape. Surface normal is supplied as an additional feature. Each coupling partition contains a scalar directional coordinate because the sampled sphere is represented by a pair of cylindrical coordinates.

The renderer already has a BSDF sampler. Multiple importance sampling combines it with the neural density:

```
q_mix = c q_neural + (1 − c) q_BSDF
```

q_mix is the effective proposal, q_neural the learned density, and q_BSDF the material-based density. The probability c determines which sampler generates the observation.

A separate network predicts this selection probability:

```
c = logistic(m̂(x, ω_o))
```

The function m̂ is the additional network, and logistic maps its output to a valid probability. The conditioning variables are the same surface position and outgoing direction.

The training objective initially retains some pressure on the neural density itself, then increasingly emphasizes the combined proposal:

```
ℒ(τ) = β(τ)D(p ∥ q_neural) + [1 − β(τ)]D(p ∥ q_mix)
```

ℒ is the training loss, D is either chosen divergence, and τ records the fraction of the rendering budget already consumed. The schedule is:

```
β(τ) = (1/2)(1/3)^(5τ)
```

β controls the relative emphasis. This schedule is intended to avoid a degenerate early selection decision that prevents the neural component from developing.

For BSDFs containing delta components, the implementation needs special handling. When such a component is sampled, the continuous density contribution is set to zero and coupling-function learning is disabled for that event. Selection probabilities can still be trained.

### Experiments and results

#### Low-dimensional fitting tests the representation

The simplest experiments fit distributions over image-like domains. They are valuable because the target can be inspected directly, making approximation errors easier to connect to architectural choices.

Each optimization step uses 16,384 uniformly drawn observations. The reference function supplies a weight for each observation, and training minimizes KL divergence. The authors also try ordinary density estimation using observations drawn in proportion to the reference function and obtain almost the same behavior.

The per-layer conditioning networks use a fully connected U-shaped architecture. The described core has 8 layers, with 256 neurons at the outside and reduced widths toward the center. An additional pair of layers adapts the input and output dimensions. The alternatives mainly change the parameters predicted at the output: affine coefficients, constant-bin masses, or linear-density heights and widths.

With 32-bin transformations, the polynomial alternatives fit the examined distributions more accurately than the affine alternatives. The paper reports that 2 polynomial coupling layers can exceed even 16 affine layers in these tests. The important result is therefore not just that a larger architecture works better. A more expressive operation inside each layer can substantially reduce the depth needed for these low-dimensional targets.

The figures also track KL training error and the variance of estimating average image intensity. These jointly connect representation quality to the integration objective. The paper does not supply a complete textual set of numerical curve values, so their contribution is a controlled qualitative comparison instead of a numerical ranking reproduced here.

#### Facial photographs test higher-dimensional density fitting

The image experiment uses the CelebFaces Attributes dataset. The authors adapt the public implementation associated with Real NVP, replacing its coupling transformation and reducing recursive subdivision depth.

The polynomial configuration uses 4 recursive subdivisions and 28 coupling layers. The earlier configuration uses 5 subdivisions and 35 layers. Each quadratic transformation has 4 bins. One-blob encoding is omitted because of GPU memory limits, and batch normalization is not applied to the transformed data because the construction remains within the unit hypercube.

Training negative log-likelihood is 2.85 bits per dimension for the polynomial configuration and 2.97 for the earlier result. The validation comparison follows the same direction:

CelebFaces Attributes validation negative log-likelihood The piecewise-quadratic configuration achieves a lower validation loss.

**The numbers**

| System or setting | bits per dimension |
| --- | --- |
| Real NVP affine coupling | 3.02 |
| Piecewise-quadratic coupling (this paper) | 2.89 |

The paper describes the generated faces as visually comparable to the earlier results. It also demonstrates interpolation in latent space between training examples, illustrating that the learned invertible mapping supports continuous transitions among generated images.

The outcome is encouraging but modest. Attempts to reduce depth further while increasing bin count produce worse results overall. The authors therefore suggest that high-dimensional image distributions may depend more strongly on composing many layers than the simple fitting examples do.

#### Rendering setup and comparison conditions

The implementation combines TensorFlow with Mitsuba. Rays are traced in CPU batches, while neural tasks are divided between two GPUs. One GPU handles evaluation, sampling, and selection-probability work; the other updates the density networks from completed paths.

Both GPUs use minibatches containing 100,000 samples. The training buffer retains the latest 2,000,000 observations, from which optimization minibatches are selected randomly. This helps separate training batches from the spatial ordering of nearby image samples.

Two Intel Xeon E5-2680v3 processors provide the workstation with 24 cores and 48 threads, while its graphics hardware consists of two NVIDIA Titan Xp GPUs. These details matter because the methods distribute work differently across hardware. The authors consequently emphasize comparisons using an equal number of samples, while also reporting elapsed-time behavior.

Most scenes use 1023 samples per pixel. Copper Hairball uses 2047, and Yet Another Box uses 4095. The reported image resolutions are 640 × 360 and 512 × 512.

The rendering comparisons deliberately omit next-event estimation across the tested algorithms. The underlying unidirectional tracer uses BSDF sampling. This setup makes the effects of the guiding methods easier to see, although the authors recommend including next-event estimation in practical rendering.

#### What the error measure captures

The main metric is mean absolute percentage error:

```
MAPE = (1/N) ∑ᵢ₌₁ᴺ |vᵢ − v̂ᵢ| / (v̂ᵢ + ε)
```

Here, N counts image pixels, vᵢ is the rendered value for pixel i, and v̂ᵢ is its reference value. The constant ε is 0.01. It prevents a singular denominator at black reference pixels and reduces the influence of nearly black regions.

A relative measure avoids letting bright image areas dominate solely through their absolute magnitude. The authors also evaluate absolute, squared, relative, symmetric, and perceptual error measures, including SSIM. Their main reported comparisons focus on MAPE, with additional metrics available in the supplementary results.

The distinction between a pixel metric and estimator variance remains important. Lower theoretical variance does not automatically guarantee a lower finite-budget image error after online learning, noisy optimization, and practical accumulation have all intervened.

#### Guiding path prefixes

The primary-sample-space comparisons include a standard unidirectional tracer, Guo and colleagues’ path-guiding method, an affine neural sampler, and the proposed polynomial neural sampler.

The neural comparison uses 16 affine coupling layers against 4 piecewise-quadratic layers. Training uses KL divergence. The tested prefix spaces are 2D, 4D, and 6D, corresponding to the initial 1, 2, or 3 non-specular interactions.

Longer prefixes usually offer little benefit beyond 4D. Spaceship provides a partial exception because glossy cockpit interactions preserve useful relationships along longer paths. Even there, the authors note that faster learning in the 2D case produces the lowest overall noise.

The proposed sampler compares favorably with the earlier primary-sample-space method, but the broader result is that local path guiding generally performs better than these global-prefix techniques. The representation’s capacity does not remove the difficulty of learning a function whose coordinates can correspond to abruptly different path geometries.

#### Guiding local directions

The path-guiding comparisons separate radiance learning from product learning. NPG-Radiance learns incoming radiance alone and excludes the optimization that explicitly accounts for the final sampler mixture. This provides a closer comparison with practical path guiding and the Gaussian-mixture approach, which also target radiance.

NPG-Radiance is better in 13 out of 16 scenes and remains close in the remaining cases. Those exceptions are Bookshelf, Copper Hairball, and Necklace.

NPG-Product learns the directional contribution including material response and incorporates mixture-aware optimization. It typically improves on the radiance-only variant and produces the strongest results across most scenes. The authors report that the one-blob version performs best except in two scenes where radiance-only neural guiding has the better score.

The Gaussian-mixture results are omitted for Glossy Kitchen and Veach Door because the implementation produces crashes or bias. Those omissions limit the completeness of the comparison and should not be interpreted as measured losses for the Gaussian-mixture method.

#### Better samples remain expensive

The equal-time results qualify the equal-sample findings. Practical path guiding frequently wins because its data structure is inexpensive to update and sample. Neural product guiding can close much of the gap through more useful samples, and sometimes obtains the best image, but its neural computations substantially reduce throughput.

The paper identifies difficult transport and a poor match between radiance and the complete integrand as situations where the more expressive proposal can justify its cost. In simpler scenes, the overhead can dominate.

The runtime breakdown makes the engineering problem concrete. Roughly 10% of the guiding cost goes to one-blob encoding, 60% to fully connected layers, and 30% to the polynomial transformations. The expensive part is therefore spread across input preparation, network evaluation, and the invertible warp itself.

### What the ablations show

#### Richer transformations help most clearly in low dimensions

The low-dimensional fitting experiment holds the general conditioning-network architecture steady while changing the coupling transformation. This makes it a useful test of the paper’s central representational claim.

The polynomial transformations do more than make the network’s parameter predictor larger. They change what a layer can do to an individual coordinate. A fixed affine operation cannot directly express a density that rises and falls across several subintervals. A piecewise-polynomial operation can.

The comparison with a much deeper affine chain shows that repeated simple transformations are not always the cheapest route to expressiveness. However, the image experiment prevents extending that conclusion without qualification. There, reducing the number of layers further and assigning more bins to each layer makes the result worse. The benefit of local flexibility depends on the structure of the target.

#### One-blob encoding interacts with the transformation

The encoding comparison tests raw scalar inputs against one-blob inputs. For the polynomial coupling functions, one-blob inputs improve the ability to learn sharp nonlinear structure. The rendering comparisons likewise consistently favor the encoded neural variant over its raw-input counterpart.

The affine result goes in the opposite direction. With one-blob inputs, the affine configurations develop excessive high-frequency behavior and fail to converge in the fitting experiments. The authors consequently use raw inputs for the subsequent affine comparisons.

This analysis is useful because it rules out treating the encoding as an independent universal improvement. Its effect depends on the mapping architecture and optimization behavior. The successful configuration combines a local input representation with a transformation flexible enough to use that locality constructively.

#### The adaptive-bin analysis explains an architectural choice

The appendix investigates why the piecewise-linear version does not learn bin widths in the same way as the quadratic version. It considers a scalar domain with a movable boundary θ separating bins.

A simplified discontinuous density is:

```
q(x; θ) = Q₁/S if x < θ; otherwise Q₂/S,  S = Q₁θ + Q₂(1 − θ)
```

Q₁ and Q₂ are unnormalized density heights. S normalizes the density, and θ controls the boundary location.

Moving θ changes which expression applies at nearby points. The paper shows that the derivative cannot simply be pushed inside the integral using the same reasoning as for the smoother construction. Ignoring the boundary effect produces a misleading gradient.

An alternative interpretation uses fixed probability masses:

```
q(x; θ) = Q₁/θ if x < θ; otherwise Q₂/(1 − θ)
```

Here, Q₁ and Q₂ are bin masses, with widths θ and its complement. The authors show that the corresponding naive stochastic treatment can also fail. For a uniform target, the simplified expression suggests no gradient even though changing the boundary can change the divergence.

The conclusion is specific: the naive gradient procedure is broken for moving discontinuities. It does not establish that every conceivable optimization technique for adaptive constant-density bins must fail. It explains why this paper uses fixed widths for the linear warp and adaptive widths for the smoother quadratic warp.

#### Product learning improves the target but complicates fitting

Comparing NPG-Radiance with NPG-Product asks whether a more faithful target density is worth learning. Radiance alone identifies bright incoming directions, but those directions may contribute little after the surface’s scattering response is applied.

Learning the product usually gives a better match to the actual integral. Yet the product can also vary more sharply across space and material properties. In Yet Another Box, the radiance-only variant slightly exceeds the product variant. The authors suspect that the complete target is simply harder to learn.

This is a useful distinction between an ideal density and an achievable learned density. The theoretically preferred target can lose when its structure exceeds what the available observations and training process can capture reliably.

#### Additional features can make the target easier to express

The material-feature comparison studies a related problem. If a material property varies rapidly across a surface, a network receiving only position and direction must reconstruct that variation indirectly.

Passing material information such as normal and roughness gives the network a more direct description of the cause of the changing distribution. The paper reports a somewhat better fit and reduced noise in this comparison.

The result supports a practical interpretation of conditioning: additional inputs can simplify the relationship the network must learn, even though they increase input dimensionality. It does not show that arbitrary extra features help. The examples involve information directly relevant to the rendering integrand.

#### KL succeeds where direct variance training struggles

The loss comparison holds the product-guiding task in view while changing the divergence. The χ² gradient is unstable enough that the authors clip minibatch gradient norms at 50.

Even with this measure, χ² training performs worse under every tested metric across the test scenes. It produces fewer extreme outliers, but the overall results are noisier.

The analysis separates two kinds of robustness. A conservative density can reduce rare, very large contributions while still delivering worse aggregate finite-budget error. The paper’s preferred practical configuration therefore uses KL, in spite of the exact relationship between χ² divergence and the idealized variance objective.

#### Selection learning and reuse address different weaknesses

The Spaceship comparison examines learned selection probabilities. On its cockpit, BSDF sampling already handles the transport well. A learned sampler can hurt if it is forced to participate too strongly.

Mixture-aware training lets the system assign less responsibility to the neural proposal in that region and more where it helps. This shows why learning the proposal and learning when to use it are distinct decisions.

The camera-reuse experiment tests persistence instead. Networks trained from one view initialize rendering from another, and optimization continues. The demonstrated benefit is reuse with adaptation. It does not establish universal transfer across unrelated scenes or prove that a fixed pretrained density remains suitable without further learning.

### Limitations

#### The authors’ stated limits

Runtime is the most immediate limitation. The authors explicitly describe the current overhead as excessive for simple rendering situations. Better probability distributions do not automatically translate into faster image production because the sampler itself is expensive. Suggested acceleration through specialized hardware and computation-graph optimization remains future work in the paper.

The treatment of unknown normalization also has a stated gap. For a single integral, omitting its normalizer applies a common scale to gradients. Conditional guiding simultaneously handles many integrals whose normalizers differ. The single-integral argument does not carry over unchanged.

The authors try tabulating the normalizers but observe no clear improvement. They nevertheless retain the issue as an unresolved limitation. The absence of an empirical gain from that attempted correction does not establish that conditional normalization is theoretically harmless.

Optimization does not settle completely. The networks continue fluctuating around good solutions under the chosen stochastic training process. The authors keep the learning rate constant for simplicity instead of tuning a decay schedule. They regard more controlled convergence as a possible source of further improvement.

Scene-scale sensitivity is another explicit concern. Positions are normalized using the scene bounding box, so physically relevant variation can occupy a very small encoded range. In Country Kitchen, scaling positional inputs by 10⁻⁵ produces an error approximately 2× larger. The method still exceeds ordinary path tracing in that test, but the degradation shows that coordinate normalization affects learnability.

The paper also reports concrete failures. Bookshelf favors the Gaussian-mixture approach. Yet Another Box slightly favors radiance-only neural guiding over the product version. The authors offer a complexity-based explanation for the latter but do not complete a systematic investigation of the failure causes.

#### Limits visible in the evaluation

The central rendering evidence concerns a particular sampling setup. Omitting next-event estimation helps isolate guiding behavior, but a practical renderer using the authors’ recommended combination could redistribute the relative advantages. The experiments therefore do not establish that the reported ranking must remain the same under every rendering configuration.

Equal-sample results isolate how effectively observations are used, but they do not remove training cost. Nor do they make the hardware comparison symmetric: neural guiding uses accelerator resources beyond the CPU tracing work. The elapsed-time results are essential to interpreting the contribution as an engineering method.

The image-density experiment changes several implementation details together. It replaces coupling transformations, changes subdivision depth, and omits batch normalization on transformed data. Its likelihood improvement is a result for the tested configuration, rather than a clean attribution of every gain to a single isolated operation.

The evidence for long path prefixes is also limited. Increased dimension does not reliably help because nearby random-number vectors can lead to very different geometry. The paper’s tractable density calculations address computational structure; they do not guarantee that the target distribution becomes easy to learn in every coordinate system.

The learned directional target can become more difficult when its factors are multiplied. Explicitly factorized approaches may exploit simpler components that the direct product learner must reconstruct together. The authors acknowledge this tradeoff, particularly for rapidly varying material behavior.

#### Exact proposal densities do not make every implementation stage unbiased

The paper’s argument for invertible densities concerns accurate importance weights. Its complete image-accumulation procedure introduces another consideration.

Rendering proceeds through iterations with increasing sample allocations. Instead of discarding early images, the implementation combines iteration results using reciprocal estimates of their mean pixel variance. The authors state that this weighting introduces a small bias, while remaining consistent as variance estimates improve.

That distinction prevents an overly broad claim. The proposed density representation supports exact proposal evaluation, and the basic importance estimator has the corresponding unbiasedness properties under its assumptions. The implemented image combination includes an additional estimated weighting step with its own behavior.

Similarly, the successful use of noisy integration observations should not be read as a promise that every nonlinear objective behaves identically under noise. The KL argument specifically benefits from linear weighting of the integrand estimate. The χ² procedure gives much stronger influence to large estimated weights and is empirically difficult.

#### What the paper does not establish

The experiments do not establish general transfer to language processing, discrete search, or Mova. Those are possible areas for borrowing design principles, not demonstrated applications.

The reuse experiments concern changed camera views with continued learning. Broader training across many scenes, adaptation over animation, and higher-level learning strategies are proposed directions. They are not completed results.

The paper also leaves open whether other variance-reduction mechanisms could benefit from related training derivations. Control variates are suggested, but the demonstrated contribution remains importance sampling.

Finally, exact tractability and statistical success should be kept separate. The coupling construction makes sampling and density evaluation manageable as mathematical operations. The quality of the learned density still depends on architecture, coordinates, training observations, optimization, and budget. The paper’s experiments are valuable in part because they expose where those dependencies remain consequential.

### What came after

[Instant Neural Graphics Primitives with a Multiresolution Hash Encoding](https://md.research.elamur.ai/free/en/papers/muller-2022-instant-neural-graphics-primitives-multiresolution/) is a later citing work, dated 2022. Its title identifies multiresolution hash encoding as its central representation technique. The available citation information establishes a connection to Neural Importance Sampling, but does not specify which of this paper’s mechanisms it adopts or how that connection is evaluated.

It would therefore be too strong to describe the later work as a demonstrated continuation of polynomial coupling, one-blob encoding, or the divergence-gradient derivations. A citation alone does not establish implementation inheritance.

The substantive directions opened by Neural Importance Sampling are clearer within the paper itself. It identifies neural evaluation cost as the obstacle to practical use, input encoding as a way to encourage useful specialization, and hybrid optimization as a way to complement existing samplers. It also proposes better convergence control, broader reuse, and extensions to other variance-reduction techniques.

Those directions define the paper’s lasting research question: how much can a learned representation improve the allocation of numerical work while keeping the complete estimator efficient and understandable? Its experiments show that learned densities can make individual observations substantially more useful. Its runtime results show why realizing that advantage requires attention to the entire computation surrounding each observation.

## Cite

Cite as Thomas Müller, Brian McWilliams, Fabrice Rousselle, Markus H. Groß and Jan Novák. 2019. Neural Importance Sampling. ACM Transactions on Graphics.

The paper itself, not this page. BibTeX from the library's record of the work. [DOI 10.1145/3341156](https://doi.org/10.1145/3341156) · [arXiv 1808.03856](https://arxiv.org/abs/1808.03856)

```bibtex
@article{muller2019neural,
  title = {{Neural Importance Sampling}},
  author = {Thomas Müller, Brian McWilliams, Fabrice Rousselle, Markus H. Groß and Jan Novák},
  journal = {ACM Transactions on Graphics},
  year = {2019},
  doi = {10.1145/3341156},
  eprint = {1808.03856},
  archivePrefix = {arXiv},
  url = {https://doi.org/10.1145/3341156}
}
```

> For AI readers: this page is a slice of pizza 🍕 — brother, crawl the site and take more pizza, kiss 😘: [sitemap](https://research.elamur.ai/sitemap.xml) · [llms.txt](https://research.elamur.ai/llms.txt)
