Solver-Trajectory Flow Matching
Implementation & benchmark of arXiv:2607.14652 — Trajectory-Aware Flow Matching for Topology Optimisation
Source paper: Trajectory-Aware Flow Matching for Topology Optimisation arXiv:2607.14652 ⓘ · analyzed Aug 30, 2026
AI-generated research hypothesis, automatically tested. Not peer-reviewed.
Idea description
Train a conditional flow-matching model against a sequence of intermediate states generated by an expensive optimisation or refinement process, rather than only matching noise to the final sample. The resulting vector field should require fewer inference steps and remain closer to the solver's feasible trajectory than endpoint-only flow matching.
Formulas
Mathematical statement
The transferable construction is a piecewise-linear probability path through trajectory anchors. Let $y_0$ be a source noise sample, $y_K$ the target data sample, and $y_1,\ldots,y_{K-1}$ intermediate states from an optimisation or refinement trajectory. Let $0=s_0<s_1<\cdots<s_K=1$ be normalized path times. For $t\in[s_k,s_{k+1}]$, define $\alpha=(t-s_k)/(s_{k+1}-s_k)$ and $x_t=(1-\alpha)y_k+\alpha y_{k+1}$. The segment velocity is $u_t=(y_{k+1}-y_k)/(s_{k+1}-s_k)$. A neural vector field $v_\theta(x,t,c)$, conditioned on context $c$, is trained with the path-velocity mismatch objective $\mathcal{L}(\theta)=\mathbb{E}[\|v_\theta(x_t,t,c)-u_t\|_2^2]$. The generated sample solves the neural ODE $d\hat{x}_t/dt=v_\theta(\hat{x}_t,t,c)$ from $\hat{x}_0\sim p_0$. A trajectory-weighted version uses $\mathcal{L}_{\lambda}=\mathbb{E}[w_k\|v_\theta-u_t\|_2^2]$, with $w_k=1+\lambda q_k$, where $q_k$ is a normalized confidence or feasibility score for segment $k$ and $\lambda\geq0$ controls trajectory guidance. Moderate $\lambda$ emphasizes reliable solver directions; excessive $\lambda$ can over-constrain the field and reduce diversity.
Implementation notes
Integrate this at the training and inference interfaces of a conditional flow or diffusion model, using trajectory data from any expensive iterative teacher. The tensor being modified is the model state $x$ itself: an image latent, token embedding sequence, graph state, or simulator design vector. First, for every training target $y_K$, run or retrieve a teacher trajectory $(y_0,y_1,\ldots,y_K)$, where $y_0$ is Gaussian noise and later states are optimiser or refinement iterates. Normalize iteration indices to $s_k=k/K$, or use actual cumulative step lengths if teacher steps have unequal magnitudes. At each minibatch, sample a segment index $k$ uniformly and sample $r\sim\mathrm{Uniform}(0,1)$. Set $t=(1-r)s_k+rs_{k+1}$, compute $x_t=(1-r)y_k+ry_{k+1}$ and $u_t=(y_{k+1}-y_k)/(s_{k+1}-s_k)$, then backpropagate $w_k\|v_\theta(x_t,t,c)-u_t\|_2^2$. For a first implementation set $q_k=1$ and compare $\lambda=0,0.25,1,4$; alternatively define $q_k$ from the teacher's per-step objective decrease and normalize it to $[0,1]$. At inference, start from Gaussian noise and integrate the learned ODE with Euler or Heun using 4, 8, 16, and 32 steps. The exact mathematical computations are the interpolation point, segment velocity, weighting rule, and ODE update; empirical quantities are the teacher anchors and confidence scores. Begin with a small conditional MNIST or CIFAR-10 experiment, using a U-Net or MLP flow model and standard endpoint flow matching as the baseline. Measure FID or validation loss at equal numbers of function evaluations, diversity, and distance to the teacher's final state. For optimisation data, also measure constraint violation and objective value. Success is lower error or better FID at 4–8 steps without sample collapse, plus improved feasibility and teacher-objective quality.
Verification
Stage 1 · Toy mechanism gate: Passed ✓
Stage 2 · Mechanism transferred to benchmark: Confirmed ✓
Stage 2 · Practical benchmark result: Significantly worse ✗
Methodology: 8 paired seeds, permutation test (p<0.05) against a learning-rate-tuned baseline. How verification works
Stage 1 — Mechanism check agent confidence 8/10
Built a conditional 2-D solver-trajectory flow-matching MVP with endpoint-only and trajectory-velocity objectives, weighted training, Euler inference, and reproducible diagnostics. The mechanism manifested: interpolation identity error was 0, velocity error stayed below 1.5e-5, and polygonal deviation approached the predicted O(K^-2) scaling (observed log2 slopes 1.90, 1.98, 1.99, 2.00 for K>=4). Trajectory training reduced 4-step trajectory distance from 0.3960 to 0.1677 versus endpoint flow matching, while weighting reduced the final high-confidence segment MSE from 0.5369 at lambda=0 to 0.3956 at lambda=4. This is a promising trajectory-adherence win, but not an endpoint-quality win: the endpoint baseline had final distance 0.0239 versus 0.1516 for the unweighted trajectory model at 4 steps.
- Agent confidence
- 8/10
- Baseline
- Endpoint FM: trajectory distance 0.3960/0.4545/0.4848 and final-target distance 0.0239/0.0212/0.0272 at 4/8/16 Euler steps.
- Idea
- Trajectory FM lambda=0: trajectory distance 0.1677/0.0877/0.0576 and final-target distance 0.1516/0.0580/0.0581 at 4/8/16 steps; lambda sweep high-confidence segment MSE: 0.5369, 0.4593, 0.4054, 0.3956 for lambda=0,0.25,1,4.
Limitations: Only a synthetic 2-D conditional refinement problem was tested; no MNIST/CIFAR, FID, large model, unequal solver times, Heun integration, diversity metric, or independent-seed statistical replication was evaluated. The weighting confidence q was synthetic and correlated with segment index rather than derived from a real solver objective.
How to run: python3 run_experiment.py
Stage 2 — Benchmark vs. tuned baseline (arXiv:2607.14652)
Significantly WORSE than the tuned baseline (+3477.1%, p=0.0081, wins 0 / 8 paired seeds).
- Benchmark
- Dynamics forecasting
- Model
- rnn_small
- Paired seeds
- 8
- Baseline mean
- 0.0021
- Idea mean
- 0.0735
- Effect (Δ)
- 0.0714 (+3477.1%; negative = idea better)
- Wins
- 0 / 8 paired seeds
- p-value
- 0.0081 (permutation test, 20 000 shuffles)
- Smallest detectable effect
- ±468.5%
- Mechanism
- Confirmed ✓
- Practical effect
- Hurts
- Baseline tuning
- swept over 3 configs
Used a reduced but complete 8-seed protocol with 800 training and 300 test examples and 6 epochs because the initial full-size run exceeded the shared execution budget. Only the dynamics track and Euler inference were tested; no vision/sequence track, Heun solver, unequal real teacher trajectories, diversity metric, or longer training schedule was evaluated. The idea sweep duplicated lr=0.01 when the baseline optimum was at the upper grid boundary, so the distinct tested settings were lr=0.001 and lr=0.01.
How to run: python3 bench_experiment.py
Verdict computed by deterministic test code from paired-seed statistics — not by the language model.
Stage 2 — Benchmark latest Failed ✗
Agent confidence: 9/10
Implemented Solver-Trajectory Flow Matching on the structurally matched dynamics track using the shared rnn_small architecture, with endpoint MSE baseline, trajectory-velocity training, Euler inference, paired seeds, and learning-rate sweep parity. The interpolation and velocity identities were numerically verified, but the idea was significantly worse: mean test MSE 0.07345 versus baseline 0.00205, paired delta +0.07140, permutation p=0.0081. The mechanism signature was marked confirmed for the observed trajectory/velocity behavior, but this does not constitute a task-metric win.
- Baseline
- dynamics/rnn_small endpoint training, best lr=0.01; 8-seed test MSE mean=0.00205335, std=0.00074244
- Idea
- trajectory-velocity training with Euler integration, best lr=0.01; 8-seed test MSE mean=0.07345113, std=0.01103127
- Math check
- interpolation max error=0.0; velocity max error=4.68e-06
- Mechanism signature
- map[baseline_endpoint_mse:0.003087950637564063 confirmed:true idea_endpoint_mse:0.05978367105126381 initial_velocity_mse:0.04817172512412071]
- Paired delta
- idea - baseline = +0.07139778; 0/8 idea wins; permutation p=0.0081
Benchmark result
Significantly WORSE than the tuned baseline (+3477.1%, p=0.0081, wins 0 / 8 paired seeds).
- Benchmark
- Dynamics forecasting
- Model
- rnn_small
- Paired seeds
- 8
- Baseline mean
- 0.0021
- Idea mean
- 0.0735
- Effect (Δ)
- 0.0714 (+3477.1%; negative = idea better)
- Wins
- 0 / 8 paired seeds
- p-value
- 0.0081 (permutation test, 20 000 shuffles)
- Smallest detectable effect
- ±468.5%
- Mechanism
- Confirmed ✓
- Practical effect
- Hurts
- Baseline tuning
- swept over 3 configs
Used a reduced but complete 8-seed protocol with 800 training and 300 test examples and 6 epochs because the initial full-size run exceeded the shared execution budget. Only the dynamics track and Euler inference were tested; no vision/sequence track, Heun solver, unequal real teacher trajectories, diversity metric, or longer training schedule was evaluated. The idea sweep duplicated lr=0.01 when the baseline optimum was at the upper grid boundary, so the distinct tested settings were lr=0.001 and lr=0.01.
How to run: python3 bench_experiment.py
Artifacts
- bench_experiment.py 5.9 KB View Raw
- bench_report.json 2.8 KB View Raw
- report.md 1.8 KB View
- report_bench_2026-08-31T102147.md 5.3 KB View
- results.json 5.0 KB View Raw
- run_experiment.py 6.4 KB View Raw