
About this notebook
This notebook presents "Visual Diffusion Models are Geometric Solvers" (Goren et al., CVPR 2026), a paper that trains an image diffusion model to find inscribed squares in Jordan curves. The model reads a curve as a 128x128 binary image and denoises Gaussian noise into an image of a square inscribed in that curve. The notebook loads precomputed model samples from a 10 MB NumPy archive and plots them with matplotlib.
Four sliders drive a curve generator that runs live with NumPy and SciPy. They set the harmonic count, amplitude, radius, and seed of a procedural Jordan curve, and the notebook plots the curve next to the rasterized input the model receives. A dropdown selects one of five cached curves. Each sampling seed produces a different valid inscribed square, because diffusion sampling is multimodal. The model denoises in 100 steps, and for one curve the notebook shows the predicted image at every tenth step.
The diffusion model itself does not run in the notebook, because PyTorch is not available in Pyodide. A script in the source repository sampled the model offline and stored the results in the archive. The notebook extracts each square's outline with scikit-image's find_contours, overlays all samples for a curve as a coverage heatmap, and scores each sample with the paper's squareness metric.











