A dose-response experiment that pre-equilibrates and then scans cannot be fit by a gradient method, because there is no way to obtain per-point sensitivities for the scan that are consistent with the carried pre-equilibrated state.
PyBNF surfaces this as a refusal (pybnf/bngsim_model/net_model.py:1321):
Model igf1r: a scored parameter_scan following a pre-equilibration (a carried, non-seed model state) cannot be run on the gradient path -- bngsim refuses per-point sensitivity seeds taken off a mid-protocol snapshot.
The refusal is right, and this is not a request to remove it. Re-seeding sensitivities at the start of each scan point would treat the pre-equilibrated state as if it were a seed state, discarding dx/dp accumulated during the equilibration; the resulting derivatives would be wrong rather than merely approximate. The gap is that there is no correct option to offer instead.
What is missing
The sensitivity state needs to be carried through the pre-equilibration and into each scan point, the way the state itself already is — so that each point's dx/dp includes the equilibration's contribution.
Simulator.run already exposes carry_sensitivities: bool = False, which looks like exactly this primitive for a sequential protocol. What is not available is the scan case: bngsim refuses a scan on a sensitivity-configured Simulator. Two questions for whoever picks this up:
- Does
carry_sensitivities already give the correct semantics across a pre-equilibration → scan boundary, so that the missing piece is only lifting the scan restriction?
- If not, what does a scan need beyond it — a per-point clone that inherits both
x and dx/dp from the snapshot?
Why it matters
Pre-equilibrate-then-scan is a standard protocol, not a corner case. In a six-job PyBNF fitting benchmark it removed the single most expensive job (igf1r, Erickson 2019 — a two-hour fit, three experiments, each a dose scan with pre-equilibration) from gradient-based fitting entirely, while the cheaper jobs without pre-equilibration ran fine. The workaround PyBNF suggests — run a gradient-free fit — gives up the capability for exactly the jobs where it would pay off most.
Environment
bngsim 0.11.35 (v0.11.35-77-g32395e4), PyBNF 1.6.0, Python 3.12, macOS 15.
A dose-response experiment that pre-equilibrates and then scans cannot be fit by a gradient method, because there is no way to obtain per-point sensitivities for the scan that are consistent with the carried pre-equilibrated state.
PyBNF surfaces this as a refusal (
pybnf/bngsim_model/net_model.py:1321):The refusal is right, and this is not a request to remove it. Re-seeding sensitivities at the start of each scan point would treat the pre-equilibrated state as if it were a seed state, discarding
dx/dpaccumulated during the equilibration; the resulting derivatives would be wrong rather than merely approximate. The gap is that there is no correct option to offer instead.What is missing
The sensitivity state needs to be carried through the pre-equilibration and into each scan point, the way the state itself already is — so that each point's
dx/dpincludes the equilibration's contribution.Simulator.runalready exposescarry_sensitivities: bool = False, which looks like exactly this primitive for a sequential protocol. What is not available is the scan case: bngsim refuses a scan on a sensitivity-configuredSimulator. Two questions for whoever picks this up:carry_sensitivitiesalready give the correct semantics across a pre-equilibration → scan boundary, so that the missing piece is only lifting the scan restriction?xanddx/dpfrom the snapshot?Why it matters
Pre-equilibrate-then-scan is a standard protocol, not a corner case. In a six-job PyBNF fitting benchmark it removed the single most expensive job (
igf1r, Erickson 2019 — a two-hour fit, three experiments, each a dose scan with pre-equilibration) from gradient-based fitting entirely, while the cheaper jobs without pre-equilibration ran fine. The workaround PyBNF suggests — run a gradient-free fit — gives up the capability for exactly the jobs where it would pay off most.Environment
bngsim 0.11.35 (
v0.11.35-77-g32395e4), PyBNF 1.6.0, Python 3.12, macOS 15.