Digital twins of a patient's arteries are simulators tuned so their pressure and flow waveforms match that patient's own measurements. They are useful only if two things hold. Tuning has to finish fast enough to matter at the bedside, and it has to work for patients unlike the ones the method was developed on. Today the fastest way to tune is amortized inference: a neural network trained once on many simulated subjects that reads a waveform and outputs simulator parameters in milliseconds. That network inherits whatever population it was trained on. The slower way is differentiable simulation, a simulator written so that exact gradients of a waveform-mismatch loss flow back to its parameters. It fits each patient to that patient's own data, but each step costs a full forward and backward simulation.
This note proposes using the network only as a starting guess and then spending a fixed wall-clock budget on gradient steps through a differentiable one-dimensional arterial blood-flow model. The claim is that this combination keeps the network's speed while removing most of its error on subjects outside its training population. The proposal also argues that whether this works within a real-time budget depends on an unglamorous systems fact. Once the regular per-vessel computation runs on a GPU, the irregular arterial-junction solves become the bottleneck, and they are what must be restructured.
Core Claim
Suppose an amortized estimator is trained on a deliberately skewed slice of a virtual population and then applied to subjects outside that slice. Its parameter error will be much worse on the excluded subgroup. We call the difference in error between excluded and included subjects the subgroup gap. Adding $K$ gradient refinement steps through the differentiable simulator should shrink this gap far more than it improves in-distribution accuracy. The refinement objective uses only the subject's own waveform, not population statistics. Concretely, with $g_\phi$ the trained estimator, $y$ a subject's measured waveforms, $S(\theta)$ the simulator's waveforms under parameters $\theta$, and $\eta$ a step size, we run
$$\theta_0 = g_\phi(y), \qquad \theta_{k+1} = \theta_k - \eta \nabla_\theta \lVert S(\theta_k) - y \rVert^2,$$
stopping when a wall-clock budget $B$ is exhausted.
The second, systems half of the claim is about how many steps fit within $B$. That number is set by the slowest unaccelerated stage of a forward-plus-backward pass. For network-topology solvers this stage is the nonlinear junction and boundary logic, not the vectorizable conduit update. The near-term payoff is therefore a more accurate twin at a fixed latency, achieved by restructuring that stage.
None of the closest prior work does both halves. jaxFlowSim (Accelerated Patient-Specific Calibration via Differentiable Hemodynamics Simulations) builds the differentiable 1D/0D solver we reuse and calibrates in under a minute. It is evaluated on reference anatomies only. It starts from fixed initializations, and its authors note that junction calculations under-use the GPU. Hybrid modeling of the cardiovascular system using NeuralFMUs reaches roughly 0.02 s per pulse wave. It trains on one virtual subject and tests on one other, so it says nothing about population shift. Its companion workflow paper NeuralFMU reports that the interface overhead makes the hybrid 5–6× slower than its own physics backbone. Real-Time MPC and System Identification Using Differentiable Physics Simulation runs continuous gradient-based identification under deadlines for one robot, with no population prior. The idea of pretraining an estimator cheaply and then correcting it appears in multi-fidelity inference (Krouglova; Multifidelity Simulation-based Inference). There the correction is a statistical fine-tune on high-fidelity samples, not per-subject physics gradients, and the question of generalization across populations is not posed.
Why Population Shift Is the Right Stress Test
The population-generalizability literature gives the motivation. Silhouette images enable estimation of body fat distribution reaches high accuracy on a UK Biobank cohort averaging 65 years old and predominantly white, and acknowledges that its learned shortcuts may not transfer. AI recognition of patient race in medical imaging shows that demographic signal pervades image features (AUC often above 0.90) and survives heavy filtering. That paper is a constraint on our design: masking inputs or post-hoc correction of a purely statistical estimator is unlikely to remove population dependence. Normative-curve work such as de Kort et al. makes the same point for reference values.
A differentiable mechanistic model offers a different lever. Its parameters, such as vessel resistance and compliance, have a fixed physical meaning across subjects. The fitting signal comes from the individual. Population bias can enter only through the starting point and the step budget. That is precisely the hypothesis the experiments isolate.
We are explicit about scope. All evaluation is in silico, because the file contains no real multi-demographic hemodynamic cohort. "Population" here means regions of physiological parameter space that a skewed prior under-covers. This is a controlled test of the mechanism, not a clinical fairness claim.
Research Program
The first component is the solver and its profile. We port the jaxFlowSim formulation: finite-volume conduits with a MUSCL flux, coupled to Windkessel outlets. We first confirm that it reproduces its reported agreement with openBF (relative error under 1%) on the 9-vessel aortic arch and the 77-segment ADAN56 tree from the Vascular Model Repository. We then time one forward-plus-backward pass and split the time into five parts: conduit updates, junction solves, outlet boundary updates, the reverse-mode backward pass, and host-side loop and transfer overhead.
The partial-pipeline literature predicts what we should see. AI Tax found that infinitely accelerating a kernel occupying 42% of a stage caps speedup near 1.74×. Genomic and bioinformatic accelerators (BWA-MEM, HMMER filtering) saw the bottleneck move to the unaccelerated downstream stage. We expect junctions plus host logic to take the majority of time after conduit vectorization.
The second component restructures the junction stage. Following the compile-time scheduling idea of Manticore, we group junctions by arity, pad them to fixed-shape tensors, and solve their nonlinear mass- and pressure-continuity equations with a fixed number of Newton iterations as a single batched operation. Manticore precomputed a static communication schedule rather than synchronizing at runtime. The fixed iteration count removes data-dependent branching, and the fixed shapes let us also batch across subjects. This is a software analogue of giving irregular operations their own unit, as the heterogeneous in-memory computing cluster does for depth-wise convolutions.
The risk is accuracy loss from truncated Newton solves. We check that the openBF agreement is preserved, and we report the iteration count at which it breaks.
The third component builds the estimator and the skewed populations. We train $g_\phi$ on simulated waveforms from the Pulse Wave Database (4,374 virtual healthy subjects) and on additional samples drawn from parameter priors. We partition subjects along the generating parameters that the database varies, such as heart rate and arterial stiffness. We train on one region and hold out another, and we repeat this for several partitions so that no single split drives the conclusion.
The fourth component is calibration under a budget. For each held-out and in-distribution subject we run the refinement loop under budgets $B$ of 1, 10, and 60 seconds; 60 seconds matches jaxFlowSim's reported deterministic calibration time. We record parameter error, waveform error, and the subgroup gap as functions of $B$.
Baselines
The naive reference point is the amortized estimator alone, $g_\phi(y)$ with zero refinement steps. It is the fastest option and the one whose subgroup gap we expect to be large. It is trained on exactly the same simulated data as every other learned variant. Beating it means reducing held-out parameter error, and especially the subgroup gap, at budgets that remain clinically short.
The strongest existing method is jaxFlowSim-style gradient calibration from a population-mean initialization, using the Adafactor optimizer as in that paper. The reported reference is calibration in under one minute, with under 1% relative waveform error against openBF on VMR anatomies, from jaxFlowSim. No reported result was found on Lacuna for jaxFlowSim's parameter-recovery error across a population or across subgroups, so we measure it ourselves. It runs on the identical solver and hardware with the same budgets, and its step size is tuned with the same search budget as ours. Beating it means lower parameter error and a smaller subgroup gap at the 1 s and 10 s budgets. At 60 s we expect parity in the best case, and parity is acceptable there.
For the speed end we include a NeuralFMU-style hybrid surrogate (NeuralFMU cardiovascular model), trained on the same skewed slice. Its reported latency is about 0.02 s per pulse wave, and it was tested on one held-out subject. Here it is a fair competitor only on the latency axis. On accuracy, it shows what a learned correction does under population shift.
We include a derivative-free calibrator, CMA-style evolutionary search, given the same forward solver, the same budget, and the same estimator-based initialization. This tests whether the gradient matters or only the warm start does.
Two ablations isolate the key ingredients. The first compares refinement from $g_\phi(y)$ against refinement from the population mean at equal $B$; this isolates the warm start. The second compares refinement with the default junction implementation against the batched static version at equal $B$; this isolates how much of the accuracy gain comes from fitting more steps into the deadline.
Finally, an oracle estimator trained on the full, unskewed population bounds how much of the gap is recoverable at all.
Why not just…?
Why not just train the estimator on a broader prior, since simulated data is free? This is the most serious threat. In silico, we could simply sample the held-out region. The counterargument is that in practice the true range of patients is unknown, and priors are designed from the cohorts that exist, which are skewed as the silhouette study illustrates. Widening the prior also spreads the estimator's capacity thinner. We test this directly with a broad-uniform-prior estimator. We measure its in-distribution accuracy loss and its held-out error, with and without refinement. If the broad-prior estimator alone matches warm-started refinement at the 1 s budget, the first half of our claim fails, and we will report it that way. The systems contribution would survive.
Why not just run differentiable calibration from a default start, since it already takes under a minute? A minute is not continuous bedside updating. Nonlinear wave models can also have local minima that make far-away starts converge slowly or wrongly; the open-problems summary flags local minima for differentiable physics generally. The population-mean baseline at 1 s, 10 s, and 60 s shows whether warm starting buys accuracy at short budgets or only time. If the curves coincide everywhere, the estimator is unnecessary.
Why not just use derivative-free search or adapt the estimator at test time? jaxFlowSim reports that derivative-free cardiovascular calibration needs thousands of forward runs. DiSECt shows a similar gulf for soft-tissue cutting: about 30 s with gradients on GPU versus over 32 hours for a non-differentiable CPU solver. Both results are from different setups than ours, so the matched-budget CMA baseline is the real test. Test-time adaptation of $g_\phi$ without the simulator has no physical anchor on the held-out subject. The race-recognition results (Zhang et al.) suggest population signal is entangled in learned features, so we expect it to correct less of the gap. We include it as an extra learned baseline under the same budget.
Why not just buy a faster GPU? AI Tax's Amdahl analysis says this stops paying once the accelerated stage is small. Our profile measures where that point is for this solver. If junction and host time are already a small fraction, the systems component is unnecessary, and we will say so.
Proposed Experiments and Decisive Checks
The primary result is a plot of the subgroup gap against wall-clock budget, showing every baseline across multiple PWDB partitions. Parameter error is reported as relative error per physical parameter. Waveform error is relative error against the simulated ground truth, using the same metric jaxFlowSim reports against openBF.
The hypothesis is confirmed if warm-started gradient refinement satisfies three conditions:
- at 1–10 s it shrinks the held-out gap by a substantially larger fraction than it improves in-distribution error;
- it beats both the population-mean start and the CMA search at equal budget;
- it approaches the full-population oracle.
The hypothesis is refuted if either the broad-prior estimator alone or the population-mean gradient start matches it at short budgets.
The systems check has its own pass criterion. Measured over one forward-plus-backward pass, the time breakdown should show junction and host stages dominating after conduit vectorization. The batched static junction solve should then raise the number of refinement steps that fit within $B$ while keeping openBF agreement under 1% on ADAN56. The resulting accuracy gain at fixed $B$, taken from the junction ablation, tells us whether pipeline restructuring actually moved the population-generalization result, or whether the two halves of the proposal are independent.
References
- Accelerated Patient-Specific Calibration via Differentiable Hemodynamics Simulations
- Hybrid modeling of the human cardiovascular system using NeuralFMUs
- NeuralFMU: Presenting a Workflow for Integrating Hybrid NeuralODEs into Real-World Applications
- Real-Time Model Predictive Control and System Identification Using Differentiable Simulation
- Multifidelity Simulation-based Inference for Computationally Expensive Simulators
- Silhouette images enable estimation of body fat distribution and associated cardiometabolic risk
- AI recognition of patient race in medical imaging: a modelling study
- Cerebral white matter hyperintensity volumes: Normative age- and sex-specific values from 15 population-based cohorts comprising 14,876 individuals
- AI Tax: The Hidden Cost of AI Data Center Applications
- Efficient Architecture-Aware Acceleration of BWA-MEM for Multicore Systems
- An FPGA-based hardware accelerator supporting sensitive sequence homology filtering with profile hidden Markov models
- Manticore: Hardware-Accelerated RTL Simulation with Static Bulk-Synchronous Parallelism
- A Heterogeneous In-Memory Computing Cluster for Flexible End-to-End Inference of Real-World Deep Neural Networks
- DiSECt: a differentiable simulator for parameter inference and control in robotic cutting