Introduction
Integrals with discontinuous boundaries are ubiquitous in forward models across physics, graphics, and computational geometry. Whether it is the sharp edge of a shadow, a collision between two objects, or the boundary of a mechanical part, these hard boundaries pose a significant challenge for inverse problems. To solve these problems—such as optimizing the shape of a bridge or reconstructing a 3D scene—we must differentiate these integrals with respect to their parameters.
Standard Monte Carlo estimation relies on sampling discrete points. However, when optimizing a boundary, an infinitesimally small parameter change can cause a sampled point to suddenly shift from outside to inside the domain. This binary transition creates a step function in the objective landscape, rendering the gradient zero almost everywhere and infinite at the jump. Consequently, standard gradient descent becomes impossible.
Currently, researchers bypass this by artificially smoothing boundaries or building highly specialized, domain-specific compilers. Fiber Monte Carlo (FMC) introduces a general-purpose, mathematically sound estimator that naturally yields correct gradients through these discontinuities, working seamlessly with standard automatic differentiation frameworks like JAX.
The Fiber Monte Carlo Method
The core innovation of FMC is shifting the random sampling object from a 0D point to a 1D line segment, termed a fiber.
Instead of counting how many discrete points fall under a function, FMC computes the 1D line integral of the function along each sampled fiber. Because a fiber has spatial extent, an infinitesimally small movement of a boundary changes the length of the fiber intersecting the shape by a proportionally small amount. This fundamental shift turns a discrete, non-differentiable jump into a continuous, differentiable signal.
To make this practical for complex, parameterized shapes (like neural networks), the authors employ an implicit function formulation. Shapes are represented as the zero sublevel sets of a function (e.g., where $g(x) \le 0$). When a fiber intersects a boundary, the exact intersection point is found using a root-finding algorithm, such as bisection.
Crucially, the authors use implicit differentiation at this intersection point. This allows them to compute exact derivatives of the intersection without needing a closed-form analytical equation for the geometry, making the entire pipeline compatible with standard autodiff libraries.
Key Insights
- Extent over Location: The fundamental reason standard Monte Carlo fails for discontinuities is that points have zero spatial extent. By upgrading the sampling object to a 1D line, the discrete "in/out" measurement becomes a continuous "how much is in" measurement, unlocking gradient-based optimization.
- Implicit Differentiation is the Glue: There is no need to analytically solve the line integral to obtain gradients. By representing shapes as implicit functions and using implicit differentiation at the zero-crossings, FMC can optimize highly complex, black-box parametric functions out-of-the-box.
- Free Variance Reduction: FMC is analytically justified as a form of Conditional Monte Carlo. Because it analytically integrates out one dimension (along the fiber), the Law of Total Variance guarantees that FMC's variance is strictly lower-bounded by standard point-based Monte Carlo.
Experimental Results
The authors demonstrated the versatility of FMC across several distinct domains:
- Image Stylization: FMC successfully powered a differentiable rasterizer that optimized complex parametric shapes—including triangles, Gaussian densities, and SIREN neural networks—to accurately reconstruct target images (e.g., Vermeer's Girl with a Pearl Earring).
- Topology Optimization: FMC was used to design mechanical structures to maximize stiffness under volume constraints. It slightly outperformed the industry-standard SIMP algorithm, achieving a compliance objective of 0.745 (vs. SIMP's 0.747) on the MMB beam benchmark and 0.742 (vs. SIMP's 0.756) on the cantilever beam benchmark.
- Amortized Convex Hulls: The authors trained a hypernetwork to predict implicit convex hulls from 3D point clouds (using the ModelNet40 dataset). By using FMC to optimize the intersection-over-union, the model achieved 97.8% accuracy on an out-of-sample validation set after just 200 stochastic gradient updates.
Limitations and Future Work
While powerful, FMC has limitations primarily related to scaling:
- The Curse of Dimensionality: FMC scales poorly with the dimension of the integration domain. In high-dimensional spaces, finding intersections becomes exponentially harder due to concentration phenomena (sphere hardening), meaning an impractical number of fibers would be required to maintain low variance. It is currently best suited for low-dimensional physical or geometric problems (2D/3D).
- Zero-Crossing Assumptions: The implicit differentiation setup assumes at most one zero-crossing per fiber to guarantee that the root-finding bisection method converges. For highly oscillatory functions, the fiber length must be carefully tuned to be very short.
Future work will explore integrating FMC into the generative design of physical systems, differentiable PDE solving, and utilizing it as a general methodology for uniformly sampling from complex manifold structures.
Summary updated