← Blog
Technology 2026-03-31

Differentiable CAD: Optimization by Design

How differentiable geometry enables gradient-based shape optimization in CAD — automatic differentiation, design graphs, and engineering applications.

#differentiable CAD#shape optimization#automatic differentiation#gradient descent#design optimization#computational design

The Optimization Problem in Engineering

Engineering design is fundamentally an optimization problem. You want the lightest bracket that meets a stiffness requirement. The most aerodynamic profile that fits within a dimensional envelope. The heat exchanger geometry that maximizes thermal transfer per unit volume. Traditionally, engineers solve these problems through iterative manual refinement: change a dimension, re-simulate, evaluate the result, adjust again. This loop works, but it is slow and explores only a tiny fraction of the design space.

What if the CAD model itself could tell you which direction to change each parameter to improve the objective? That is the promise of differentiable CAD.

What “Differentiable” Means

A system is differentiable if you can compute the derivative of its output with respect to its input. In the context of CAD, this means computing how a performance metric (mass, stiffness, drag, temperature) changes when you adjust a design parameter (radius, length, wall thickness, blend factor).

If you know the gradient — the vector of partial derivatives of the objective with respect to all design parameters — you can take a step in the direction that improves the objective. This is gradient descent, the same algorithm that trains neural networks, applied to physical geometry.

The key question is: can the CAD kernel propagate gradients through its operations?

Why B-rep Makes Differentiation Hard

Traditional B-rep CAD kernels were not designed for differentiation. Consider what happens when you change the radius of a fillet:

  1. The fillet surface is recomputed (a rolling-ball operation on the edge)
  2. Adjacent faces are trimmed or extended
  3. Topology may change (a small fillet might merge with an adjacent face; a large fillet might eliminate an edge entirely)
  4. The entire model is rebuilt

Steps 1-3 involve discontinuous operations. Topology changes are inherently discrete — a face either exists or it does not. You cannot take a half-derivative through a topology change. This means that the function mapping design parameters to geometry is piecewise smooth at best, with discontinuities at topology transitions.

Some researchers have worked around this by differentiating through mesh representations (differentiable rendering, differentiable FEA), but these approaches differentiate through the analysis, not through the CAD model itself. The design intent — the parametric relationships, the constraints, the feature tree — is lost.

Why SDF Enables Differentiation

Signed Distance Fields are inherently differentiable. The SDF of a sphere with radius r centered at origin is:

f(x, y, z; r) = sqrt(x^2 + y^2 + z^2) - r

The derivative with respect to r is simply -1. The derivative with respect to x is x / sqrt(x^2 + y^2 + z^2). These are smooth, well-defined, and computable everywhere (except at the exact center, which is a measure-zero set).

Boolean operations on SDFs are also differentiable almost everywhere:

  • Union: min(a, b) has a well-defined gradient everywhere except where a = b (a measure-zero set)
  • Smooth union: smooth_min(a, b, k) is differentiable everywhere, including the blend region

This means that an entire SDF expression tree — primitives composed with Boolean operations and transforms — is a differentiable function from design parameters to field values. You can compute the gradient of the field at any point with respect to any parameter in the tree.

Automatic Differentiation

Computing gradients by hand is error-prone for complex models. Automatic differentiation (AD) computes exact derivatives mechanically by applying the chain rule through the computation graph.

There are two modes:

Forward Mode AD

Propagates derivatives from inputs to outputs. Efficient when there are few inputs and many outputs. For a model with 10 parameters, forward mode requires 10 passes through the computation graph.

Reverse Mode AD (Backpropagation)

Propagates derivatives from outputs to inputs. Efficient when there are many inputs and few outputs. For a scalar objective (e.g., total mass) with 1000 design parameters, reverse mode requires just one backward pass.

For CAD optimization, reverse mode is almost always preferred because the objective is typically a single scalar (mass, compliance, drag) and the design parameters are numerous.

NeuroCAD’s kernel is designed to support reverse-mode AD through its operation graph. Each node in the distributed constraint graph stores the local derivatives of its operation, and the chain rule composes them across the graph to produce the gradient of any scalar objective with respect to any design parameter.

What You Can Optimize

Shape Optimization

Given a fixed topology (the number of holes, bosses, and features is fixed), adjust dimensions to minimize an objective:

  • Minimize mass subject to stiffness constraints
  • Minimize stress concentrations by adjusting fillet radii
  • Maximize natural frequency by redistributing material

Shape optimization with gradients converges in tens to hundreds of iterations, compared to thousands for gradient-free methods like genetic algorithms.

Topology Optimization

Topology optimization determines where material should exist and where it should be removed. In the SDF framework, this is a field optimization problem: find the SDF parameters that minimize the objective while satisfying constraints.

The smooth union and intersection operators in SDF enable continuous topology transitions. A hole can open smoothly (the field value at a point transitions from negative to positive), unlike B-rep where a hole is a discrete topological event.

Multi-Objective Optimization

Engineering problems rarely have a single objective. You want to minimize mass AND minimize stress AND maximize thermal conductivity. Differentiable CAD enables multi-objective gradient descent, where the Pareto front (the set of non-dominated solutions) is explored efficiently using gradient information.

Lattice Optimization

For lattice-filled parts, the design parameters include local density, cell size, wall thickness, and topology blend factors. Differentiable evaluation means you can compute how a change in local lattice density affects the global structural response, enabling gradient-based lattice optimization that would be intractable with finite-difference methods.

The Computation Pipeline

A typical differentiable CAD optimization loop:

  1. Define the parametric model: build the SDF expression tree with named parameters
  2. Define the objective: a function from geometry to a scalar value (mass, compliance, temperature)
  3. Evaluate the forward pass: compute the geometry, extract the mesh, run the analysis
  4. Compute the gradient: reverse-mode AD through the analysis and the geometry kernel
  5. Update parameters: gradient descent step (or a more sophisticated optimizer like L-BFGS or Adam)
  6. Repeat until convergence or budget exhaustion

Steps 3 and 4 are the expensive ones. The key insight is that computing the gradient (step 4) costs roughly the same as the forward evaluation (step 3) when using reverse-mode AD. This makes gradient-based optimization dramatically more efficient than finite-difference approaches, which require one forward evaluation per parameter.

Practical Challenges

Non-Smoothness

Even in SDF, some operations introduce non-smoothness. The min/max operations for hard Booleans have gradient discontinuities at the interface. In practice, smooth approximations (smooth min/max with a small blending radius) resolve this at the cost of geometric precision.

Mesh Extraction

Many analysis tools require a mesh, and the mesh extraction step (Marching Cubes, Dual Contouring) can introduce gradient noise. Differentiable mesh extraction algorithms exist but add complexity to the pipeline.

Constraint Handling

Engineering constraints (minimum wall thickness, maximum stress, manufacturing clearances) must be incorporated into the optimization. Penalty methods, augmented Lagrangian approaches, and interior point methods all work, but choosing the right constraint handling strategy affects convergence.

Computational Cost

Each optimization iteration requires evaluating the SDF, extracting geometry, and running analysis. For complex models with detailed FEA, this can be minutes per iteration. GPU-accelerated field evaluation and reduced-order models help manage this cost.

Where This Is Heading

Differentiable CAD is not a finished technology — it is an active research area with clear engineering value. The convergence of differentiable geometry kernels, GPU-accelerated field evaluation, and automatic differentiation frameworks is making gradient-based design optimization practical for real engineering problems.

NeuroCAD’s SDF kernel is designed from the ground up to support this workflow. Every operation in the distributed constraint graph is differentiable, parameters propagate through the graph with tracked dependencies, and the evaluation pipeline is compatible with reverse-mode AD. This makes gradient-based optimization a natural extension of the design process, not a separate toolchain.

The engineers who adopt differentiable design tools will explore more of the design space, converge faster, and find solutions that manual iteration would never discover. The geometry kernel that enables this must be differentiable by construction, not by approximation.

Ready to design differently?

Request early access to NeuroCAD.

Request Access