---
title: 'FlatCAD: Curvature-Regularized Neural SDFs'
url: https://www.emergentmind.com/topics/flatcad
type: topic
---

# FlatCAD: Curvature-Regularized Neural SDFs

FlatCAD is a curvature-regularized approach to neural signed-distance field (SDF) learning tailored for computer-aided design (CAD) geometry. It introduces an efficient curvature proxy that targets only the off-diagonal (mixed) Weingarten term, allowing scalable enforcement of developable, CAD-style surface behavior in neural SDFs. FlatCAD eliminates the need for full Hessian evaluation and second-order automatic differentiation, reducing both memory footprint and computational costs while maintaining or improving geometric fidelity on engineering-grade shape reconstruction tasks.

## 1. Mathematical Foundations of Curvature Regularization

FlatCAD operates on the implicit neural surface representation:
\[
f: \mathbb{R}^3 \to \mathbb{R}, \quad \mathcal{S} = \{x \mid f(x) = 0\}
\]
where $f$ is a multilayer perceptron (MLP) realized SDF. The first derivative $\nabla f(x)$ provides surface normals:
\[
n(x) = \frac{\nabla f(x)}{\|\nabla f(x)\|}
\]
satisfying the eikonal constraint $\|\nabla f\| = 1$ near $\mathcal{S}$. Curvature information is encoded in the Hessian $H_f(x) = \nabla^2 f(x)$, whose restriction to the tangent plane forms the shape (Weingarten) operator:
\[
S = \begin{pmatrix}
u^T H_f u & u^T H_f v \\
v^T H_f u & v^T H_f v
\end{pmatrix}
\]
with $(u, v)$ an orthonormal basis for the tangent space at $x$. Principal curvatures $\kappa_1, \kappa_2$ are the eigenvalues of $S$, and Gaussian curvature $K = \kappa_1 \kappa_2 = \det S$.

FlatCAD's core innovation is to penalize only the off-diagonal (mixed) term, $S_{12} = u^T H_f v$. Under rotation by $\theta$, $S_{12}$ becomes:
\[
S_{12}(\theta) = \tfrac12 (\kappa_2 - \kappa_1) \sin 2\theta
\]
and its squared expectation over random $\theta$ yields
\[
\mathbb{E}_\theta[S_{12}^2] = \frac{(\kappa_2 - \kappa_1)^2}{8}
\]
Regularizing $|S_{12}|$ biases the surface locally toward developability ($\kappa_1 \approx \kappa_2$), suppressing warp while allowing uniform bending or flattening, as desired in CAD reconstructions.

The full FlatCAD training loss:
\[
\mathcal{L}_\mathrm{total} = \mathcal{L}_\mathrm{DM} + \lambda_\mathrm{DNM}\mathcal{L}_\mathrm{DNM} + \lambda_\mathrm{eik}\mathcal{L}_\mathrm{eik} + \lambda_\mathrm{proxy} \mathcal{L}_\mathrm{proxy}
\]
comprises a on-surface Dirichlet term $\mathcal{L}_\mathrm{DM}$, an off-surface term $\mathcal{L}_\mathrm{DNM}$ (with $\alpha=100$), an eikonal term $\mathcal{L}_\mathrm{eik}$, and the curvature proxy $\mathcal{L}_\mathrm{proxy}$ applied on a shell of $L$ near-surface points via
\[
\mathcal{L}_\mathrm{proxy} = \frac{1}{L} \sum_{\ell=1}^L \left|\frac{u_\ell^T H_f(p_\ell) v_\ell}{\|\nabla f(p_\ell)\|}\right|
\]
Recommended weights are $\lambda_\mathrm{DM}=7000$, $\lambda_\mathrm{DNM}=600$, $\lambda_\mathrm{eik}=50$, and $\lambda_\mathrm{proxy}=10$.

## 2. Implementation Strategies for the Curvature Proxy

FlatCAD enables two operationally distinct but mathematically equivalent instantiations for the off-diagonal curvature penalty:

### 2.1. Finite-Difference Proxy

This approach approximates the mixed second-order derivative $u^T H_f v$ without explicit Hessian computation. For a shell point $x_\Omega$ and step $h$:
- $f_0 = f(x_\Omega)$
- $f_u = f(x_\Omega + h u)$
- $f_v = f(x_\Omega + h v)$
- $f_{uv} = f(x_\Omega + h u + h v)$

The mixed-difference stencil yields:
\[
D_{uv}^{(+)}(x_\Omega) = \frac{f_{uv} - f_u - f_v + f_0}{h^2} = u^T H_f(x_\Omega)v + O(h)
\]
Thus, the curvature proxy at $x_\Omega$ is
\[
\widehat{S}_{12}(x_\Omega) = \frac{D_{uv}^{(+)}}{\|\nabla f(x_\Omega)\|} + O(h)
\]
requiring four forward SDF evaluations per proxy point and one gradient, with $O(h)$ error vanishing as $h\rightarrow 0$.

### 2.2. Autodiff (Hessian-Vector Product) Proxy

This variant leverages vector-Hessian products and reverse-mode autodiff without forming the full Hessian:
1. Compute $f(x_\Omega)$ (forward).
2. Get $g = \nabla f(x_\Omega)$ (reverse).
3. Form $g_v = g \cdot v$.
4. Compute $h_v = \nabla_x(g_v) = H_f(x_\Omega) v$ (second reverse).
5. Contract: $mixed = u \cdot h_v$.
6. Normalize: $S_{12} = mixed / \|g\|$.
The cost is two backward sweeps per point, with no explicit Hessian storage.

#### Pseudocode

```python
for each proxy point x:
    f0 = f(x)
    g = grad(f0, x)
    gv = dot(g, v)
    hv = grad(gv, x)
    mixed = dot(u, hv)
    S12 = mixed / norm(g)
    L_proxy += abs(S12)
L_proxy /= L
```

*Editor's term*: Finite-difference (Proxy-FD) and autodiff (Proxy-AD) proxies exhibit near-identical accuracy.

## 3. Practical Training Loop and Computational Complexity

A single FlatCAD training iteration comprises:
1. Sampling $N$ on-surface points for $\mathcal{L}_\mathrm{DM}$.
2. Sampling $M$ free-space points for $\mathcal{L}_\mathrm{DNM}$.
3. Sampling $K$ points for $\mathcal{L}_\mathrm{eik}$.
4. Drawing $L$ shell points with tangent frames for $\mathcal{L}_\mathrm{proxy}$.
5. Forward pass: $f(\cdot)$ at all points; $\nabla f(\cdot)$ at eikonal and proxy points.
6. Loss computation and gradient update.

In traditional full-Hessian Gaussian curvature regularization (as in NeurCADRecon), each sample requires all six independent second derivatives—necessitating six Hessian-vector products per point—which leads to large memory graphs and prohibitive GPU utilization.

By contrast:
- Proxy-AD requires only one Hessian-vector product (two backward sweeps) per proxy point, with memory scaling comparable to standard first-order autodiff.
- Proxy-FD forgoes second-order graphs entirely—using only four forward SDF evaluations and a single gradient per proxy point.

Empirical complexity (NVIDIA H100, $1$MB ABC subset):

| Method         | Iter Time (ms) | Conv Time (s) | GPU Mem (GB) |
|----------------|---------------|---------------|--------------|
| DiGS           | 2.99          | 289.8         | 1.61         |
| NSH            | 1.84          | 151.8         | 1.79         |
| NeurCADRecon   | 5.60          | 455.2         | 6.06         |
| Proxy-AD       | 2.54          | 191.8         | 3.46         |
| Proxy-FD       | 3.13          | 172.7         | 3.69         |

Both FlatCAD variants roughly halve memory and wall-clock time compared to NeurCADRecon, with minimal impact on convergence behavior.

## 4. Empirical Evaluation on CAD Datasets

FlatCAD has been validated on the ABC benchmark in two regimes: "1 MB set" (100 random CAD parts, $\approx$1 MB) and "5 MB set" (100 hand-selected models, $\approx$5 MB). Core metrics are Normal Consistency (NC; higher is better, $\times10^2$), Chamfer Distance (CD; lower is better, $\times10^{-3}$), and F1 score ($\times10^2$).

On the 5 MB set:

| Method        | NC ↑    | CD ↓   | F1 ↑   |
|---------------|--------|--------|--------|
| NeurCADRecon  | 96.83  | 5.94   | 81.04  |
| Proxy-AD      | 97.14  | 5.27   | 86.56  |
| Proxy-FD      | 97.38  | 4.93   | 85.86  |

Proxy-FD attains the best NC and CD, while Proxy-AD leads F1; both outperform NeurCADRecon in accuracy and efficiency. Performance persists under data sparsity: FlatCAD remains robust down to 5 K input points; only at 1 K do reconstructions degrade notably. The proxy's developability bias supports plausible hole-filling.

Ablation studies show that the curvature proxy weight $\lambda_\mathrm{proxy}$ in $\{0.1, 1, 10, 100\}$ always induces smooth, CAD-like surfaces, with $\lambda=10$ providing the best accuracy-to-smoothness balance. Proxy-AD and Proxy-FD differ in runtime by less than 5 %.

## 5. Extensions: Scheduling the Weingarten Proxy Weight

FlatCAD's original formulation applied a constant off-diagonal Weingarten (ODW) penalty. Later work demonstrated that dynamically scheduling the ODW weight during training improves both stability and fidelity ["Scheduling the Off-Diagonal Weingarten Loss of Neural SDFs for CAD Models" [2511.03147]].

Five ODW weight schedules were formalized for $\lambda_\mathrm{ODW}(t)$ with $t\in[0,1]$ as normalized training progress:
- **Constant:** $\lambda_\mathrm{ODW}(t) = 10$ (FlatCAD baseline).
- **Linear decay:** plateau at 10 ($t\leq0.2$), linearly to $0.001$ at $t=0.5$, then to 0 at $t=1$.
- **Quintic ("smooth") decay:** slow easing from 10 to $0.001$ between $t=0.2$ and $0.5$, then to 0.
- **Step interpolation:** 10 for $t<0.5$, $0.001$ for $0.5\leq t<1$, then 0.
- **Warm-up (increasing linear):** starts at 0, ramps up to 10 at $t=1$.

On the ABC benchmark (25 models):

| Schedule         | NC   | CD    | F1    | Time (s) |
|------------------|------|-------|-------|----------|
| FlatCAD (const.) | 96.14| 4.37  | 84.98 | 877.5    |
| Linear decay     | 97.95| 3.05  | 90.59 | 882.7    |
| Quintic interp.  | 98.01| 2.86  | 92.72 | 878.2    |
| Step             | 97.99| 2.87  | 92.71 | 1003.5   |

Decay schedules yield 30–35% lower Chamfer Distance and improve F1 and NC. Quintic is optimal in stability and detail recovery, while warm-up (reverse schedule) degrades performance. Strong initial regularization stabilizes optimization, suppresses curvature noise, and facilitates eventual detail capture as the penalty decays.

## 6. Implications for CAD Reconstruction and Engineering Applications

FlatCAD, by decoupling the geometric bias (developability, minimal warp) from computational bottlenecks (full Hessian graphs), enables practical large-scale neural SDF learning for complex CAD surfaces. Its framework-agnostic, drop-in nature supports deployment in existing geometric learning stacks with minimal implementation effort. Robust behavior in data-sparse regimes and superior topology preservation recommend FlatCAD as a default regularizer for neural geometric reconstruction in engineering workflows.

The curvature proxy's parameter-free, purely geometric construction and tunable scheduling argue for its continued relevance as SDFs expand as a modeling primitive across CAD, reverse engineering, and shape optimization contexts. The separation of computational and geometric concerns in FlatCAD suggests the design space of higher-order regularization proxies for neural implicit methods is not yet exhausted.

Source: https://www.emergentmind.com/topics/flatcad