The recipe
One workflow for many instruments¶
Every problem in nefi is built from the same seven pieces. Change any one of them, such as the representation, the physics, a loss or the schedule, and the rest keeps working: the command line, the benchmark protocol, the diagnostics and the figures.
import nefi
def forward(x): # any differentiable PyTorch function of the unknown
return my_instrument(x)
problem = nefi.from_forward(forward, y, shape=(128, 128),
prior="nonnegative + piecewise_constant")
result = nefi.invert(problem)
print(nefi.quick_report(result, problem)) # did the fit reach the noise floor?
What's inside
Everything a per-measurement inversion needs¶
-
Physics as a hard constraint
Every candidate field passes through a differentiable forward operator: FFT convolutions, PDE solvers with exact adjoints, wave propagation, scattering, optics. The physics is never a soft residual — except in the PINN baseline, on purpose.
-
Representations as geometric priors
Neural fields, grids, hash grids, level sets, layered media, star shapes, warps. A parameterized update is the raw gradient filtered by \(G_\theta = J_\theta J_\theta^\top\), so choosing the representation is choosing the prior — and the measurement can choose.
-
Bring your own problem in 20 lines
nefi.from_forwardwraps any differentiable PyTorch function. Representation, initialization, noise level, loss weights, learning rate and curriculum are chosen automatically, logged, and overridable by a keyword. -
A physics zoo, 1-D to 3-D
Registered problems so far: NV magnetometry, thermography, CT, microscopy, EIT, Darcy flow, full-waveform inversion, diffraction tomography, holography, reaction–diffusion, diffuse optics and photoacoustics, each runnable with
nefi run <name> --smoke. -
Diagnostics that explain
Sensitivity maps, iter-0 gradients and center bias, filter-kernel rows \(G_\theta e_i\), singular-value spectra, energy barriers and the data-fit paradox: the papers' explanations, as functions that work on any problem.
-
Benchmarks with an inverse-crime guard
Paired samples × seeds, Student-t 95 % confidence intervals, runtime and memory columns, cumulative ablations and sweeps. Data come from an independent, finer simulator unless you explicitly — and visibly — opt out.
-
Auto-tuning
Detects gauges the data cannot see, budgets that stop short of the noise floor and mis-weighted priors; fixes what the data can fix, and reports what only a better acquisition could.
-
Edge refinement
A short second stage turns soft reconstructions into crisp interfaces under the same physics and data — and refuses, with the reason, when the data fit would degrade.
-
Interactive 3-D
Drag-to-rotate isosurfaces, voxels and slices of ground truth against reconstruction, with IoU and Dice computed in the browser — one self-contained HTML file, no libraries, no CDN.
-
Fast where it matters
Batched multi-measurement solving under
vmap, whole-steptorch.compile, a 7-kernel heat stencil with Chebyshev sweeps, and discrete adjoints at trajectory-sized memory. -
A command line for everything
nefi run · bench · diagnose · autotune · ablate · sweepon any registered instance or YAML config, with sharded benchmark campaigns and SLURM templates for GPU clusters. -
Reproducible by design
Every paper number is a config field; every run writes its effective config, metrics and history; seeds are deterministic. Paper-scale configs and a server runbook are included.
Gallery
A growing catalogue of systems¶
Reconstructions from single simulated measurements. The data always come from an independent, finer simulator than the one being inverted. Open a tile for the physics, the measurement and the numbers.
NV relaxometryspin sources · NeTMY
3-D sparse-view CTisosurface, edge-refined
Sparse-view CT16 views
Current densityNV magnetometry
Full-waveform inversionsound speed
Holographyphase retrieval
Deconvolutionimage deblurring
EITconductivity
Diffraction tomographyBorn scattering
Poisson source30 % observed
Reaction–diffusionGray–Scott feed rate
Darcy flowlog-permeability
Interactive
Rotate a reconstruction¶
Photoacoustic tomography of a vessel network from a planar sensor array: ground truth, the smooth neural-field reconstruction and its edge-refined version, on one camera. Drag to rotate, scroll to zoom; levels, IoU and Dice are recomputed in your browser.
Who it is for
Built for people with a forward model and no training set¶
Imaging scientists¶
You have an instrument such as a quantum sensor, a thermal camera, a CT scanner, a microscope or a sensor array, and a model of how it measures. Write the model in PyTorch, declare what you know about the unknown, and get a reconstruction together with a report on how well it explains your data. Bring your own problem →
Method developers¶
Compare representations, priors, schedules and optimizers on every registered problem under one fair protocol: shared objectives, paired seeds, confidence intervals, an inverse-crime guard, and diagnostics that explain why a method wins. Benchmarking →
Academic labs¶
Adopt one inversion toolkit for every instrument in your group: each setup becomes a registered problem with its own configuration, results stay reproducible from run to run, and the benchmark protocol yields publication-ready comparisons. New members start with eight tutorials, from a five-second toy to paper-scale runs on GPU servers, and a line-by-line map from the papers' equations to the code. Start the tutorials →
Research
The research behind nefi¶
nefi grew out of research on neural-field inversion at the CAB Lab, Princeton University: a series of papers that apply one idea to very different instruments. Two are published so far, NeTMY and NeFTY, and both ship as instances with paper-scale configurations. The recipe is written so that the papers that follow slot in the same way.
NeTMY — Neural Fields for NV-Center Inverse Sensing¶
Zhao, Zhong, Hu, de Leon, Allen-Blanchette · arXiv:2605.13988
Sparse spin sources and their Larmor field from the magnetic-noise spectra of a widefield
NV-center array, through a tensor power-summed dipolar operator; explains the center collapse
of free-density solvers with the filtering view of a parameterized update.
Instance: nv_relaxometry →
NeFTY — Neural Field Thermal Tomography¶
Zhong, Hu, Zheng, Sood, Allen-Blanchette · arXiv:2603.11045
Volumetric thermal diffusivity from pulsed-thermography surface frames, through a
differentiable implicit-Euler heat solver with harmonic-mean interfaces and a discrete adjoint;
explains why soft-constrained PINNs fit the data but not the interior.
Instance: thermal_tomography →
BibTeX
@article{zhong2026nefty,
title = {Neural Field Thermal Tomography: A Differentiable Physics Framework for
Non-Destructive Evaluation},
author = {Zhong, Tao and Hu, Yixun and Zheng, Dongzhe and Sood, Aditya and
Allen-Blanchette, Christine},
journal = {arXiv preprint arXiv:2603.11045},
year = {2026}
}
Install
Up and running in a minute¶
Python ≥ 3.10 and PyTorch ≥ 2.1; CPU is enough for every tutorial and smoke run, CUDA for paper scale. Next: install notes and a first run · the quickstart tutorial · how to cite.