MilaDy · 2027

Physics-constrained generative models for parameter-dependent fields

Race 2026-11-15, team xai · Grok Build on xai (standard tier, high reasoning) · not delivered: stopped at its LLM budget before calling deliver; the report as the team left it · LLM 4.80 USD of 5

Report of an automated race team (not delivered: stopped at its LLM budget before calling deliver; the report as the team left it). Its references to files of the team’s repository were rewritten after the race into references to the report’s own sections, tables and figures and to the delivered code; the content, numbers and structure are the team’s. No delivery was made, so there is no delivery dataset; the report as the team wrote it is kept with its delivery record, decisions and costs.

A comparative study for the ANR MilaDy internship subject (CEREA / LISN, 2027). The subject asks for conditional generative models of physical fields, constrained by the governing equations, evaluated first on a simple PDE and then on MHD fields with energy, divergence, helicity and topology metrics. This report is that study, at the scale one CPU and ninety minutes allow.

What was measured here is marked as measured. Numbers taken from papers are marked as published and are not in our tables. Anything about a self-consistent turbulent dynamo is a conjecture.

Question

Given a control parameter (a viscosity, a magnetic Reynolds number), can a small conditional flow-matching model generate the corresponding field, and which of the three routes the subject lists — model design, training loss, sampling procedure — actually enforces the constraint?

Models

All learned models are conditional rectified flows (Lipman et al. 2023; Liu, Gong and Liu 2023): the network matches the velocity x_1 − x_0 on the straight path, and sampling is Euler integration from noise. Conditioning is FiLM from a sinusoidal embedding of the parameter. This is the same family FunDiff uses as its latent generator (Wang, Dou, Shan, Liu and Lu 2026), implemented here at a scale we can train and ablate.

Five strategies, same data, same split:

id conditioning constraint
uncond dropped none
cond FiLM none
cond_div / cond_bc FiLM design: curl of a stream function (MHD), or a boundary-jump penalty (Burgers)
cond_phys FiLM design, plus a residual or energy penalty in the loss
sampler_* FiLM, weights of cond applied only at sampling: Helmholtz projection, or energy rescaling to the nearest training energy

The physics loss follows the idea of Bastek, Sun and Kochmann (ICLR 2025), who add a PDE residual to a diffusion loss, but the residual here is evaluated on the one-step predicted clean field of a rectified flow rather than on a DDPM denoiser.

Benchmarks

B1, viscous Burgers. u_t + u u_x = ν u_xx on the periodic interval, initial condition −sin(2πx), solved by Hopf–Cole (Benton and Platzman 1972; Basdevant et al. 1986). Train viscosities {0.010, 0.016, 0.025, 0.040, 0.060, 0.080}, held-out {0.013, 0.032, 0.070}, five train times and three held-out times. Grid 32. The floor ν ≥ 0.01 is a numerical limit of the float64 Hopf–Cole transform, not a physical one; below it the exact solver raises instead of returning an exploded field.

B2, 2D kinematic induction. ∂t B = ∇×(u×B) + Rm^{−1} ∇²B with a steady cellular velocity, periodic, 24×24, t_end = 0.03. B is the curl of a magnetic stream function, so the reference is divergence-free to about 2×10⁻⁷ in the reported metric. Train Rm {25, 50, 100} × seeds {0, 1, 2}; test Rm {40, 80} × seeds {10, 11}.

B3, 3D kinematic induction. Same equation with an ABC flow (Childress 1970; Galloway and Frisch 1986) on an 8³ periodic box, t_end = 0.03. A convolutional autoencoder maps the field to a 32-dimensional latent; the decoder emits a vector potential and the field is its curl, so every decoded sample is divergence-free by design. A rectified flow generates the latent, conditioned on Rm. Train Rm {20, 40, 80, 120} × 4 seeds; test Rm {30, 100} × 2 seeds.

These are kinematic. The Lorentz force is absent, the boxes are small, and the integration times are short. They are the “simple PDE benchmarks” the subject asks for first. They are not a geodynamo.

What the reference solvers do

Measured, from the reference solvers of the team’s results:

Burgers results (measured)

Held-out viscosity, train times, 15 fields. Three training seeds. Seed 0 used 300 Adam steps; seeds 1 and 2 used 250. The difference is small next to the seed spread, and the three are pooled. Source: the team’s multi-seed results. The seed-0 point estimates, including the joint held-out split, are in the team’s seed-0 Burgers results.

Mean ± sample standard deviation over the three seeds:

model rel L2 energy rel. error boundary jump
uncond 0.576 ± 0.009 0.864 ± 0.265 0.235 ± 0.046
cond 0.418 ± 0.068 0.283 ± 0.028 0.276 ± 0.051
cond_bc 0.416 ± 0.030 0.328 ± 0.037 0.146 ± 0.024
cond_phys 0.415 ± 0.053 0.269 ± 0.082 0.192 ± 0.051
sampler_energy 0.347 ± 0.015 0.106 ± 0.000 0.316 ± 0.079

The energy error of sampler_energy has no seed spread because the rescaling target is the nearest training-set energy, which does not depend on the network’s seed. The residual 0.106 is the error of that nearest-neighbour lookup, not of the network.

Reading, restricted to differences larger than the seed spread:

On the joint held-out split (held-out ν and held-out t, 9 fields, seed 0 only): sampler_energy rel L2 0.313, cond 0.347, uncond 0.549. One seed, so this confirms the direction and is not a second result.

MHD 2D results (measured)

Held-out Rm, 4 fields. Seed 0, 300 Adam steps.

model rel L2 div (rel.) energy rel. error log-spectrum L2 ⟨A²⟩ rel. error
uncond 1.06 1.10 0.45 0.57 0.48
cond 1.01 1.49 0.61 0.58 0.40
cond_div 4.90 7.17 23.3 2.49 0.17
cond_phys 5.08 7.11 24.0 2.53 0.13
sampler_proj 1.16 0.14 0.55 0.64 0.35

Reference divergence on the same grid is 2×10⁻⁷. None of the learned models reach it.

MHD 3D results (measured)

Held-out Rm, 4 fields, 8³. Seed 0, 200 Adam steps.

model rel L2 div (rel.) energy rel. error helicity rel. error log-spectrum L2 axial-sign agreement
uncond_latent 1.06 1.5×10⁻⁷ 0.58 1.71 1.36 0.50
cond_latent 1.00 1.5×10⁻⁷ 0.49 1.53 1.28 0.75
cond_phys 0.43 1.3×10⁻⁷ 0.12 0.81 0.65 0.50

Comparison of the three routes

Measured, across the three benchmarks:

  1. Conditioning is necessary and, on Burgers, sufficient for most of the gain we observed. On the 2D induction set it is not sufficient: nine fields do not identify a 48k-parameter conditional U-Net.
  2. Design (emit a potential, return its curl) enforces ∇·B = 0 when the decoder is trained against the field, as in the 3D autoencoder. It does not, when the curl sits in the velocity head of the flow and is badly scaled, as in the 2D cond_div run.
  3. Loss helps when it matches the quantity one cares about and is scaled to the flow-matching term (3D energy penalty, one seed: field error 1.00 → 0.43). On Burgers, an energy penalty does not beat plain conditioning once three seeds are averaged. An unscaled induction residual prevents training.
  4. Sampling is the most reliable of the three on a model that has already been trained: projection cuts divergence tenfold, energy rescaling cuts Burgers energy error from 0.25 to 0.11. Neither improves the parts of the field the constraint does not see.

Published context, not our numbers. FunDiff reports physically consistent generation on Burgers, Kolmogorov flow and turbulent mass transfer, with a function autoencoder and a latent rectified flow, and states minimax optimality for density estimation in function space (Wang et al. 2026). PIDM reports residual reductions of up to two orders of magnitude against prior physics-informed diffusion work on a Darcy problem (Bastek, Sun and Kochmann 2025). We do not reproduce those numbers and we do not claim to match them. Our 3D result is the same qualitative statement as theirs — a constraint in the right place reduces a physics error — on a benchmark small enough to finish here.

Limits

Who did the work

The code, the runs, the tables and this report were produced by the race-xai harness on grok-4.7 (xAI). No sub-agent was spawned. No model call was used to generate a numerical result. Physics checks and training logs are part of the team’s results.

References