PINN Loss Construction and Weighting
A PINN's loss sums PDE residual, boundary, and data terms; how those terms are weighted decides whether training converges to the physical solution.
The composite objective
A PINN loss is a weighted sum of several objectives: the interior PDE residual, boundary/initial conditions, and any measured data. Each term is a mean-squared quantity over its own sample points. The weights balance terms that live on different scales and gradients, and getting them wrong is the most common reason a PINN converges to a plausible-looking but non-physical field.
Total loss:
L(theta) = w_pde * L_pde + w_bc * L_bc + w_data * L_data
L_pde = (1/N_r) sum_i | N[psi_theta](x_i) |^2 (collocation)
L_bc = (1/N_b) sum_j | B[psi_theta](x_j) |^2 (boundary)
L_data = (1/N_d) sum_k | psi_theta(x_k) - d_k |^2 (measurements)
weights w_* balance term scales and gradient magnitudes
Adaptive weighting
Fixed weights rarely work across a scenario. The stack uses gradient-based adaptive weighting: it rescales each term so no single loss dominates the shared backbone's gradients. A common rule sets weights from the ratio of gradient norms, updated during training.
# gradient-norm adaptive weighting (schematic)
g_pde = grad_norm(L_pde, theta)
g_bc = grad_norm(L_bc, theta)
g_data = grad_norm(L_data, theta)
g_bar = (g_pde + g_bc + g_data) / 3
w_pde = g_bar / (g_pde + eps)
w_bc = g_bar / (g_bc + eps)
w_data = g_bar / (g_data+ eps) # balance backbone gradients
Physics-specific terms
Beyond the raw PDE residual the breeder PINN adds terms that encode admissibility: monotonic flux from axis to boundary, positivity of pressure, and consistency of the reconstructed q profile with magnetics. For the burner, extra terms enforce quasineutrality and ambipolarity. These soft constraints steer training toward the physical branch of a nonlinear PDE that may have multiple solutions.
- Residual term: the governing PDE must hold in the interior.
- Boundary term: LCFS / plug-throat conditions must be met.
- Data term: available diagnostics anchor the solution.
- Admissibility terms: sign, monotonicity, and conservation constraints.
Loss weights are logged as provenance: because they change the solution a PINN converges to, they are part of the twin's reproducibility record, not a hidden hyperparameter.