Title: Automatically Learning Hybrid Digital Twins of Dynamical Systems
Venue: NeurIPS 2024
Accepted: yes
Keywords: Hybrid Models

Dynamical Systems
Abstract: Digital Twins (DTs) are computational models that simulate the states and temporal dynamics of real-world systems, playing a crucial role in prediction, understanding, and decision-making across diverse domains. However, existing approaches to DTs often struggle to generalize to unseen conditions in data-scarce settings, a crucial requirement for such models. To address these limitations, our work begins by establishing the essential desiderata for effective DTs. Hybrid Digital Twins (**HDTwins**) represent a promising approach to address these requirements, modeling systems using a composition of both mechanistic and neural components. This hybrid architecture simultaneously leverages (partial) domain knowledge and neural network expressiveness to enhance generalization, with its modular design facilitating improved evolvability. While existing hybrid models rely on expert-specified architectures with only parameters optimized on data, *automatically* specifying and optimizing HDTwins remains intractable due to the complex search space and the need for flexible integration of domain priors. To overcome this complexity, we propose an evolutionary algorithm (**HDTwinGen**) that employs Large Language Models (LLMs) to autonomously propose, evaluate, and optimize HDTwins. Specifically, LLMs iteratively generate novel model specifications, while offline tools are employed to optimize emitted parameters. Correspondingly, proposed models are evaluated and evolved based on targeted feedback, enabling the discovery of increasingly effective hybrid models. Our empirical results reveal that HDTwinGen produces generalizable, sample-efficient, and evolvable models, significantly advancing DTs' efficacy in real-world applications.

Automatically Learning Hybrid Digital Twins of Dynamical Systems

Abstract

Digital Twins (DTs) are computational models that simulate the states and temporal dynamics of real-world systems, playing a crucial role in prediction, understanding, and decision-making across diverse domains. However, existing approaches to DTs often struggle to generalize to unseen conditions in data-scarce settings, a crucial requirement for such models. To address these limitations, our work begins by establishing the essential desiderata for effective DTs. Hybrid Digital Twins ( HDTwins ) represent a promising approach to address these requirements, modeling systems using a composition of both mechanistic and neural components. This hybrid architecture simultaneously leverages (partial) domain knowledge and neural network expressiveness to enhance generalization, with its modular design facilitating improved evolvability. While existing hybrid models rely on expertspecified architectures with only parameters optimized on data, automatically specifying and optimizing HDTwins remains intractable due to the complex search space and the need for flexible integration of domain priors. To overcome this complexity, we propose an evolutionary algorithm ( HDTwinGen ) that employs Large Language Models (LLMs) to autonomously propose, evaluate, and optimize HDTwins. 2 Specifically, LLMs iteratively generate novel model specifications, while offline tools are employed to optimize emitted parameters. Correspondingly, proposed models are evaluated and evolved based on targeted feedback, enabling the discovery of increasingly effective hybrid models. Our empirical results reveal that HDTwinGen produces generalizable, sample-efficient, and evolvable models, significantly advancing DTs' efficacy in real-world applications.

1 Introduction

Digital Twins (DTs) are computational models that accurately simulate the states and temporal dynamics of real-world systems [1, 2]. They are particularly useful in modeling dynamical systems , which consist of multiple interdependent components that evolve over time [3, 4]. Take, for example, the epidemiological dynamics of a contagious disease containing various components, including infection rates, recovery rates, population movement, and intervention strategies. DTs can integrate these factors to simulate future outcomes (e.g. predict disease spread), understand system changes (e.g. examining shifts in disease dynamics for varying demographics), and evaluate the impact of control measures (e.g. to curb disease transmission) [5, 6].

Desiderata. A notable differentiator between DTs and general machine learning (ML) models is the emphasis on generalization. DTs are designed to simulate completely unseen scenarios or interventions at inference time. Therefore, a crucial consideration is ▶ [P1] out-of-distribution

generalization: the ability to generalize to state-action distributions beyond those observed during training. This challenge is often compounded by the scarcity of observational data available to accurately learn dynamics, highlighting the importance of ▶ [P2] sample-efficient learning . Additionally, the model should be ▶ [P3] evolvable: capable of efficiently adapting (i.e. with minimal retraining) to changes in the underlying system dynamics . This is particularly crucial in healthcare domains, such as epidemiological modeling and treatment planning, where DTs are regularly updated to reflect fundamental changes in disease transmission patterns (caused by viral mutations, vaccination coverage) or evolving drug resistance mechanisms, often with minimal additional data of emergent dynamics [6, 7].

Existing approaches for creating DTs primarily utilize two approaches: mechanistic models or MLbased neural models. Mechanistic models, denoted as f mech , are closed-form equations grounded in domain knowledge such as biological or physical principles. They offer high accuracy and generalization given sufficient domain understanding but are limited in their ability to model systems where scientific knowledge is incomplete [8, 9]. Of related note, techniques have been introduced to discover governing equations directly from data, but face challenges in scaling to more complex problem settings [10, 11]. Conversely, neural approaches, f neural , leverage neural networks (NN) to learn DTs directly from data, often requiring minimal knowledge [12, 13, 14, 15]. Such models are effective given sufficient training data that provides adequate coverage of state-action distributions, but struggle in data-scarce settings and are difficult to evolve to reflect changing conditions due to their overparameterized, monolithic nature.

Key considerations. Informed by this context, Hybrid Digtal Twins (HDTwins) combine the strengths of both approaches through compositions of neural and mechanistic components, i.e. f = f mech ◦ f neural . Here, f mech symbolically incorporates domain-grounded priors, improving generalization and regularization while simplifying the complexity of patterns that have to be learned by the neural component. In other terms, f neural complements the mechanistic component by modeling complex temporal patterns in regions where the mechanistic model might be oversimplified or incomplete. Consequently, HDTwins can more accurately and robustly capture system dynamics, particularly in settings with (limited) empirical data and (partial) domain knowledge .

Conceptually, hybrid modeling involves two stages: model specification , determining the model structure (e.g. neural architecture, symbolic equations), and model parameterization , estimating model parameters (e.g. neural weights, coefficients). This process, with model specification in particular, has traditionally relied heavily on human expertise to craft problem-specific models [16, 17, 18, 19]. In this work, we investigate the feasibility of automatically designing hybrid models with minimal expert involvement, which would significantly enhance the efficiency and scalability of model development. This task is challenging, as it requires searching for optimal specification and corresponding parameters within a vast combinatorial model space [20, 21]. To address this, we introduce HDTwinGen , a novel evolutionary framework that autonomously and efficiently designs HDTwins. At a high level, our method represents hybrid model specifications in code and leverages large language models (LLMs) for their domain knowledge, contextual understanding, and learning capabilities to propose symbolically represented models and search the model space [22, 23, 24]. This is coupled with offline optimization tools to empirically estimate model parameters from training data. More specifically, HDTwinGen utilizes two LLM agents: the modeling agent , whose task is to generate novel model specifications, and the evaluation agent , which analyzes performance and provides targeted recommendations for improvement. Through multiple iterations, HDTwinGen efficiently evolves better performing hybrid models with informed modifications.

Contributions: 1 Conceptually , we present the first work in automated hybrid model design , jointly optimizing model specification and parameterization of hybrid digital twins. 2 Technically , we introduce HDTwinGen , a novel evolutionary framework employing LLMs and offline optimization tools to propose, evaluate, and iteratively enhance hybrid models. 3 Empirically , we demonstrate that our method learns more accurate DTs, achieving ▶ better out-of-distribution generalization, ▶ sample-efficient learning, and ▶ increased flexibility for modular evolvability.

2 Digital Twins of Dynamical Systems

A dynamical system S := ( X , U , Φ) is a tuple of its d X -dimensional state space X ⊆ R d X , an (optional) d U -dimensional action space U ⊆ R d U , and a dynamics model Φ . The state at time

t ∈ T ⊆ R + is represented as a vector, x ( t ) ∈ X and similarly the action taken is represented as a vector u ( t ) ∈ U . The continuous-time dynamics of the system can be described by d x ( t ) / d t = Φ( x ( t ) , u ( t ) , t ) , where Φ : X × U × T →X . We optionally consider the existence of some policy π : X → P ( U ) that acts on the system by mapping a state x ( t ) to a distribution over actions u ( t ) .

Digital Twins. Digital twins (DTs) aim to approximate Φ : X × U × T →X using a computational model f θ,ω ( θ ) ∈ F learned from data. Here, we use θ ∈ Θ to denote the specification of the model (e.g. linear) and ω ( θ ) ∈ Ω( θ ) to indicate the set of parameters specified by θ . Additionally, F , Θ , and Ω( θ ) are the spaces of all possible models, specifications, and parameters, respectively. Next, we outline the key desiderata for a DT:

[P1] Generalization to unseen state-action distributions. As DTs are required to simulate varying conditions, they should extrapolate to state-action distributions not observed during training time. Formally, the generalization error E ( x ( t ) ,u ( t ) ,y ( t )) ∼ p OOD [ L ( f θ,ω ( θ ) ( x ( t ) , u ( t )) , y ( t ))] should be minimized, where L is some loss function, and p OOD represents the out-of-distribution scenario. [P2] Sample-efficient learning. Given the often limited availability of real-world data, DTs should learn robustly from minimal empirical data. In other words, they must have good sample complexity , achieving the desired level of generalization with a limited number of observations [25].

[P3] Evolvability. Dynamical systems are, by nature, non-stationary and evolve over time [26, 27]. From a modeling perspective, the DT should be easily evolved to reflect changing underlying dynamics, minimizing the need for additional data or expensive model re-development, i.e. θ and ω ( θ ) should be easily adjustable to reflect changing system dynamics.

For the purpose of model learning, we assume access to an offline dataset containing N ∈ N + trajectories, where the measurements of the systems are made at discrete time points [ T ] = [ t 1 , t 2 , . . . T ] . This dataset, D = {{ ( x ( n ) ( t ) , u ( n ) ( t ) , y ( n ) ( t )) | t ∈ [ T ] }} N n =1 , contains state-action trajectories sampled regularly over time, where y ( n ) ( t ) = x ( n ) ( t +∆ t ) represents the subsequent state.

3 Hybrid Digital Twins

HDTwin. AHybrid Digital Twin is a composition of mechanistic and neural components, represented as f θ,ω ( θ ) = f mech ◦ f neural [18, 28]. This class of hybrid models offers several advantages that align with our desiderata. The mechanistic component allows partial knowledge to be encoded through its symbolic form, which, while not sufficient alone to accurately predict underlying dynamics, is complemented by the neural components that learn from available data. This combination aids in generalization ( [P1] ), especially moving beyond conditions observed in training, and improves sample complexity ( [P2] ). Furthermore, the mechanistic component can be quickly and easily updated with new parameters due to its simpler, lower-dimensional structure, allowing the overall model to adapt efficiently to remain accurate in changing conditions ( [P3] ). In this work, we focus on additive compositions, f θ,ω ( θ ) = f mech + f neural , as they are more interpretable. Additionally, it enables individual contributions of mechanistic and neural components to be easily disentangled and simplifies the optimization to allow gradient-based methods [16]. Nonetheless, we encourage future works to investigate alternative composition strategies (e.g. branching composition) to develop more advanced HDTwins [29].

Learning the hybrid model can be decomposed into two steps: (1) model specification , or learning the structure, θ ∈ Θ , of the dynamics function that describes how the system evolves over time; and (2) model parameterization , which estimates the specific values of parameters ω ( θ ) ∈ Ω( θ ) for a given specification θ . For instance, the logistic-growth model specifies a structure for population growth, while parameterization involves estimating the growth rate and carrying capacity. 3 More generally, this learning problem can be mathematically formulated as a bilevel optimization problem:

Here, the upper-level problem involves finding the optimal specification θ ∗ that minimizes the outer objective L outer , while the lower-level problem involves finding the optimal parameters ω ∗ ( θ ) for a given specification θ that minimizes the inner objective function L inner . To be more concrete, the

<latexi sh

1_b

64="fpWY79JSM2dj/rRZ

C

0y

>A

3

c

VBN

w

E

vXqk

LI

T

Q

P

m

g

n

z

U

o

+

G

F

KD

8

O

5

H

u

<latexi sh

1_b

64="B

TN

L

f7

DA

U

Jc

Y/rW

5

w

>

n

V

S

F

3

2vq yE

C

KI

u

MZ

R

p

d

oO

z

Q

G

m

9

0

g

k

P

j

X

H

8

<latexi sh

1_b

64="ckF/

A

Ly

GQ2wVo

WP3

X7d

H

>

CB

SgN

J

Mr qn

Y

E

z

I

p

m

0

U

8

Z

D

v

R

9

K

O

5u

+

T

f

j

<latexi sh

1_b

64="qO

0U2

nFLD

Q

Cdyu jrW

B

w

>A

8H

c

V

NS

M

EJ3

9

v

k

g

X

o

m

Z

G

p

/

R

YP

z

f

5

T

7

+

I

K

<latexi sh

1_b

64="B

TN

L

f7

DA

U

Jc

Y/rW

5

w

>

n

V

S

F

3

2vq yE

C

KI

u

MZ

R

p

d

oO

z

Q

G

m

9

0

g

k

P

j

X

H

8

<latexi sh

1_b

64="PDKOI

/dH3jREfm

2c r7

A8

>

C

VF

9

w

JW

z

y

+

L

Z

k

M

u

U

N

g

q

XoQ

S

nY0

B

v

5

T

p

G

<latexi sh

1_b

64="q58

ENv0p

Rn

HSM

GCwuY

>A

Q3

c

VB

T

P

W

r

X

F

I

yo

K

7

/

D

+

J

9

m

f

k

2

z

Z

gO

U

<latexi sh

1_b

64="

Dy5NrqgLfRTU

9

c

H

E

>A

C

n

V

d

w

J

u

j2

v

m

X

o+z

W0

7

k

SF

I

G

Z

P

/

3

M

Q

O

p

K

B

<latexi sh

1_b

64="HXg0

7nFwB

JIY

3

N

/f

>A

Cc

V

M

EPUu

2

S

m

Q

R

d

j

Z

+

Or9

p

zy

8

Kk

W

v

L5

T

D

G

o

q

<latexi sh

1_b

64="B

TN

L

f7

DA

U

Jc

Y/rW

5

w

>

n

V

S

F

3

2vq yE

C

KI

u

MZ

R

p

d

oO

z

Q

G

m

9

0

g

k

P

j

X

H

8

<latexi sh

1_b

64="KrpJOoLwj

/k

ZDX

TWA

H

I0

>

CV3

c

FN

E

uv

z

57

2G9

US8

m

R

f

P

d

g

+

n

Q

Y

M

y

B

q

<latexi sh

1_b

64="

S

RNfuwm n+d5

A

>

c

V

9

E

2LXzF

O

y

ToJZ

G

I

H

k

7Y3

DM

P0

8

r

W

Q

q

U

j

/

K

<latexi sh

1_b

64="kY

K8W+oX

NwSM

B

j

C

HQ

I

U

>A

O

c

V

R

E

J/

g

PzZ

9

y

D

u

n

T0

2

G

v5

r

q

f

3

m

d

F

L

p

7

<latexi sh

1_b

64="I0pB

qw gVuU

Y

PjG

M

/5d

o

>A

C

n

c

D

S

EO

R

3W

y

X

kmQ

Hv

F

Z

2

7

z

J

9

NL

+r

f

K

8

T

<latexi sh

1_b

64="

YN

2OoZqG

U

85Wj

M

B

k

>A

c

VF

9

v

K

D

QS

J

7

r

T

p

y

0

f

I

L

u

d

3

+

/

m

P

R

z

<latexi sh

1_b

64="

PWfXA

q

yo

m

/

9Qrg

>

CB

VDJ

N

EO

j

H

0Gv

M

ZI

u

p

R

w5

LF

3

8

z

2

K

7

U

n

+

Modeling

Context

Evaluation

Feedback

Modeling

Agent

HDTwin

Compute component-wise

val loss

Set of Top-

𝐾

HDTwins

Compute average val loss

Update

population

3) Evaluate HDTwin

Modeling

Context

S

context

S

context

H

(

g

-

1)

P

(

g

-

1)

=

{

(

f

(1)

θ,ω

(

θ

)

∗

, δ

(1)

, υ

(1)

)

,

. . .

(

f

(

K

)

θ,ω

(

θ

)

∗

, δ

(

K

)

, υ

(

K

)

)

}

2) Optimize model

parameterization

LLM

model

ω

(

θ

)

∗

argmin

ω

(

θ

)

∈

Ω(

θ

)

L

(

f

θ,ω

(

θ

)

,

D

train

)

f

θ,ω

(

θ

)

∼

LLM

model

(

H

(

g

-

1)

,

P

(

g

-

1)

,

S

context

)

f

θ,ω

(

θ

)

∗

υ

=

L

(

f

θ,ω

(

θ

)

∗

,

D

val

)

User

δ

=

δ

(

f

θ,ω

(

θ

)

∗

,

D

val

)

1) Modeling agent generates

specification

Modeling

Context

P

(

g

)

(

g

-

1)

⊕

(

f

θ,ω

(

θ

)

∗

, δ, υ

)

3) Evaluation agent generates

NL feedback

Set of Top-

𝐾

HDTwins

Evaluation

Agent

LLM

eval

S

context

H

(

g

)

∼

LLM

eval

(

S

context

,

P

(

g

)

)

D

=

{D

train

,

D

val

}

P

(

g

)

=

{

(

f

(1)

θ,ω

(

θ

)

∗

, δ

(1)

, υ

(1)

)

,

. . .

(

f

(

K

)

θ,ω

(

θ

)

∗

, δ

(

K

)

, υ

(

K

)

)

}

outer objective measures the generalization performance, empirically measured on the validation set L val , while the inner objective measures the fitting error, as evaluated on the training set L train .

Combinatorial search space. The space of possible specifications Θ (e.g. different networks, functional forms) is discrete and combinatorially large, while Ω( θ ) represents the continuous space of parameters to be optimized. Selecting the optimal θ, ω ( θ ) thus involves searching through a vast combinatorial space. Performing this search through traditional means, such as genetic programming [21] or evolutionary algorithms [20], is computationally challenging, time-consuming, and often technically infeasible. To the best of our knowledge, our work is the first to address the problem of automatic HDTwin development, where we incorporate LLMs (combined with offline optimization tools) to automatically optimize both the specification and the parameterization of hybrid models.

4 HDTwinGen: Automatic Design of HDTwins

Human experts craft models by making strategic design decisions based on their domain knowledge, starting with a sensible initial model specification and performing intelligent modifications based on empirical evaluations. Our key insight is that LLMs can effectively emulate these capabilities to efficiently navigate the search space in Equation (1) and autonomously design HDTwins . More specifically, our method utilizes LLMs for three major purposes: ▶ source of domain knowledge , where LLMs inject domain-consistent knowledge into the model specification, particularly through the symbolic representation f mech ; ▶ efficient search , by making intelligent modifications to the specification to converge more efficiently on the optimal hypothesis; and ▶ contextual understanding , enabling the algorithm to incorporate task-specific context and targeted feedback for model improvement [22, 23, 24].

Overview. We operationalize this insight through HDTwinGen , an evolutionary algorithm that iteratively evolves a population of candidate solutions to automatically search for the best HDTwin. Our approach employs a framework comprising three key elements: (1) human experts provide an initial system description, modeling objectives, and requirements as a structured prompt; (2) a modeling agent proposes new model specifications, optimizes their parameters on a training dataset, and collects validation performance metrics; (3) an evaluation agent assesses the proposed models using both data-driven performance metrics and qualitative evaluations against expert-defined objectives and requirements. The agents communicate using natural language and a custom code format representing the HDTwin model, facilitating autonomous and iterative model enhancement. An overview of our method is presented in Figure 1, with pseudocode in Appendix E.1.

Initial prompt design. The optimization process begins with a human expert providing a structured prompt, referred to as the modeling context S context . This modeling context outlines the system description, modeling objectives L , and requirements R :

The system description semantically describes the system, including state and action variables, giving the algorithm the contextual understanding necessary for informed model development.

The modeling requirements R are qualitative and described in natural language, detailing aspects such as interpretability (e.g. fully mechanistic or hybrid model) and additional scientific knowledge (e.g. a log-linear relationship between variables).

The modeling objective specifies quantitative performance requirements via a metric L .

In practice, R can incorporate various requirements, allowing for the design of both purely mechanistic and hybrid models, a flexibility that we demonstrate experimentally. The model is represented in Python, where purely mechanistic specifications are represented in native Python and neural components are represented using PyTorch [31]. Moreover, S context includes a skeleton code to guide the synthesis of executable code in a predetermined format. For illustrative purposes, an example of S context is provided in Appendix E.4.

Evolutionary optimization overview. Given S context as input, HDTwinGen performs G iterations of optimization, where G ∈ N + . The population of proposed HDTwins at iteration g is represented as P ( g ) . Each iteration creates a new candidate model based on previously created models in P ( g ) and feedback. Only the top K models are retained after each iteration, except when g < K , in which case all generated models are kept, i.e. max g ∈ [ G ] |P ( g ) | = K . Each model in P ( g ) is characterized by a tuple containing its model specification (represented symbolically through code) and validation metrics. After completing G iterations, the model with the best validation performance in P ( G ) is selected as the final model.

4.1 Modeling Agent

Proposing HDTwins. The goal of the modeling step is to propose novel HDTwins based on previously proposed models and feedback from the evaluation agent. Specifically, on the g -th iteration, the modeling agent takes as input ▶ P ( g -1) : the set of topK previously generated models; ▶ H ( g -1) : the most recent feedback produced by the evaluation agent (where on the initial step, g = 1 , both are empty, i.e., H (0) = ∅ , P (0) = ∅ ); and ▶ S context : the modeling context. The modeling agent generates a model specification θ using a predefined code format (i.e. skeleton code ). By observing multiple previously best-performing models and their performances, the modeling agent can exploit this context as a rich form of in context-learning and evolve improved specifications in subsequent generations [22]. Each generated specification emits its corresponding parameters, ω ( θ ) are fitted to the training set D train . More formally, we represent this generative procedure as f θ,ω ( θ ) ∼ LLM model ( H, P ( g ) , S context ) .

Model specification. To generate model specifications, the modeling agent decomposes the system into a set of components, with each component describing the dynamics of a specific state variable. In other words, for a system with d X state variables, there will be d X components. Each component is characterized by its own set of inputs and a unique dynamics function that describes the dynamics of its associated state variable over time. This modular representation enables independent analysis and optimization of individual components. In cases where R specifies purely mechanistic equations, the component dynamics are entirely defined using closed-form equations. Conversely, in a hybrid model, the mechanistic equation can be augmented with a neural network (implemented in PyTorch) to model residuals (i.e. in an additive fashion). The choice between mechanistic and hybrid models is left to the user, balancing the trade-off between transparency and predictive performance. Concretely, the specification step involves 'filling in' the skeleton code with a detailed body of code, specifying the decomposition, and delineating each component's dynamics function as a separate code structure (for a generated HDTwin example, see Appendix I).

Model optimization. The generated specification emits ω ( θ ) , which are treated as placeholder values, and are then optimized against the training dataset. Specifically, we optimize the mean squared error for the parameters that minimize this loss as ω ∗ ( θ ) = arg min ω ( θ ) L ( f θ,ω ( θ ) , D train ) . In this work, we consider ω ( θ ) to be continuous variables, and as such, we optimize θ by stochastic gradient descent, using the Adam optimizer [32]. However, we note other optimization algorithms, such as black-box optimizers, could also be used (for more details, see Appendix F, Equation (5)). The parameter optimization step then yields the complete model, f θ,ω ∗ ( θ ) .

Quantitative evaluation. For each generated model, we evaluate them quantitatively. Specifically, we collect the validation mean squared error loss per component, which we denote as

δ = [ δ 1 , δ 2 , . . . , δ d X ] (Appendix F, Equation (6)). We also compute the validation loss of the overall model as well as υ = L ( f θ,ω ∗ ( θ ) , D val ) . Finally, the generated model and its validation losses are included in a tuple and added to the topK models P ( g ) ←P ( g -1) ⊕ ( f θ,ω ∗ ( θ ) , δ, υ ) , where P ( g ) automatically removes the lowest performing models, and also only adds a new model to P ( g ) if it is unique. We highlight that we consider the topK models only to apply selection pressure , such that only the best-performing models are considered when generating the next HDTwin [33].

4.1.1 Evaluation Agent

Model evaluation. The goal of the evaluation step is to reflect on the current set of topK models, P ( g ) against requirements R and provide actionable and detailed feedback to the modeling agent for model improvement: H ( g ) ∼ LLM eval ( R , P ( g ) ) . We note that H ( g ) is provided in natural language and can be viewed as a dense feedback signal, a notable distinction from traditional learning methods, where feedback often takes the form of simple scalar values, such as loss gradients or rewards. Leveraging natural language feedback allows the agent to (1) engage in comparative analysis, identifying effective specifications in P ( g ) contributing to higher performance and discerning patterns common in less effective models, informing its suggestions for further model improvement; (2) qualitatively evaluate models against qualitative requirements R -leveraging the LLM's capacity to reason about proposed HDTwins to reflect these requirements via model improvement feedback.

Enhancing search. By providing rich feedback to improve model specification, the evaluation and modeling agent collaborate to efficiently evolve high-performing models. Empirically, in Appendix J, we observe that the evaluation agent provides targeted and specific feedback, including componentspecific suggestions, proposing alternative decompositions, removing parameters, or introducing non-linear terms. It is noteworthy that the feedback H ( g ) , expressed flexibly in natural language, could easily be further enriched through direct human feedback. We demonstrate this human-inthe-loop capability by including expert feedback during the optimization process through H ( g ) and observed that it was integrated into newly generated HDTwins. Though further investigation is beyond the scope of this work, this demonstration highlights promising avenues for augmenting human-machine collaboration in the autonomous design of DTs.

5 Related Works

For an extended related work, refer to Appendix B. Our work focuses on autonomously learning DTs from data, with several relevant research strands:

Neural sequence models. ML approaches commonly address learning system dynamics as a sequential modeling problem. In these settings, f θ,ω ( θ ) are typically black-box models, where θ ∈ Θ is the NN architecture and ω ( θ ) are its weights. Early models like Hidden Markov Models [34] and Kalman filters [35] made simplifying Markovian and linearity assumptions, later extended to nonlinear settings [36, 37]. Subsequent models, including recurrent neural networks [38], along with their advanced variants [39, 40, 41], introduced the capability to model longer-term dependencies. More recent advancements include attention mechanisms [42] and Transformer models [43], significantly improving the handling of long-term dependencies in sequence data. Another line of work, Neural Ordinary Differential Equations (NODE) [14, 44, 45], interprets neural network operations as differential equations. These methods have found utility in modeling a range of complex systems [46, 47, 48, 49]. While deep sequence models are proficient at capturing complex dynamics, they are heavily reliant on training data for generalization ( [P1, P2] ), and their monolithic and overparameterized structures limit evolvability ( [P3] ).

Mechanistic (discovery) models. Beyond purely neural approaches, another line of work aims to discover a system's governing equations directly from data. Here θ ∈ Θ are closed-form equations and ω ( θ ) are their parameters. These include symbolic regression techniques [10], Eureqa [50], SINDy [11], D-CODE [51, 52], among others [52, 53] that search for θ and ω ( θ ) from data. These techniques struggle to scale to higher-dimensional settings and rely on experts to perform variable selection and define the function set and primitives available to the search algorithms.

Hybrid models. Recent efforts have also created hybrid models by integrating physical laws with neural models. Physics-informed neural networks [15, 54], and methods including Hamiltonian Neural Networks [55], Lagrangian Neural Networks [56] integrate structural priors of physical

systems to improve generalization. These techniques introduce specialized mechanisms to incorporate precisely known physical principles. Additionally, [57] integrates prior ODE/PDE knowledge into a hybrid model, using specialized regularization to penalize the neural component's information content. [58, 59] consider settings where an expert equation is known, but equation variables are latent and unobserved. Correspondingly, they employ two sets of latent variables: one governed by expert equations and another linked to neural components. [60] performs data augmentation by sampling out-of-distribution trajectories from expert models. While existing approaches rely on expert models to perform the hybrid model design, HDTwinGen is an automated approach to jointly optimize hybrid model specification and its parameters.

6 Experiments and Evaluation

In this section, we evaluate HDTwinGen and verify that it significantly outperforms state-of-the-art methods in modeling system dynamics over time from an observed dataset and corresponding system description. 4

Benchmark datasets . We evaluate against six real-world complex system datasets; where each dataset is either a real-world dataset or has been sampled from an accurate simulator designed by human experts. Three are derived from a state-of-the-art biomedical Pharmacokinetic-Pharmacodynamic (PKPD) model of lung cancer tumor growth, used to simulate the combined effects of chemotherapy and radiotherapy in lung cancer [61] (Equation (2))-this has been extensively used by other works [62, 63, 64]. Here we use this bio-mathematical lung cancer model to create three variations of lung cancer under the effect of no treatments ( Lung Cancer ), chemotherapy only ( Lung Cancer (with Chemo.) ), and chemotherapy combined with radiotherapy ( Lung Cancer (with Chemo. & Radio.) ). We also compare against an accurate and complex COVID-19 epidemic agent-based simulator ( COVID-19 ) [65], which is capable of modeling non-pharmaceutical interventions, such as physical distancing during a lockdown. Furthermore, we compare against an ecological model of a microcosm of algae, flagellate, and rotifer populations ( Plankton Microcosm )-replicating an experimental three-species prey-predator system [66]. Moreover, we also compare against a real-world dataset of hare and lynx populations ( Hare-Lynx ), replicating predator-prey dynamics [67]. We detail all benchmark datasets details in Appendix C.

Evaluation Metrics . We employ mean squared error (MSE) to evaluate the benchmark methods on a held-out test dataset of state-action trajectories, denoted as D test , using the loss defined in Equation (5) and report this as T MSE . Each metric is averaged over ten runs with different random seeds, and we present these averages along with their 95% confidence intervals, further detailed in Appendix G.

Benchmark methods . To assess whether HDTwinGen is state-of-the-art, we compare it with the most competitive and popular neural network models, which, when modeling the dynamics of a system over time, becomes a form of ODE model, that is a neural ODE [14] with action inputs ( DyNODE ) [68]. Moreover, we also compare against a recurrent neural network ( RNN ) [69] and a state-of-the-art transformer ( Transformer ) [64]. We also compare against mechanistic dynamical equations derived from equation discovery methods for ODEs, including Genetic Programming ( GP) [10] and Sparse Identification of Nonlinear Dynamics ( SINDy ) [11]. Lastly, we compare against a hybrid model ( APHYNITY ) that integrates prior knowledge in the form of ODEs into hybrid models, while penalizing the information content from the neural component [57]. Moreover, we compare against the ablations of our method, of the zero-shot generated HDTwin ( ZeroShot ) and this model with subsequently optimized parameters ( ZeroOptim ). We provide method implementation, hyperparameter, and experimental details in Appendix D.

7 Main Results

We evaluated all our benchmark methods across all our datasets tabulated in Table 1. HDTwinGen models the system the most accurately, achieving the lowest test prediction mean squared error on the held-out test dataset of state-action trajectories. In the interest of space, we include additional experimental evaluations in the appendix. Specifically, we also evaluate ▶ HDTwinGen performance on a suite of synthetically and procedurally generated benchmarks (Appendix H.9); ▶ comparisons

10 0

10

-

1

±

±

10 1

10 2

Number of trajectories

10 0

10 1

10 2

10 3

Number of trajectories

10

-

1

10 0

10 1

10 2

10 3

Test MSE

HDTwinGen

ZeroOptim

ZeroShot

SINDy

DyNODE

RNN

Transformer

against domain-specific baselines (Appendix H.8) and ▶ various ablation experiments, including ablation of LLM hyperparameters, prompt design, and algorithm settings (Appendices H.5 to H.7).

7.1 Insight Experiments

This section provides an in-depth analysis of HDTwinGen's effectiveness related to its benchmark counterparts. Specifically, we examine the core desiderata for an effective DT described in Section 2: [P1] out-of-distribution generalization, [P2] sample-efficient learning, and [P3] evolvability.

[P1] Can an HDTwin generalize to out-of-distribution shifts? To explore out-of-distribution shifts, we adapt the Lung Cancer (with Chemo. & Radio.) to produce a training dataset of states in a range that is outside those observed in the test set over all trajectories (Appendix H.1). We tabulate this in Table 2. Empirically, we find that HDTwinGen is more robust to out-of-distribution shifts than existing methods, benefiting from explicit decomposition and robust hybrid models. Notably, the neural network method DyNODE shows the largest relative error increase from IID to OOD by two orders of magnitude, while the mechanistic method SINDy exhibits a smaller increase by only one order of magnitude. This demonstrates the importance of hybrid models that leverage both neural and mechanistic components to enhance generalization performance under distribution shifts.

[P2] Can HDTwinGen improve sample-efficiency in model learning? To explore the low data settings, we re-ran all benchmark methods with fewer samples in their training dataset on the Lung Cancer (with Chemo. & Radio.) dataset. We plot this in Figure 2. Empirically, we observe that HDTwinGen can achieve lower performance errors, especially in lower-sample regimes.

[P3] Can HDTwinGen evolve its modular HDTwin to fit the system? We analyze this from an empirical point of view to determine if HDTwinGen can correctly evolve the generated HDTwin and reduce its prediction error over subsequent generations. We observe that HDTwinGen can indeed understand, reason, and iteratively evolve the generated code representation of the HDTwin to incorporate a better fitting HDTwin, as observed in Figure 3. In particular, the annotated results demonstrate that HDTwinGen effectively refines the hybrid model by strategically adjusting its neural and mechanistic components (in a fashion akin to human experts), leading to significant improvements

10 0

10 3

Validation MSE

10 0

10

-

1

2

4

6

8

10

Number of Generations

2

4

6

8

10

12

14

Number of Generations

10

-

1

10 0

Validation MSE

Initial white box

linear model.

Enhanced white box model with logistic growth for tumor volume,

interaction term for combined therapy effect, and bi-exponential

decay for chemotherapy drug concentration.

White and black box model with logistic

growth for tumor volume, Michaelis-

Menten saturation for chemotherapy

effect, sigmoid function for radiotherapy

effect, resistance development, and a

black box MLP for residuals.

White and black box model with

dynamic carrying capacity and decay

rate, non-linear interaction term, and an

updated black box MLP for residuals.

White and black box model with logistic

growth for tumor volume, Michaelis-

Menten saturation for chemotherapy

effect, sigmoid function for radiotherapy

effect, resistance development, and a

simplified black box MLP for residuals.

Top-1 HDTwin

0

5

10

15

20

25

30

35

40

t

(Days)

0

50000

Exposed (# Individuals)

Observed and trained on

Unobserved to predict

Lockdown

0

5

10

15

20

25

30

35

40

t

(Days)

0

True

HDTwin (with intervention)

SINDy

DyNODE

True NDST (with intervention) SINDy DyNODE in accuracy and robustness. This iterative evolution process demonstrates HDTwinGen's ability to adapt and optimize its modular components.

Can HDTwinGen Understand and Modify Its HDTwin? We investigate whether large language model (LLM) agents can take an optimized high-dimensional twin (HDTwin) from an existing benchmark dataset and adapt it to model an unobserved intervention that is not present in the training data. We note that this intervention emulates scenarios where the dynamics of the underlying system changes. We affirmatively answer this question by constructing a scenario where our COVID-19 simulator incorporates an unobserved intervention of a lockdown policy, which reduces physical interactions between individuals (Appendix H.2). As demonstrated in Figure 4, we observe that the code-model representation of the HDTwin can be (1) understood by the modeling agent LLM and (2) adapted in its parameters to accurately model and reflect this intervention. We find that HDTwinGen is the only method capable of changing the overall functional behavior by modifying a single parameter in the model ; in contrast, all other existing data-driven methods require a dataset of state-action trajectories under the new dynamics introduced by this intervention.

Ablation Studies . We conducted ablation studies on HDTwinGen and found several key insights. First, retaining the topK models within the LLM context leads to improved model generation (Appendix H.5). Additionally, HDTwinGen is compatible with various LLMs and different temperature settings (Appendix H.6). It also benefits from including textual descriptions of the variables to be modeled as prior information (Appendix H.7). Finally, HDTwinGen can be specifically instructed to generate mechanistic white-box models if desired (Appendix H.10).

12

14

8 Limitations and Discussions

In summary, this work addresses the problem of learning digital twins for continuous-time dynamical systems. After establishing clear learning objectives and key requirements, we introduce Hybrid Digital Twins ( HDTwins )-a promising approach that combines mechanistic understanding with neural architectures. HDTwins encode domain knowledge symbolically while leveraging neural networks for enhanced expressiveness. Conventional hybrid models, however, rely heavily on expert specification with learning limited to parameter optimization, constraining their scalability and applicability. To overcome these limitations, we propose a novel approach to automatically specify and parameterize HDTwins through HDTwinGen , an evolutionary framework that leverages LLMs to iteratively search for and optimize high-performing hybrid twins. Our empirical results demonstrate that evolved HDTwins consistently outperform existing approaches across multiple criteria, exhibiting superior out-of-distribution generalization, enhanced sample efficiency, and improved modular evolvability.

Limitations. While our results are promising, several important limitations remain. HDTwinGen's efficacy depends critically on human experts providing initial system specifications and on the underlying LLM's domain knowledge and model generation capabilities. Our current implementation focuses exclusively on continuous-time systems, which, although broadly applicable, represent only a subset of real-world systems. Future work could extend our approach through human-in-the-loop feedback mechanisms, integration with external tools, and expansion to broader system classes.

Ethical implications. We acknowledge the risk of bias transmission from the black-box LLMs into the evolved models. While our hybrid approach enables greater expert scrutiny through its human-interpretable components, we strongly recommend a comprehensive evaluation of evolved models for fairness, bias, and privacy concerns before deployment in sensitive applications.

Acknowledgments and Disclosure of Funding

We thank the anonymous reviewers, area and program chairs, members of the van der Schaar lab, and Andrew Rashbass for many insightful comments and suggestions. TL and SH would like to acknowledge and thank AstraZeneca for their sponsorship and support. This work was supported by Microsoft's Accelerate Foundation Models Academic Research initiative.

References

F. Tao, J. Cheng, Q. Qi, M. Zhang, H. Zhang, and F. Sui, 'Digital twin-driven product design, manufacturing and service with big data,' The International Journal of Advanced Manufacturing Technology , vol. 94, pp. 3563-3576, 2018.

J. Corral-Acero, F. Margara, M. Marciniak, C. Rodero, F. Loncaric, Y. Feng, A. Gilbert, J. F. Fernandes, H. A. Bukhari, A. Wajdan et al. , 'The 'digital twin'to enable the vision of precision cardiology,' European heart journal , vol. 41, no. 48, pp. 4556-4564, 2020.

H. A. Simon, The sciences of the artificial . MIT press, 1996.

J. Ladyman, J. Lambert, and K. Wiesner, 'What is a complex system?' European Journal for Philosophy of Science , vol. 3, pp. 33-67, 2013.

Q. Qi and F. Tao, 'Digital twin and big data towards smart manufacturing and industry 4.0: 360 degree comparison,' Ieee Access , vol. 6, pp. 3585-3593, 2018.

V. Iranzo and S. Pérez-González, 'Epidemiological models and covid-19: a comparative view,' History and Philosophy of the Life Sciences , vol. 43, no. 3, p. 104, 2021.

I. Bozic, J. G. Reiter, B. Allen, T. Antal, K. Chatterjee, P. Shah, Y. S. Moon, A. Yaqubie, N. Kelly, D. T. Le et al. , 'Evolutionary dynamics of cancer in response to targeted combination therapy,' elife , vol. 2, p. e00747, 2013.

R. Rosen, G. Von Wichert, G. Lo, and K. D. Bettenhausen, 'About the importance of autonomy and digital twins for the future of manufacturing,' Ifac-papersonline , vol. 48, no. 3, pp. 567-572, 2015.

T. Erol, A. F. Mendi, and D. Do˘ gan, 'The digital twin revolution in healthcare,' in 2020 4th international symposium on multidisciplinary studies and innovative technologies (ISMSIT) . IEEE, 2020, pp. 1-7.

J. R. Koza, 'Genetic programming as a means for programming computers by natural selection,' Statistics and computing , vol. 4, pp. 87-112, 1994.

S. L. Brunton, J. L. Proctor, and J. N. Kutz, 'Discovering governing equations from data by sparse identification of nonlinear dynamical systems,' Proceedings of the national academy of sciences , vol. 113, no. 15, pp. 3932-3937, 2016.

D. Ha and J. Schmidhuber, 'Recurrent world models facilitate policy evolution,' Advances in neural information processing systems , vol. 31, 2018.

J. Yoon, D. Jarrett, and M. Van der Schaar, 'Time-series generative adversarial networks,' Advances in neural information processing systems , vol. 32, 2019.

R. T. Chen, Y. Rubanova, J. Bettencourt, and D. K. Duvenaud, 'Neural ordinary differential equations,' Advances in neural information processing systems , vol. 31, 2018.

M. Raissi, P. Perdikaris, and G. E. Karniadakis, 'Physics-informed neural networks: A deep learning framework for solving forward and inverse problems involving nonlinear partial differential equations,' Journal of Computational physics , vol. 378, pp. 686-707, 2019.

L. Faure, B. Mollet, W. Liebermeister, and J.-L. Faulon, 'A neural-mechanistic hybrid approach improving the predictive power of genome-scale metabolic models,' Nature Communications , vol. 14, no. 1, p. 4669, 2023.

J. Pinto, J. R. Ramos, R. S. Costa, and R. Oliveira, 'A general hybrid modeling framework for systems biology applications: Combining mechanistic knowledge with deep neural networks under the sbml standard,' AI , vol. 4, no. 1, pp. 303-318, 2023.

P. Wang, Z. Zhu, W. Liang, L. Liao, and J. Wan, 'Hybrid mechanistic and neural network modeling of nuclear reactors,' Energy , vol. 282, p. 128931, 2023.

R. Cheng, A. Verma, G. Orosz, S. Chaudhuri, Y. Yue, and J. Burdick, 'Control regularization for reduced variance reinforcement learning,' in International Conference on Machine Learning . PMLR, 2019, pp. 1141-1150.

E. Real, S. Moore, A. Selle, S. Saxena, Y. L. Suematsu, J. Tan, Q. V. Le, and A. Kurakin, 'Large-scale evolution of image classifiers,' in International conference on machine learning . PMLR, 2017, pp. 2902-2911.

T. N. Mundhenk, M. Landajuela, R. Glatt, C. P. Santiago, D. M. Faissol, and B. K. Petersen, 'Symbolic regression via neural-guided genetic programming population seeding,' in Proceedings of the 35th International Conference on Neural Information Processing Systems , 2021, pp. 24 912-24 923.

T. Brown, B. Mann, N. Ryder, M. Subbiah, J. D. Kaplan, P. Dhariwal, A. Neelakantan, P. Shyam, G. Sastry, A. Askell et al. , 'Language models are few-shot learners,' Advances in neural information processing systems , vol. 33, pp. 1877-1901, 2020.

J. Wei, X. Wang, D. Schuurmans, M. Bosma, F. Xia, E. Chi, Q. V. Le, D. Zhou et al. , 'Chain-ofthought prompting elicits reasoning in large language models,' Advances in neural information processing systems , vol. 35, pp. 24 824-24 837, 2022.

A. Chowdhery, S. Narang, J. Devlin, M. Bosma, G. Mishra, A. Roberts, P. Barham, H. W. Chung, C. Sutton, S. Gehrmann et al. , 'Palm: Scaling language modeling with pathways,' Journal of Machine Learning Research , vol. 24, no. 240, pp. 1-113, 2023.

M. J. Kearns and U. Vazirani, An introduction to computational learning theory . MIT press, 1994.

H. A. Simon, 'The architecture of complexity,' Proceedings of the American philosophical society , vol. 106, no. 6, pp. 467-482, 1962.

T. L. Rogers, B. J. Johnson, and S. B. Munch, 'Chaos is not rare in natural ecosystems,' Nature Ecology & Evolution , vol. 6, no. 8, pp. 1105-1111, 2022.

M. Sokolov, M. von Stosch, H. Narayanan, F. Feidl, and A. Butté, 'Hybrid modeling-a key enabler towards realizing digital twins in biopharma?' Current Opinion in Chemical Engineering , vol. 34, p. 100715, 2021.

S. Chaudhuri, K. Ellis, O. Polozov, R. Singh, A. Solar-Lezama, Y. Yue et al. , 'Neurosymbolic programming,' Foundations and Trends® in Programming Languages , vol. 7, no. 3, pp. 158243, 2021.

A. Tsoularis and J. Wallace, 'Analysis of logistic growth models,' Mathematical biosciences , vol. 179, no. 1, pp. 21-55, 2002.

A. Paszke, S. Gross, F. Massa, A. Lerer, J. Bradbury, G. Chanan, T. Killeen, Z. Lin, N. Gimelshein, L. Antiga et al. , 'Pytorch: An imperative style, high-performance deep learning library,' Advances in neural information processing systems , vol. 32, 2019.

D. P. Kingma and J. Ba, 'Adam: A method for stochastic optimization,' arXiv preprint arXiv:1412.6980 , 2014.

J. H. Holland, 'Genetic algorithms,' Scientific american , vol. 267, no. 1, pp. 66-73, 1992.

L. R. Rabiner, 'A tutorial on hidden markov models and selected applications in speech recognition,' Proceedings of the IEEE , vol. 77, no. 2, pp. 257-286, 1989.

R. Kalman, 'A new approach to linear filtering and prediction problems,' Trans. ASME, D , vol. 82, pp. 35-44, 1960.

L. Li, Y. Zhao, D. Jiang, Y. Zhang, F. Wang, I. Gonzalez, E. Valentin, and H. Sahli, 'Hybrid deep neural network-hidden markov model (dnn-hmm) based speech emotion recognition,' in 2013 Humaine association conference on affective computing and intelligent interaction . IEEE, 2013, pp. 312-317.

R. G. Krishnan, U. Shalit, and D. Sontag, 'Deep kalman filters,' arXiv preprint arXiv:1511.05121 , 2015.

J. L. Elman, 'Finding structure in time,' Cognitive science , vol. 14, no. 2, pp. 179-211, 1990.

S. Hochreiter and J. Schmidhuber, 'Long short-term memory,' Neural computation , vol. 9, no. 8, pp. 1735-1780, 1997.

K. Cho, B. Van Merriënboer, C. Gulcehre, D. Bahdanau, F. Bougares, H. Schwenk, and Y. Bengio, 'Learning phrase representations using rnn encoder-decoder for statistical machine translation,' arXiv preprint arXiv:1406.1078 , 2014.

I. Sutskever, O. Vinyals, and Q. V. Le, 'Sequence to sequence learning with neural networks,' Advances in neural information processing systems , vol. 27, 2014.

D. Bahdanau, K. Cho, and Y. Bengio, 'Neural machine translation by jointly learning to align and translate,' arXiv preprint arXiv:1409.0473 , 2014.

A. Vaswani, N. Shazeer, N. Parmar, J. Uszkoreit, L. Jones, A. N. Gomez, Ł. Kaiser, and I. Polosukhin, 'Attention is all you need,' Advances in neural information processing systems , vol. 30, 2017.

E. Dupont, A. Doucet, and Y. W. Teh, 'Augmented neural odes,' Advances in neural information processing systems , vol. 32, 2019.

S. I. Holt, Z. Qian, and M. van der Schaar, 'Neural laplace: Learning diverse classes of differential equations in the laplace domain,' in International Conference on Machine Learning . PMLR, 2022, pp. 8811-8832.

M. A. Zaytar and C. El Amrani, 'Sequence to sequence weather forecasting with long short-term memory recurrent neural networks,' International Journal of Computer Applications , vol. 143, no. 11, pp. 7-11, 2016.

J. Devlin, M.-W. Chang, K. Lee, and K. Toutanova, 'Bert: Pre-training of deep bidirectional transformers for language understanding,' arXiv preprint arXiv:1810.04805 , 2018.

L. Sehovac and K. Grolinger, 'Deep learning for load forecasting: Sequence to sequence recurrent neural networks with attention,' Ieee Access , vol. 8, pp. 36 411-36 426, 2020.

S. Holt, A. Hüyük, Z. Qian, H. Sun, and M. van der Schaar, 'Neural laplace control for continuous-time delayed systems,' in International Conference on Artificial Intelligence and Statistics . PMLR, 2023, pp. 1747-1778.

M. Schmidt and H. Lipson, 'Distilling free-form natural laws from experimental data,' science , vol. 324, no. 5923, pp. 81-85, 2009.

Z. Qian, K. Kacprzyk, and M. van der Schaar, 'D-CODE: Discovering closed-form ODEs from observed trajectories,' in International Conference on Learning Representations , 2022. [Online]. Available: https://openreview.net/forum?id=wENMvIsxNN

K. Kacprzyk, Z. Qian, and M. van der Schaar, 'D-cipher: discovery of closed-form partial differential equations,' Advances in Neural Information Processing Systems , vol. 36, 2024.

K. Kacprzyk, T. Liu, and M. van der Schaar, 'Towards transparent time series forecasting,' in The Twelfth International Conference on Learning Representations , 2024. [Online]. Available: https://openreview.net/forum?id=TYXtXLYHpR

S. Cuomo, V. S. Di Cola, F. Giampaolo, G. Rozza, M. Raissi, and F. Piccialli, 'Scientific machine learning through physics-informed neural networks: Where we are and what's next,' Journal of Scientific Computing , vol. 92, no. 3, p. 88, 2022.

S. Greydanus, M. Dzamba, and J. Yosinski, 'Hamiltonian neural networks,' Advances in neural information processing systems , vol. 32, 2019.

M. Cranmer, S. Greydanus, S. Hoyer, P. Battaglia, D. Spergel, and S. Ho, 'Lagrangian neural networks,' arXiv preprint arXiv:2003.04630 , 2020.

Y. Yin, V. Le Guen, J. Dona, E. de Bézenac, I. Ayed, N. Thome, and P. Gallinari, 'Augmenting physical models with deep networks for complex dynamics forecasting,' Journal of Statistical Mechanics: Theory and Experiment , vol. 2021, no. 12, p. 124012, 2021.

N. Takeishi and A. Kalousis, 'Physics-integrated variational autoencoders for robust and interpretable generative modeling,' Advances in Neural Information Processing Systems , vol. 34, pp. 14 809-14 821, 2021.

Z. Qian, W. Zame, L. Fleuren, P. Elbers, and M. van der Schaar, 'Integrating expert odes into neural odes: pharmacology and disease progression,' Advances in Neural Information Processing Systems , vol. 34, pp. 11 364-11 383, 2021.

A. Wehenkel, J. Behrmann, H. Hsu, G. Sapiro, G. Louppe, and J.-H. Jacobsen, 'Robust hybrid learning with expert augmentation,' Transactions on Machine Learning Research , 2023. [Online]. Available: https://openreview.net/forum?id=oe4dl4MCGY

C. Geng, H. Paganetti, and C. Grassberger, 'Prediction of Treatment Response for Combined Chemo- and Radiation Therapy for Non-Small Cell Lung Cancer Patients Using a Bio-Mathematical Model,' Scientific Reports , vol. 7, no. 1, p. 13542, Oct. 2017.

I. Bica, A. M. Alaa, J. Jordon, and M. van der Schaar, 'Estimating counterfactual treatment outcomes over time through adversarially balanced representations,' in International Conference on Learning Representations , 2020.

N. Seedat, F. Imrie, A. Bellot, Z. Qian, and M. van der Schaar, 'Continuous-time modeling of counterfactual outcomes using neural controlled differential equations,' arXiv preprint arXiv:2206.08311 , 2022.

V. Melnychuk, D. Frauen, and S. Feuerriegel, 'Causal transformer for estimating counterfactual outcomes,' in International Conference on Machine Learning . PMLR, 2022, pp. 15 29315 329.

C. C. Kerr, R. M. Stuart, D. Mistry, R. G. Abeysuriya, K. Rosenfeld, G. R. Hart, R. C. Núñez, J. A. Cohen, P. Selvaraj, B. Hagedorn et al. , 'Covasim: an agent-based model of covid-19 dynamics and interventions,' PLOS Computational Biology , vol. 17, no. 7, p. e1009149, 2021.

T. Hiltunen, L. Jones, S. Ellner, and N. G. Hairston Jr, 'Temporal dynamics of a simple community with intraguild predation: an experimental test,' Ecology , vol. 94, no. 4, pp. 773779, 2013.

E. P. Odum and G. W. Barrett, 'Fundamentals of ecology,' The Journal of Wildlife Management , vol. 36, no. 4, p. 1372, 1972.

V. M. M. Alvarez, R. Ro¸ sca, and C. G. F˘ alcu¸ tescu, 'Dynode: Neural ordinary differential equations for dynamics modeling in continuous control,' arXiv preprint arXiv:2009.04278 , 2020.

D. E. Rumelhart, G. E. Hinton, and R. J. Williams, 'Learning representations by backpropagating errors,' nature , vol. 323, no. 6088, pp. 533-536, 1986.

S. Holt, A. Hüyük, and M. van der Schaar, 'Active observing in continuous-time control,' Advances in Neural Information Processing Systems , vol. 36, 2024.

S. Holt, Z. Qian, and M. van der Schaar, 'Deep generative symbolic regression,' in The Eleventh International Conference on Learning Representations , 2023. [Online]. Available: https://openreview.net/forum?id=o7koEEMA1bR

K. Kacprzyk, S. Holt, J. Berrevoets, Z. Qian, and M. van der Schaar, 'ODE discovery for longitudinal heterogeneous treatment effects inference,' in The Twelfth International Conference on Learning Representations , 2024. [Online]. Available: https://openreview.net/forum?id=pxI5IPeWgW

T. Liu, N. Astorga, N. Seedat, and M. van der Schaar, 'Large language models to enhance bayesian optimization,' in The Twelfth International Conference on Learning Representations , 2024. [Online]. Available: https://openreview.net/forum?id=OOxotBmGol

C. Yang, X. Wang, Y. Lu, H. Liu, Q. V. Le, D. Zhou, and X. Chen, 'Large language models as optimizers,' in The Twelfth International Conference on Learning Representations , 2024. [Online]. Available: https://openreview.net/forum?id=Bb4VGOWELI

M. Chen, J. Tworek, H. Jun, Q. Yuan, H. P. D. O. Pinto, J. Kaplan, H. Edwards, Y. Burda, N. Joseph, G. Brockman et al. , 'Evaluating large language models trained on code,' arXiv preprint arXiv:2107.03374 , 2021.

S. Holt, M. R. Luyten, and M. van der Schaar, 'L2MAC: Large language model automatic computer for extensive code generation,' in The Twelfth International Conference on Learning Representations , 2024. [Online]. Available: https://openreview.net/forum?id=EhrzQwsV4K

S. Holt, Z. Qian, T. Liu, J. Weatherall, and M. van der Schaar, 'Data-driven discovery of dynamical systems in pharmacology using large language models,' in The Thirty-eighth Annual Conference on Neural Information Processing Systems , 2024.

N. Astorga, T. Liu, N. Seedat, and M. van der Schaar, 'Partially observable cost-aware activelearning with large language models,' in The Thirty-Eighth Annual Conference on Neural Information Processing Systems , 2024.

W. Bonnaffé and T. Coulson, 'Fast fitting of neural ordinary differential equations by bayesian neural gradient matching to infer ecological interactions from time-series data,' Methods in Ecology and Evolution , vol. 14, no. 6, pp. 1543-1563, 2023.

S. K. Kumar, 'On weight initialization in deep neural networks,' arXiv preprint arXiv:1704.08863 , 2017.

A. Graves, S. Fernández, and J. Schmidhuber, 'Multi-dimensional recurrent neural networks,' in International conference on artificial neural networks . Springer, 2007, pp. 549-558.

B. K. Petersen, M. L. Larma, T. N. Mundhenk, C. P. Santiago, S. K. Kim, and J. T. Kim, 'Deep symbolic regression: Recovering mathematical expressions from data via risk-seeking policy gradients,' in International Conference on Learning Representations , 2020.

S. Hsiang, D. Allen, S. Annan-Phan, K. Bell, I. Bolliger, T. Chong, H. Druckenmiller, L. Y. Huang, A. Hultgren, E. Krasovich et al. , 'The effect of large-scale anti-contagion policies on the covid-19 pandemic,' Nature , vol. 584, no. 7820, pp. 262-267, 2020.

O. N. Bjørnstad, K. Shea, M. Krzywinski, and N. Altman, 'The seirs model for infectious disease dynamics.' Nature methods , vol. 17, no. 6, pp. 557-559, 2020.

F. Brauer, C. Castillo-Chavez, and C. Castillo-Chavez, Mathematical models in population biology and epidemiology . Springer, 2012, vol. 2.

Appendix

Table of Contents

A HDTwinGen Overview

We provide an illustrative example of HDTwinGen working in practice in Figure 5. 000 Develop a PyTorch module to simulate tumor and drug concentration changes in lung cancer treatment, ensuring

000

001

future of manufacturing.

022

Ifac-papersonline

Develop a PyTorch module to simulate tumor and drug concentration changes in lung cancer treatment, ensuring

interpretability and a validation loss of

002

1e-6...

interpretability and a validation loss of

1e-6...

You generated the following code completions, which then had their parameters optimized to the training dataset.

Develop a PyTorch module to simulate tumor and drug

Develop a PyTorch module to simulate tumor and drug concentration changes in lung cancer treatment, ensuring

interpretability and a validation loss of

1e-6...

003

004

005

006

007

008

009

010

011

012

013

014

015

016

017

018

019

020

021

022

023

You are tasked with creating a PyTorch module to simulate

the impact of chemo and radiotherapy on lung cancer tu-

mor volume and chemotherapy drug concentration.

Task Overview:

•

Objective

:

Simulate changes in tumor volume and

drug concentration due to chemotherapy and radiother-

apy dosages.

•

Key Variables

:

Tumor volume (

cm

3

), drug concentra-

tion (

mg

m

3

), chemotherapy dosage (

mg

m

3

), and radiotherapy

dosage (Gy).

•

Data

:

Train on a dataset of 1000 patients over 60 days.

•

Goals

:

Model should generalize well to unseen data with

a validation loss of

1e-6.

Code Requirements:

• Implement within a PyTorch 'nn.Module' called 'StateD-

ifferential'.

• Fill in

__init__

and

forward

methods to output the

rate of change of tumor volume and drug concentration.

• Use neural networks and differential equations; start with

interpretable models before moving to complex ones.

• Follow the provided skeleton code without altering func-

tion definitions.

[LLM Actor Response]

Model Code

(creates a linear white

/cog

Training model on train set...

Trained.

Validation MSE 4.41.

Develop a PyTorch module to simulate tumor and drug

concentration changes in lung cancer treatment, ensuring

interpretability and a validation loss of

1e-6...

You generated the following code completions, which

then had their parameters optimized to the training dataset.

Please reflect on how you can improve the code to mini-

mize the validation loss to 1e-6 or less.

• Iteration 1:

Model Code

Val MSE: 4.41 (Val loss per

dim; tumor_volume:

2.77, chemo:

6.06)

[LLM Critic Response] To enhance model accuracy:

• Adopt a logistic growth model for tumor dynamics, incor-

porating environmental carrying capacity.

• Introduce a decay rate for chemotherapy drug concentra-

tion to reflect metabolic processes.

• Add interaction terms between chemotherapy and radio-

therapy to model combined treatment effects.

Please now regenerate the code

[LLM Actor Response]

Model Code

(creates a white box

model with logistic growth for tumor volume and decay

rate for chemotherapy drug concentration)

/cog

Training model on train set...

Trained.

Validation MSE 4.23.

You generated the following code completions, which

then had their parameters optimized to the training dataset.

Please reflect on how you can improve the code to mini-

mize the validation loss to 1e-6 or less.

• Iteration 1:

Model Code

Val MSE: 4.41 (Val loss per

dim; tumor_volume:

2.77, chemo:

6.06)

• Iteration 2:

Model Code

Val MSE: 4.23 (Val loss per

dim; tumor_volume:

8.47, chemo:

8.95e-14)

[LLM Critic Response] To enhance model accuracy:

• Introduce a non-linear term, like a Michaelis-Menten

equation, to model the chemo concentrations and tumor

reduction.

• Replace the linear radiotherapy dosage effect with a non-

linear sigmoid function.

• Add a black box component, such as a multi-layer per-

ceptron, to address unexplained variances, ensuring the

complexity is managed to avoid overfitting.

Please now regenerate the code

[LLM Actor Response]

Model Code

(creates a white and

black box model with logistic growth for tumor volume,

Michaelis-Menten saturation for chemotherapy effect, sig-

moid function for radiotherapy effect, resistance develop-

ment, and a black box MLP for residuals)

/cog

Training model on train set...

Trained.

Validation MSE 1.25.

Please reflect on how you can improve the code to mini-

mize the validation loss to 1e-6 or less.

• Iteration 1:

Model Code

Val MSE: 4.41 (Val loss per

dim; tumor_volume:

2.77, chemo:

6.06)

• Iteration 2:

Model Code

Val MSE: 4.23 (Val loss per

dim; tumor_volume:

8.47, chemo:

8.95e-14)

...

[LLM Critic Response] To enhance model accuracy:

• Reduce the complexity of the MLP to improve general-

ization, as a complex structure hasn't consistently lowered

validation losses.

• Reassess the chemotherapy and radiotherapy interaction

term to better represent their combined effects, considering

non-linear interactions if necessary.

• Evaluate each biological term in the white box model for

its impact on validation loss.

Remove or consolidate terms

that do not significantly benefit the model to enhance per-

formance and simplicity.

Please now regenerate the code

[LLM Actor Response]

Model Code

(white and black box

model with logistic growth for tumor volume, Michaelis-

Menten saturation for chemotherapy effect, sigmoid func-

tion for radiotherapy effect, resistance development, and a

simplified black box MLP for residuals)

/cog

Training model on train set...

Trained.

Validation MSE 0.0723.

References

Rosen, R., Von Wichert, G., Lo, G., and Bettenhausen, K. D. About the importance of autonomy and digital twins for the

000

001

002

003

004

005

006

007

008

009

010

011

012

013

014

015

016

017

018

You are tasked with creating a PyTorch module to simulate

the impact of chemo and radiotherapy on lung cancer tu-

mor volume and chemotherapy drug concentration.

Task Overview:

•

Objective

:

Simulate changes in tumor volume and

drug concentration due to chemotherapy and radiother-

apy dosages.

•

Key Variables

:

Tumor volume (

cm

3

), drug concentra-

tion (

mg

m

3

), chemotherapy dosage (

mg

m

3

), and radiotherapy

dosage (Gy).

•

Data

:

Train on a dataset of 1000 patients over 60 days.

•

Goals

:

Model should generalize well to unseen data with

a validation loss of

1e-6.

Code Requirements:

• Implement within a PyTorch 'nn.Module' called 'StateD-

ifferential'.

• Fill in

__init__

and

forward

methods to output the

rate of change of tumor volume and drug concentration.

• Use neural networks and differential equations; start with

interpretable models before moving to complex ones.

• Follow the provided skeleton code without altering func-

tion definitions.

[LLM Actor Response]

Model Code

(creates a linear white

/cog

Training model on train set...

Trained.

Validation MSE 4.41.

Develop a PyTorch module to simulate tumor and drug

concentration changes in lung cancer treatment, ensuring

interpretability and a validation loss of

1e-6...

You generated the following code completions, which

then had their parameters optimized to the training dataset.

Please reflect on how you can improve the code to mini-

mize the validation loss to 1e-6 or less.

• Iteration 1:

Model Code

Val MSE: 4.41 (Val loss per

dim; tumor_volume:

2.77, chemo:

6.06)

[LLM Critic Response] To enhance model accuracy:

• Adopt a logistic growth model for tumor dynamics, incor-

porating environmental carrying capacity.

• Introduce a decay rate for chemotherapy drug concentra-

tion to reflect metabolic processes.

• Add interaction terms between chemotherapy and radio-

therapy to model combined treatment effects.

Please now regenerate the code

[LLM Actor Response]

Model Code

(creates a white box

model with logistic growth for tumor volume and decay

rate for chemotherapy drug concentration)

/cog

Training model on train set...

Trained.

Validation MSE 4.23.

Develop a PyTorch module to simulate tumor and drug

concentration changes in lung cancer treatment, ensuring

interpretability and a validation loss of

1e-6...

You generated the following code completions, which

then had their parameters optimized to the training dataset.

Please reflect on how you can improve the code to mini-

mize the validation loss to 1e-6 or less.

• Iteration 1:

Model Code

Val MSE: 4.41 (Val loss per

dim; tumor_volume:

2.77, chemo:

6.06)

• Iteration 2:

Model Code

Val MSE: 4.23 (Val loss per

dim; tumor_volume:

8.47, chemo:

8.95e-14)

[LLM Critic Response] To enhance model accuracy:

• Introduce a non-linear term, like a Michaelis-Menten

equation, to model the chemo concentrations and tumor

reduction.

• Replace the linear radiotherapy dosage effect with a non-

linear sigmoid function.

• Add a black box component, such as a multi-layer per-

ceptron, to address unexplained variances, ensuring the

complexity is managed to avoid overfitting.

Please now regenerate the code

[LLM Actor Response]

Model Code

(creates a white and

black box model with logistic growth for tumor volume,

Michaelis-Menten saturation for chemotherapy effect, sig-

moid function for radiotherapy effect, resistance develop-

ment, and a black box MLP for residuals)

/cog

Training model on train set...

Trained.

Validation MSE 1.25.

Develop a PyTorch module to simulate tumor and drug

concentration changes in lung cancer treatment, ensuring

interpretability and a validation loss of

1e-6...

You generated the following code completions, which

then had their parameters optimized to the training dataset.

Please reflect on how you can improve the code to mini-

mize the validation loss to 1e-6 or less.

• Iteration 1:

Model Code

Val MSE: 4.41 (Val loss per

dim; tumor_volume:

2.77, chemo:

6.06)

• Iteration 2:

Model Code

Val MSE: 4.23 (Val loss per

dim; tumor_volume:

8.47, chemo:

8.95e-14)

...

[LLM Critic Response] To enhance model accuracy:

• Reduce the complexity of the MLP to improve general-

ization, as a complex structure hasn't consistently lowered

validation losses.

• Reassess the chemotherapy and radiotherapy interaction

term to better represent their combined effects, considering

non-linear interactions if necessary.

• Evaluate each biological term in the white box model for

its impact on validation loss.

Remove or consolidate terms

that do not significantly benefit the model to enhance per-

formance and simplicity.

Please now regenerate the code

[LLM Actor Response]

Model Code

(white and black box

model with logistic growth for tumor volume, Michaelis-

Menten saturation for chemotherapy effect, sigmoid func-

tion for radiotherapy effect, resistance development, and a

simplified black box MLP for residuals)

/cog

Training model on train set...

Trained.

Validation MSE 0.0723.

002

003

004

005

006

007

008

009

010

011

012

013

014

015

016

017

018

019

020

021

You are tasked with creating a PyTorch module to simulate

the impact of chemo and radiotherapy on lung cancer tu-

mor volume and chemotherapy drug concentration.

Task Overview:

•

Objective

:

Simulate changes in tumor volume and

drug concentration due to chemotherapy and radiother-

apy dosages.

•

Key Variables

:

Tumor volume (

cm

3

), drug concentra-

tion (

mg

m

3

), chemotherapy dosage (

mg

m

3

), and radiotherapy

dosage (Gy).

•

Data

:

Train on a dataset of 1000 patients over 60 days.

•

Goals

:

Model should generalize well to unseen data with

a validation loss of

1e-6.

Code Requirements:

• Implement within a PyTorch 'nn.Module' called 'StateD-

ifferential'.

• Fill in

__init__

and

forward

methods to output the

rate of change of tumor volume and drug concentration.

• Use neural networks and differential equations; start with

interpretable models before moving to complex ones.

• Follow the provided skeleton code without altering func-

tion definitions.

[LLM Actor Response]

Model Code

(creates a linear white

/cog

Training model on train set...

Trained.

Validation MSE 4.41.

Develop a PyTorch module to simulate tumor and drug

concentration changes in lung cancer treatment, ensuring

interpretability and a validation loss of

1e-6...

You generated the following code completions, which

then had their parameters optimized to the training dataset.

Please reflect on how you can improve the code to mini-

mize the validation loss to 1e-6 or less.

• Iteration 1:

Model Code

Val MSE: 4.41 (Val loss per

dim; tumor_volume:

2.77, chemo:

6.06)

[LLM Critic Response] To enhance model accuracy:

• Adopt a logistic growth model for tumor dynamics, incor-

porating environmental carrying capacity.

• Introduce a decay rate for chemotherapy drug concentra-

tion to reflect metabolic processes.

• Add interaction terms between chemotherapy and radio-

therapy to model combined treatment effects.

Please now regenerate the code

[LLM Actor Response]

Model Code

(creates a white box

model with logistic growth for tumor volume and decay

rate for chemotherapy drug concentration)

/cog

Training model on train set...

Trained.

Validation MSE 4.23.

concentration changes in lung cancer treatment, ensuring

interpretability and a validation loss of

1e-6...

You generated the following code completions, which

then had their parameters optimized to the training dataset.

Please reflect on how you can improve the code to mini-

mize the validation loss to 1e-6 or less.

• Iteration 1:

Model Code

Val MSE: 4.41 (Val loss per

dim; tumor_volume:

2.77, chemo:

6.06)

• Iteration 2:

Model Code

Val MSE: 4.23 (Val loss per

dim; tumor_volume:

8.47, chemo:

8.95e-14)

[LLM Critic Response] To enhance model accuracy:

• Introduce a non-linear term, like a Michaelis-Menten

equation, to model the chemo concentrations and tumor

reduction.

• Replace the linear radiotherapy dosage effect with a non-

linear sigmoid function.

• Add a black box component, such as a multi-layer per-

ceptron, to address unexplained variances, ensuring the

complexity is managed to avoid overfitting.

Please now regenerate the code

[LLM Actor Response]

Model Code

(creates a white and

black box model with logistic growth for tumor volume,

Michaelis-Menten saturation for chemotherapy effect, sig-

moid function for radiotherapy effect, resistance develop-

ment, and a black box MLP for residuals)

/cog

Training model on train set...

Trained.

Validation MSE 1.25.

You generated the following code completions, which

then had their parameters optimized to the training dataset.

Please reflect on how you can improve the code to mini-

mize the validation loss to 1e-6 or less.

• Iteration 1:

Model Code

Val MSE: 4.41 (Val loss per

dim; tumor_volume:

2.77, chemo:

6.06)

• Iteration 2:

Model Code

Val MSE: 4.23 (Val loss per

dim; tumor_volume:

8.47, chemo:

8.95e-14)

...

[LLM Critic Response] To enhance model accuracy:

• Reduce the complexity of the MLP to improve general-

ization, as a complex structure hasn't consistently lowered

validation losses.

• Reassess the chemotherapy and radiotherapy interaction

term to better represent their combined effects, considering

non-linear interactions if necessary.

• Evaluate each biological term in the white box model for

its impact on validation loss.

Remove or consolidate terms

that do not significantly benefit the model to enhance per-

formance and simplicity.

Please now regenerate the code

[LLM Actor Response]

Model Code

(white and black box

model with logistic growth for tumor volume, Michaelis-

Menten saturation for chemotherapy effect, sigmoid func-

tion for radiotherapy effect, resistance development, and a

simplified black box MLP for residuals)

/cog

Training model on train set...

Trained.

Validation MSE 0.0723.

References

Actor LLM

Generation 20

HDTwin

HDTwin

Generation 2

Generation 1

HDTwin

.

.

.

Dataset

{D

train

,

D

val

}

Validation MSE

4.41

Validation MSE

4.23

Validation MSE

0.0723

System

Requirements

R

User

Eval

Critic LLM

Actor LLM

Actor LLM

Critic LLM

Eval

Eval

8

024

047

019

042

023

, 48(3):567-572, 2015.

Ifac-papersonline

Rosen, R., Von Wichert, G., Lo, G., and Bettenhausen, K. D. About the importance of autonomy and digital twins for the

048

047

043

046

049

052

044

047

048

051

050 051 045 046 049 050 B Extended Related Work

053

048

052

054 1 049 050 051 052 053 054 1 053 054 1 Sequence models. ML approaches frequently address system dynamics as a sequential modeling problem. Initial models like Hidden Markov Models [34] and Kalman filters [35] made simplifying Markovian and linearity assumptions, later extended to nonlinear settings [36, 37]. Subsequent models, including recurrent neural networks [38], along with their advanced variants [39, 40, 41], introduced the capability to model longer-term dependencies. More recent advancements include attention mechanisms [42] and transformer models [43], significantly improving the handling of long-term dependencies in sequence data. Another line of work, Neural Ordinary Differential Equations (NODE) [14, 44, 45], interprets neural network operations as integrations of differential equations to model continuous-time processes. Despite being initially driven by natural language processing applications [47], these methods have found utility in modeling complex systems like weather forecasting [46] and energy systems [48]. Furthermore, sequence models can be used in model-based RL [70].

Physics-inspired models. Beyond purely data-centric approaches, recent efforts have focused on integrating physical laws into neural system models. Physics-informed neural networks [15, 54] embed physical laws, often as partial differential equations, directly into the learning process. Other notable methods include Hamiltonian Neural Networks [55] and Lagrangian Neural Networks [56], which respect the structural principles of physical systems. These methods are primarily concerned with modeling physics-related phenomenon and require relatively precise knowledge about the system being modeled (e.g. specific differential equations or energy conservation principles) and specialized mechanisms to incorporate them. Regardless, they have demonstrated that the integration of known principles can significantly improve extrapolation abilities beyond the range of training data. We are similarly inspired to incorporate prior knowledge. In contrast, our work aims to integrate more general or partial knowledge flexibly into a hybrid model using LLMs within a evolutionary multi-agent framework, while introducing more generalized mechanisms to incorporate loose-form prior knowledge.

, 48(3):567-572, 2015.

001

<latexi sh

1_b

64="+G

mSz7YBd

TND8oK

r9j

E

I

>A

C

H

c

V

L

g

J

M

kn

F

PO

0

yZ

2

U/

u

W

3

qpv

X

f

Q

w

R

5

<latexi sh

1_b

64="yDX

CEpg7

c

O

B

w

f

U

>A

8n

V

LS

M

F

T

W+q

d

IvQ

ZkR

Y

r

G

/

3

9

2

P

z

N

mH

j

Ju

o

5

K

0

<latexi sh

1_b

64="ZAV

T2gn9v

C

L

>

7

c

NS8

J3

W

O

MF+

p

yY

d

GU/

5

Q

u

D

fz

j

o

P

I

0

Discovering closed-form models. Closely aligned with our research are techniques aimed at discovering closed-form mathematical expressions from data. Symbolic regression [10, 71, 72] and methods like Eureqa [50], SINDy [11], and D-CODE [51, 52] have showcased their prowess in discovering physical laws from experimental observations. However, these techniques can struggle in higher-dimensional settings and rely on experts to perform the system decomposition to identify the most relevant variables before feeding this information to the algorithm. Additionally, they also rely on experts to specify the function set and mathematical operations that the algorithm uses to search for symbolic expressions. In contrast, our method autonomously learns both the system decomposition and the functional forms of component dynamics, potentially enhancing scalability and efficiency. Moreover, the incorporation of LLMs facilitates the flexible integration of prior knowledge at various stages of the search process [73, 74]. Furthermore, using LLMs to generate code, prior work has shown LLM multi-agent frameworks' ability to excel at large code-generation tasks [75, 76], which we could expect to apply here to scale up the size of the generated models in future works. Such future work could also explore acquiring features as well [77, 78].

C Benchmark Dataset Environment Details

In the following, we outline the six real-world system dynamics datasets, where each dataset is either a real-world dataset or has been sampled from an accurate simulator designed by human experts.

C.1 Cancer PKPD

Three of our environments that we sample a dataset from are derived from a state-of-the-art biomedical Pharmacokinetic-Pharmacodynamic (PKPD) model of lung cancer tumor growth, used to simulate the combined effects of chemotherapy and radiotherapy in lung cancer [61]-this has been extensively used by other works [62, 63, 64]. Here we use this bio-mathematical lung cancer model to create three variations of lung cancer under the effect of no treatments ( Lung Cancer ), chemotherapy only ( Lung Cancer (with Chemo.) ), and chemotherapy combined with radiotherapy ( Lung Cancer (with Chemo. & Radio.) ); for each model we sample a respective dataset. First, let us detail the general case of Lung Cancer (with Chemo. & Radio.) , which comes from the general model (Cancer PKPD Model), and then detail the variations.

Cancer PKPD Model . This is a state-of-the-art biomedical Pharmacokinetic-Pharmacodynamic (PKPD) model of tumor growth, that simulates the combined effects of chemotherapy and radiotherapy in lung cancer [61] (Equation (2))-this has been extensively used by other works [62, 63, 64]. Specifically, this models the volume of the tumor x ( t ) for days t after the cancer diagnosis-where the outcome is one-dimensional. The model has two binary treatments: (1) radiotherapy u r t and (2) chemotherapy u c t .

Where the parameters K,ρ,β c , α r , β r for each simulated patient are detailed in [61], which are also described in Table 3. Additionally, the chemotherapy drug concentration c ( t ) follows an exponential

decay relationship with a half-life of one day:

where the chemotherapy binary action represents increasing the c ( t ) concentration by 5 . 0 mg / m 3 of Vinblastine given at time t . Whereas the radiotherapy concentration d ( t ) represents 2 . 0 Gy fractions of radiotherapy given at timestep t , where Gy is the Gray ionizing radiation dose.

Time-dependent confounding. We introduce time-varying confounding into the data generation process. This is accomplished by characterizing the allocation of chemotherapy and radiotherapy as Bernoulli random variables. The associated probabilities, p c and p r , are determined by the tumor diameter as follows:

where D max = 13 cm represents the largest tumor diameter, θ c = θ r = D max / 2 and ¯ D ( t ) signifies the mean tumor diameter. The parameters γ c and γ r manage the extent of time-varying confounding. We use γ c = γ r = 2 .

Sampling datasets. Using the above Cancer PKPD model, we sample N = 1 , 000 trajectories, which equates to N = 10 , 000 patients, where we sample their initial tumor volumes from a uniform distribution x (0) ∼ U (0 , 1149) , and use the Cancer PKPD Equation (2) along with the action policy of Equation (4) to forward simulate patient trajectories for 60 days, using a Euler stepwise solver. This forms one dataset sample. We repeat this process with independent random seeds to generate D train , D val , D test . Specifically for each benchmark method run for random seed, we re-sample the datasets. For each variation described above, we either include the chemotherapy dosing action, chemotherapy and radiotherapy dosing action or neither. We further outline this dataset's system description and variable descriptions with the following prompt template as given in Appendix E.4.

C.2 COVID-19

We use the accurate and complex epidemic agent-based simulator of COVASIM [65] to simulate COVID-19 epidemics. This is an advanced simulator that is capable of simulating non-pharmaceutical interventions (such as lockdowns through social distancing, and school closures) and pharmaceutical interventions (such as vaccinations). As this is an agent-based simulator, each agent is an individual in a population, and they can be in one of the following states minimally, of being susceptible to COVID-19, exposed, infectious or recovered (which includes deaths). We use the simulator with the default parameters set by the open source implementation of the simulator 5 . COVASIM runs a simulation for a population of individuals. To ensure an accurate simulation, we simulate 24 countries collecting trajectories for each, wherein each simulation we use a population size of 1 , 000 , 000 individuals, and simulate each individual separately (disabling simulation rescaling) and start with a random number of individuals who are infected with COVID-19, I (0) = U (10 , 000 , 100 , 000) , and forward simulate the simulation for 60 days. We repeat this process with independent random seeds to generate D train , D val , D test . Specifically for each benchmark method run for random seed, we re-sample the datasets. We further outline this dataset's system description and variable descriptions with the following prompt template as given in Appendix E.4.

C.3 Plankton Microcosm

This describes an ecological model of a microcosm of algae, flagellate, and rotifer populations, thus replicating an experimental three-species prey-predator system [66]. We use the dataset made available by [79] 6 . The dataset consists of a single trajectory of 102 time steps, and we use a train, val, test split of 70%, 15% and 15%, ensuring the splits are along the time dimension to maintain the integrity of temporal causality, following their chronological order. We further outline this dataset's system description and variable descriptions with the following prompt template as given in Appendix E.4.

C.4 Hare-Lynx

This describes a real-world dataset of hare and lynx populations, replicating predator-prey dynamics [67]. We use the dataset made available by [79]. The dataset consists of a single trajectory of 92 time steps, and we use a train, val, test split of 70%, 15% and 15%, ensuring the splits are along the time dimension to maintain the integrity of temporal causality, following their chronological order. We further outline this dataset's system description and variable descriptions with the following prompt template as given in Appendix E.4.

D Benchmark Method Implementation Details

To be competitive we compare against popular black-box models, which, when modeling the dynamics of a system over time, becomes a form of ODE model, that is a neural ODE [14] with action inputs ( DyNODE ) [68]. We also compare against transparent dynamical equations derived from equation discovery methods for ODEs such as Sparse Identification of Nonlinear Dynamics ( SINDy ) [11]. Moreover, we compare against the ablations of our method, of the zero-shot generated HDTwin ( ZeroShot ) and this model with subsequently optimized parameters ( ZeroOptim ).

DyNODE

DyNODE is a black-box neural network-based dynamics model [68], that models the underlying dynamics of a system by incorporating control into the standard neural ordinary differential equation framework [14]. We use a DyNODE model with 3-layer Multilayer Perceptron (MLP), with a hidden dimension of 128 units, with tanh activation functions, and make it competitive by using Xavier weight initialization [80]. To be competitive we use the same objective, optimizer and same hyperparameters for the optimizer that we use in HDTwinGen. That of an Adam optimizer [32], with a learning rate of 0.01, with a batch size of 1,000 and early stopping with a patience of 20, and train it for 2,000 epochs to ensure it converges.

Causal Transformer

Causal Transformer is a state-of-the-art transformer model for estimating counterfactual outcomes [64]. Due to the complexity of the Causal Transformer, incorporating three separate transformer networks, each one for processing covariates, past treatments, and past outcomes, respectivelywhich is unique to estimating counterfactual outcomes in treatment effect settings; we implemented only a single transformer to model the past outcomes, which is applicable to our datasets and task domains. Specifically, this consists of a standard transformer encoder, where the input dataset is normalized to the training dataset. We encode input observed dimension of the state-action into an embedding vector dimension of size 250 through a linear layer, followed by the addition of a standard positional encoder [64]; this is then fed into a transformer encoder layer, with a head size of 10, dropout 0.1, and the output of this is then fed into a linear layer to reconstruct the next step ahead state, of size of the state dimension. We train this model using the AdamW [32] optimizer with a learning rate of 0.00005 and a step learning rate scheduler of step size 1.0 and gamma 0.95; we also implement gradient clipping to 0.7, with a batch size of 1,000 and early stopping with a patience of 20, and train it for 2,000 epochs to ensure it converges.

RNN

Recurrent Neural Network [81] is a standard baseline that is widely used in autoregressive time series next step ahead prediction. We implement this where the input dataset is normalized to the training dataset. It consists of a gated recurrent unit RNN taking the state-action dimension in mapping it to a hidden dimension of size 250, with two layers. The output is then fed to a linear layer to convert the hidden dimension back to the state dimension to predict the next step ahead. To be competitive we use the same objective, optimizer and same hyperparameters for the optimizer that we use in HDTwinGen. That of an Adam optimizer [32], with a learning rate of 0.01, with a batch size of 1,000 and early stopping with a patience of 20, and train it for 2,000 epochs to ensure it converges.

SINDy

Sparse Identification of Nonlinear Dynamics (SINDy) [11], is a data-driven framework that aims to discover the governing dynamical system equations directly from time-series data, discovering a white-box closed-form mathematical model. The algorithm works by iteratively performing sparse

regression on a library of candidate functions to identify the sparsest yet most accurate representation of the dynamical system.

In our implementation, we use a polynomial library of order two, which is a feature library of L = { 1 , x 0 , x 1 , x 0 x 1 } . Finite difference approximations are used to compute time derivatives from the input time-series data, of order one. Here the alpha parameter is kept constant at 0.5 across all experiments, and the sparsity threshold is set to 0.02 for all experiments, apart from the COVID-19 dataset where it is set to 1 × 10 -5 .

APHYNITY

APHYNITY [60] is implemented using domain-specific expert models as defined in Appendix H.8 combined with a 3-layer MLP, with the same hyper-parameters as in [60].

GP

Genetic programming (GP) is implemented using the implementation and hyper-parameters from the baseline in [82].

HDTwinGen

See the section Appendix E for the implementation details. Specifically, ZeroShot and ZeroOptim are ablations of our method using the exact same setup, hyperparameters and prompts. Here ZeroShot generates one HDTwin, and does not fit its parameters, thus evaluating the loss of the model output directly from the LLM. Whereas ZeroOptim, repeats ZeroShot with the additional step of optimizing the parameters of the HDTwin that was generated-again using the same training as detailed in Appendix E.2.

E HDTwinGen Implementation Details

Our proposed method follows the framework as described in Section 4. We present pseudocode in Appendix E.1, how the code-generated HDTwins are trained in Appendix E.2, prompt templates in Appendix E.3, system requirements prompts in Appendix E.4 for each dataset, and we provide examples of training runs in Appendix J. Specifically, we find a top-K, where K = 16 is sufficient. Additionally, we use the LLM of GPT4-1106-Preview, with a temperature of 0.7.

E.1 HDTwin pseudocode

Algorithm 1 Pseudocode for Hybrid Digital Twin Generator Framework 1: Input: modeling context S context ; training dataset D train , validation dataset D val, maximum generations G , top K programs to consider, R 2: Output: Best fitting hybrid model f θ,ω ( θ ) ∗ . 3: P ← ∅ , H ←∅ 4: for g = 1 to G do 5: f θ,ω ( θ ) ∼ LLM model ( H, P ( g ) , S context ) {Generate HDTwin from modeling agent} 6: ω ( θ ) ∗ = arg min ω ( θ ) ∈ Ω( θ ) L ( f θ,ω ( θ ) , D train ) {Fit the model} 7: Compute validation loss per component and overall δ, υ 8: P ( g +1) ←P ( g ) ⊕ ( f θ,ω ( θ ) ∗ , δ, υ ) {Add HDTwin to the set of top-K HDTwins} 9: H ∼ LLM eval ( R , P ( g ) ) {Generate self-reflection on how to improve the HDTwin.} 10: end for 11: Return: f θ,ω ( θ ) ∗ {The best fitting model that scored the lowest validation loss}

E.2 Training HDTwins

Once the modeling agent has generated an HDTwin f θ,ω ( θ ) , it generates it as code. Specifically, it outputs code for a PyTorch [31] neural network module, where this code string is executed, and the module is then trained on the training dataset. The agent importantly observes a code skeleton within its system requirements context S context , of which examples of such a skeleton are given in Appendix E.4. However we stipulate that the skeleton must be a 'torch.nn.Module', be called

'StateDifferential', and the parameters must be initialized, and it must define a forward function for computing the state differential of the state, where the state and action for that system are input variables to the function. The LLM is instructed to not to modify the code skeleton, only complete it, and return it. This makes it straightforward to process this from text, execute the module, and then train the model.

Specifically, we train the model on the training dataset, using the standard MSE loss Equation (5), optimizing using the Adam optimizer [32]. We use the same optimizer hyperparameters as the black-box neural network method, that of a learning rate of 0.01, with a batch size of 1,000 and early stopping with a patience of 20, and train it for 2,000 epochs to ensure it converges, to ensure fair comparison.

Once the model is trained, we compute the val MSE and val MSE per component, which corresponds to the val loss per state output dimension Equation (6). Notably, when we append the trained HDTwin back into P g we include a string representation of it, which includes the values of any named parameters that were initialized in the model. We observe that feeding in the previous optimized parameters helps the LLM in subsequent generations to suggest good starting initial values for the named parameters, from which they can be further refined with the optimization step.

E.3 HDTwinGen Prompt Templates

In the following we detail the prompt templates used. We always use the system prompt when interacting with the LLM.

System prompt

Defined function schema prompt

Modeling agent first task prompt

E.4 HDTwinGen System Requirements Prompts

By following our proposed system requirements format, we constructed prompts for each of the datasets that we evaluated against, which are listed in the following.

Lung Cancer (with Chemo. & Radio.)

F Model Optimization Losses

We consider the optimization loss of mean squared error on a dataset D and also consider a higher fidelity mean squared error loss per component.

MSE Loss. Specifically, we optimize the following mean squared error objective,

where N × T is the total number of state-action pairs in the dataset. For a given model find the parameters θ ∗ that minimize this loss, i.e. θ ∗ = arg min θ L ( θ, D train ) . Here we optimize θ by stochastic gradient descent, using the Adam optimizer [32], however, we note other optimization algorithms could also be used such as black box optimizers.

MSE Loss per component. We seek to collect detailed quantitative statistics on how well the generated trained system model performs. Therefore, we collect the validation loss per component. Here, we use ( j ) to indicate the predictions for the j th component.

and collect these scalar validation losses per component into a vector ω = [ ω 1 , ω 2 , . . . , ω m ] , and compute its mean as v = 1 m ∑ m j =1 ω j ( θ ∗ , D val ) i.e. the validation loss.

G Evaluation Metrics

We employ mean squared error (MSE) to evaluate the benchmark methods on a held-out test dataset of state-action trajectories, denoted as D test , using the loss defined in Equation (5) and report this as T MSE . Each metric is averaged over ten runs with different random seeds, and we present these

averages along with their 95% mean confidence intervals 7 . For each random seed run, we generate a new train, validation and test dataset independently, when we have access to a simulator. Additionally, when sampling a dataset from a simulator, we collect datasets of the same number of trajectories for the validation and test set as was used to generate the training set. We then train each baseline on the training dataset and use the validation dataset for early stopping when the method supports this. We then evaluate the performance of each baseline on the test dataset. We repeat this process for each random seed run. We perform all experiments and training using a single Intel Core i9-12900K CPU @3.20GHz, 64GB RAM with an Nvidia RTX3090 GPU 24GB.

H Additional Results

H.1 Out-of-distribution Experiment and Setup

To explore the out-of-distribution shifts, we adapt the Lung Cancer (with Chemo. & Radio.) simulator to have a training dataset of tumor volumes in a range that is outside of the tumor volume range within the test set over all trajectories. To do this we sampled a training dataset, with starting state tumor volumes sampled from x ∼ U (0 , 574) and then collected 1 , 000 trajectories for 60 time steps. We then sampled a test dataset out of distribution from that seen in training, with a starting initial state of x ∼ U (804 , 1149) . To ensure that the test state-action states are completely out of the training distribution we slowed down the time interval of the simulator to that of per hour, rather than day, i.e., simulating at ∆ t = 1 24 rather than ∆ t = 1 day resolution. We then also verified that the range of cancer volumes seen within the test set do not overlap at all with those in the training set, especially throughout and at the end of the trajectory.

H.2 COVID-19 Unobserved Intervention Experiment and Setup

To assess whether HDTwinGen can understand and modify its HDTwin, we setup an experiment to see if the modeling agent can adapt an already optimized and best-discovered HDTwin for an unobserved intervention, that is a change of the true system state function dynamics, that are latent.

We constructed a scenario with our COVID-19 simulator, to have a realistic intervention of a lockdown policy, which reduces the physical distance of individuals to one another. In COV ASIM we implemented this, where this happens at day 19, dramatically altering how the COVASIM simulator behaves after the intervention is applied. This is known to reduce the effective contact rate β parameter in an SEIR model [83], for the intervention this approximately corresponds to the β parameter reducing its value by 75% after the lockdown intervention is applied. Importantly we now sampled a training dataset, and validation dataset from the simulator for before the intervention was applied, and only sampled a test dataset after the intervention was applied.

We took the best-found trained HDTwin model for COVID-19, itself created a HDTwin model that is an SEIR model with black-box residual components, as seen in Appendix I. The agent then was specifically instructed to attempt to adapt this HDTwin model to this unobserved intervention, that was purely described in words. The LLM was able to reason about it, and similarly decreased the HDTwin models internal β parameter by approximately 70%, leading to un-observed modelling of such an intervention, when rolling out from the current state, from day 19. This shows the utility of such a hybrid DT framework. Interestingly, the competing methods, such as the black-box method, DyNODE and SINDy incorrectly continue the expected trajectory as they are unaware that the underlying system has been intervened on, and its behavior is now different from what they have learnt to optimize to.

H.3 HDTwinGen top-1 decreases over time

We observe in Figure 6, that averaged over 10 random seed runs, the top-K, specifically the top-K HDTwin found at each iteration step decreases, implying on average the HDTwin improves in the iteration loop in the beginning stages.

0.0

Top 1

Top 3 Mean

7.5

10.0

12.5

Number of Generations

0.0

2.5

5.0

7.5

10.0

12.5

15.0

17.5

Number of Generations

0

5

10

15

Validation MSE

Top 1

Top 3 Mean

H.4 HDTwinGen Evolution

Here we list out the specific HDTwins that have been generated at generation steps and are labeled in Figure 3.

2.5

5.0

15.0

17.5

Iteration 5. Val loss: 0.1756206750869751 Description: White and black box model with dynamic carrying capacity and decay rate, enhanced interaction term, and an expanded black box MLP for residuals.

H.5 HDTwinGen Ablation No Memory

Ablation Study . We also ablate HDTwin by removing its memory, only keeping the last hybrid model it generated. We observe decreased performance as shown in Table 4.

±

H.6 Evaluating Different LLMs

We performed a complete re-run of our main experiments under the same settings, now using a different LLM within our HDTwinGen framework, GPT-3.5. These new results are included in Table 5. HDTwinGen can operate fully with a less capable LLM model. However, the generated and discovered models' performance correlates to the underlying LLM model's performance as expected.

Table 5: Ablation of using different LLMs. Test MSE ( T MSE ) averaged over ten random seeds. HDTwinGen is capable of using other LLM models, however, the best performance results are provided with better-performing LLMs (e.g. GPT-4). The results are presented with ± indicating 95 % confidence intervals.

±

±

±

±

±

±

We also explored the effect of changing the LLMs underlying temperature hyperparameter, here using GPT-4, varying the temperature from 0, 0.7 to 2.0, where we used 0.7 throughout all our experiments (Appendix E). As outlined in Table 6, we observe that HDTwinGen is still able to operate with a different underlying temperature of the LLM.

H.7 Prompt Ablations with Varying Amounts of Prior Information

We conducted a complete re-run of our main experiments, ablating the prompt, which provides the prior information in the form of a textual prior to HDTwinGen. We provide the ablation results in Table 7. Specifically the prompt as outlined in Appendix E is structured to include separately a

±

±

±

±

±

±

{system description} , {skeleton code} , and {useful to know} components. Here, prior information is conveyed through the {system description} , which describes the system to be modeled, its features, and their ranges; minor system prior information is also conveyed through the {skeleton code} , as this includes task-specific feature names as input variables. The other components of the prompt (e.g. {useful to know} ), do not include any task-specific information, and are there to provide general instructions to make the framework work, such as generate a pytorch model as code in the response.

We ablate these components of the prompt, first by removing the task-specific prior {system description} labeled HDTwinGen (Partial Context) ; second, by removing all taskspecific priors removing both {system description} and {skeleton code} (where we change the feature names to meaningless names such as x1, x2, etc.) labeled HDTwinGen (No Context) ; third, by removing only the {useful to know} information that helps the framework, such as instructions to decompose the system, and or combine white-box models with black-box models for the white-box model residuals, labeled HDTwinGen (No Instructions) . We observe in the tabulated results (Table 7) that HDTwinGen can still operate without any task-specific prior information, however having textual prior aids in generating better-performing models, and partially removing HDTwinGen operation instructions, makes it generate slightly less good models.

±

H.8 Domain-Specific Baselines

We performed a complete re-run of our main datasets using domain-specific white-box baselines, as determined by a human expert, as shown in Table 8. Specifically, for COVID-19 modeling, we fit a SEIR model [84], a Lotka-Volterra model for predator-prey population dynamics (Hare-Lynx & Plankton Microcosm datasets) [85], and a logistic tumor growth model with chemo. & radio. effects modeling. HDTwinGen still models the system most accurately, achieving the lowest test prediction MSE on the held-out test dataset of state-action trajectories.

SEIR Model for COVID-19 Modeling . The SEIR model is a compartmental model used in epidemiology to simulate how a disease spreads through a population. It divides the population into four compartments: susceptible (S), exposed (E), infectious (I), and recovered (R). The transitions between these compartments are governed by the following differential equations:

±

±

±

±

±

±

±

±

±

±

±

where N is the total population (assumed constant), β is the transmission rate, σ is the rate at which exposed individuals become infectious, and γ is the recovery rate. These parameters are crucial for capturing the dynamics of the disease spread and are estimated from data or literature.

Lotka-Volterra Model for Predator-Prey Dynamics . The Lotka-Volterra model describes the dynamics of biological systems in which two species interact, one as a predator and the other as prey. The model is represented by a set of first-order, non-linear, differential equations:

where x and y represent the prey and predator populations, respectively. The parameters α , β , γ , and δ denote the prey reproduction rate, the predation rate upon the prey, the predator mortality rate, and the rate at which predators increase by consuming prey, respectively.

Lotka-Volterra Triple Species Model . The extended Lotka-Volterra model incorporating a third species involves additional interactions that can represent various ecological relationships such as competition, predation, or mutualism. For the sake of illustration, let's consider a system with two predators and one prey. The model is described by the following set of differential equations:

where: x represents the prey population. y and z represent the two predator populations. α is the natural growth rate of the prey in the absence of predation. β and δ are the predation rates of the first and second predators on the prey, respectively. γ and µ are the natural death rates of the first and second predators, respectively, in the absence of the prey. ϵ and ν are the growth rates of the first and second predators per unit of prey consumed.

Logistic Tumor Growth Model with Treatment Effects . The logistic tumor growth model with chemotherapy and radiotherapy effects incorporates the logistic growth model's capacity to simulate the saturation effect observed in tumor growth, alongside treatment effects. The model can be described as:

where N is the tumor cell population, r is the intrinsic growth rate of the tumor, and K is the carrying capacity of the environment. C ( N ) and R ( N ) represent the effects of chemotherapy and radiotherapy on the tumor cell population, respectively. These treatment functions are often modeled based on dose-response curves and can vary depending on the specific drugs and radiation doses used.

H.9 Procedurally Generated Synthetic Model Benchmark

We performed a complete re-run of our main baselines on a new entirely procedurally generated synthetic model benchmark. Specifically, by procedurally generating synthetic models, this allows us to test how HDTwinGen performs when the LLM has never seen such a model. To create diverse synthetic models, we modified the structure of underlying cancer with chemo and radio models to incorporate non-biological random modifications, which include the use of trigonometric operators and division operators. In the following, we provide the exact changes made and the structure of the underlying equation.

Synthetic 1 (inc. γ sin( ωt ) ) . Here the underlying equation is

Synthetic 2 (inc. -δI ( t ) )

Synthetic 3 (inc. log( K x ( t )+ N ( t ) ) )

Synthetic 4 (inc. ϵ cos( ϕt ) )

Synthetic 5 (inc. θC ( t ) d ( t ) )

We observe in the tabulated results in Table 9 that HDTwinGen can still generate models that perform well.

±

±

±

±

H.10 Interpretability Scale, Performance of only White-Box Models

To investigate questions, of how well do the white-box models that HDTwinGen generates perform, we explore an ablation of HDTwinGen where we constrain the generated models to be white-box only, i.e., a mathematical equation with no black-box neural network components. We tabulate this in Table 10, and observe that even when HDTwinGen is constrained to only generate white-box models ( HDTwinGen (Only White-Box) ) it still performs acceptably, indicating that the white-box generated models are modeling well the underlying system when fitted to the dataset.

±

±

±

H.11 HDTwinGen Flexibly Integrates Expert-in-the-loop Feedback

Experts play an active role in model development in two main ways:

±

±

±

±

Initial prompt. Experts can describe the system, and specify modeling goals and taskspecific requirements through S context (Appendix E).

Direct model feedback. In each iteration of HDTwinGen, the expert can provide direct feedback through H to guide model improvement.

To further demonstrate the flexibility of expert involvement in the modeling process, we supply two additional experiments:

Expert specifies instructions to produce a fully white-box model through S context , which is provided in Appendix H.10.

Expert provides specific feedback on model improvement during the development process through H . We performed this experiment by stopping HDTwinGen during its iterations, providing human expert targeted feedback, and then observing if the subsequent model generated was able to incorporate the feedback by making targeted changes to the underlying model. We confirm that this is the case and provide insight that the underlying LLM is able to interpret the HDTwin code model and selectively change parts. We provide a figure to illustrate this result, as seen in Figure 7.

[Iteration 5]

def __init__(self):

super(StateDifferential, self).__init__()

# Parameters for the tumor growth model

self.alpha

= nn.Parameter(torch.tensor(0.1))  # Tumor growth rate

self.beta

= nn.Parameter(

torch.tensor(0.05)

)  # Tumor death rate due to chemotherapy

self.gamma

= nn.Parameter(

torch.tensor(0.03)

)  # Tumor death rate due to radiotherapy

def forward(

self,

tumor_volume: torch.Tensor,

chemotherapy_drug_concentration: torch.Tensor,

chemotherapy_dosage: torch.Tensor,

radiotherapy_dosage: torch.Tensor,

) -> Tuple[torch.Tensor, torch.Tensor]:

# Tumor volume change rate

d_tumor_volume__dt

= (

self.alpha

* tumor_volume

-

self.beta

* chemotherapy_drug_concentration

* tumor_volume

-

self.gamma

* radiotherapy_dosage

* tumor_volume

)

# Chemotherapy drug concentration change rate

d_chemotherapy_drug_concentration__dt

= (

chemotherapy_dosage

-

chemotherapy_drug_concentration

)  # Assuming a simple model where the drug is administered and then decays

return (d_tumor_volume__dt, d_chemotherapy_drug_concentration__dt)

[Iteration 6]

def __init__(self):

super(StateDifferential, self).__init__()

# Parameters for the tumor growth model

self.r

= nn.Parameter(torch.tensor(0.1))  # Intrinsic growth rate of the tumor

self.K = nn.Parameter(

torch.tensor(1000.0)

)  # Carrying capacity of the tumor environment

self.alpha_C

= nn.Parameter(

torch.tensor(0.05)

)  # Efficacy coefficient for chemotherapy

self.alpha_R

= nn.Parameter(

torch.tensor(0.03)

)  # Efficacy coefficient for radiotherapy

torch.tensor(0.01)

)  # Clearance rate of chemotherapy drug

def forward(

self,

tumor_volume: torch.Tensor,

chemotherapy_drug_concentration: torch.Tensor,

chemotherapy_dosage: torch.Tensor,

radiotherapy_dosage: torch.Tensor,

) -> Tuple[torch.Tensor, torch.Tensor]:

# Tumor volume change rate incorporating logistic growth model with a log term

d_tumor_volume__dt

= (

self.r

* tumor_volume

* (1 - torch.log(tumor_volume / self.K))

-

self.alpha_C

* chemotherapy_drug_concentration

* tumor_volume

-

self.alpha_R

* radiotherapy_dosage

* tumor_volume

)

# Chemotherapy drug concentration change rate considering the administered dosage and natural decay

d_chemotherapy_drug_concentration__dt

= (

chemotherapy_dosage

-

self.beta_C * chemotherapy_drug_concentration

)

return (d_tumor_volume__dt, d_chemotherapy_drug_concentration__dt)

Create a model to predict changes in tumor

volume and chemotherapy drug concentration

in NSCLC patients, using differential

equations that incorporate logistic tumor

growth with a log term, chemotherapy, and

radiotherapy effects, with parameters

estimated from patient data.

Expert Feedback

Validation loss:

4.486

Validation loss:

0.948

H.12 HDTwinGen Accelerates Model Development and Enhances Performance

We seek to determine the runtimes of HDTwinGen model development compared to human-clock time from a human experiment (Mechanical Turk) experiment where participants are asked to refine models and how performant these models are compared to Bayesian optimization (BO) for a fixed model budget. To assess this we performed the additional experiments of:

Human-driven model development: Hiring two experienced software engineers (Mechanical Turks) to develop and refine models, providing them with exactly the same prompts that HDTwinGen uses, using a human instead of the LLM in the model development loop.

AutoML: Hyperparameter tuning (HPT) using for DyNODE and SINDy using BO (HPT search space detailed in Table 11).

We performed these two experiments on the Lung Cancer (with Chemo. & Radio.) dataset, and the results are tabulated in Table 12. Here we present, the time to generate an individual model (which includes generating the model and training time); the test MSE T MSE after one hour of run-time, and test MSE separately for a budget of only 15 model evaluations.

Analyzing the results provides the following insights:

HDTwinGen Makes Model Development Notably Faster Compared to Human-Clock Time: HDTwinGen takes an average of 45.56 minutes to complete an experiment using 15

10

-

1

model evaluations/generations, whereas human experts took 148.1 minutes (2 hours and 28 minutes) to generate and iterate 15 models. Therefore, using HDTwinGen is considerably faster than human-clock time, which is also an advantage of HDTwinGen. 2 4 6 8 10 12 Number of Generations

HDTwinGen Generates Better Performing Models for a Fixed Model Budget: HDTwinGen generates better-performing models compared to the human experts and the Bayesian hyperparameter optimization (HPO) of the baselines of DyNode and SINDy, for a fixed budget of 15 model evaluations. We provide a figure showing the best-performing model performance against each generation in a Figure 8. This figure shows that across model evaluations, HDTwinGen still generates models that perform well.

2

4

6

8

10

12

14

10

-

1

10 0

10 1

10 2

Test MSE

NSDT

Human Experts

HPO for DyNode

HPO for SINDy

Number of Generations

NSDT

Human Experts

BO DyNode

BO SINDy

14

I Hybrid Model Output Examples

These are the final discovered hybrid models generated from our method HDTwin, for each respective environment.

Cancer (with Chemo & Radio)

(

COVID-19

Plankton Microcosm

Hare-Lynx

J HDTwinGen can reason about HDTwins

Worked log output of HDTwinGen of part of a run, running on the Plankton Microcosm dataset. It can reason about structures and parameters.

NeurIPS Paper Checklist

1. Claims

Question: Do the main claims made in the abstract and introduction accurately reflect the paper's contributions and scope?

Answer: [Yes]

Justification: The abstract and introduction clearly state the main claims, which are backed up by empirical evidence.

Guidelines:

The answer NA means that the abstract and introduction do not include the claims made in the paper.

The abstract and/or introduction should clearly state the claims made, including the contributions made in the paper and important assumptions and limitations. A No or NA answer to this question will not be perceived well by the reviewers.

The claims made should match theoretical and experimental results, and reflect how much the results can be expected to generalize to other settings.

It is fine to include aspirational goals as motivation as long as it is clear that these goals are not attained by the paper.

2. Limitations

Question: Does the paper discuss the limitations of the work performed by the authors?

Answer: [Yes]

Justification: The main limitations of the work are discussed in Section 8, including the assumption of semantic priors and types of system studied.

Guidelines:

The answer NA means that the paper has no limitation while the answer No means that the paper has limitations, but those are not discussed in the paper.

The authors are encouraged to create a separate "Limitations" section in their paper.

The paper should point out any strong assumptions and how robust the results are to violations of these assumptions (e.g., independence assumptions, noiseless settings, model well-specification, asymptotic approximations only holding locally). The authors should reflect on how these assumptions might be violated in practice and what the implications would be.

The authors should reflect on the scope of the claims made, e.g., if the approach was only tested on a few datasets or with a few runs. In general, empirical results often depend on implicit assumptions, which should be articulated.

The authors should reflect on the factors that influence the performance of the approach. For example, a facial recognition algorithm may perform poorly when image resolution is low or images are taken in low lighting. Or a speech-to-text system might not be used reliably to provide closed captions for online lectures because it fails to handle technical jargon.

The authors should discuss the computational efficiency of the proposed algorithms and how they scale with dataset size.

If applicable, the authors should discuss possible limitations of their approach to address problems of privacy and fairness.

While the authors might fear that complete honesty about limitations might be used by reviewers as grounds for rejection, a worse outcome might be that reviewers discover limitations that aren't acknowledged in the paper. The authors should use their best judgment and recognize that individual actions in favor of transparency play an important role in developing norms that preserve the integrity of the community. Reviewers will be specifically instructed to not penalize honesty concerning limitations.

3. Theory Assumptions and Proofs

Question: For each theoretical result, does the paper provide the full set of assumptions and a complete (and correct) proof?

Answer: [NA]

Justification: This paper does not introduce any theoretical results.

Guidelines:

The answer NA means that the paper does not include theoretical results.

All the theorems, formulas, and proofs in the paper should be numbered and crossreferenced.

All assumptions should be clearly stated or referenced in the statement of any theorems.

The proofs can either appear in the main paper or the supplemental material, but if they appear in the supplemental material, the authors are encouraged to provide a short proof sketch to provide intuition.

Inversely, any informal proof provided in the core of the paper should be complemented by formal proofs provided in appendix or supplemental material.

Theorems and Lemmas that the proof relies upon should be properly referenced.

4. Experimental Result Reproducibility

Question: Does the paper fully disclose all the information needed to reproduce the main experimental results of the paper to the extent that it affects the main claims and/or conclusions of the paper (regardless of whether the code and data are provided or not)?

Answer: [Yes]

Justification: In Section 6 and Appendices C to G, we thoroughly outline the experimental procedure. This, combined with the released code, will enable all results in the paper to be reproduced.

Guidelines:

The answer NA means that the paper does not include experiments.

If the paper includes experiments, a No answer to this question will not be perceived well by the reviewers: Making the paper reproducible is important, regardless of whether the code and data are provided or not.

If the contribution is a dataset and/or model, the authors should describe the steps taken to make their results reproducible or verifiable.

Depending on the contribution, reproducibility can be accomplished in various ways. For example, if the contribution is a novel architecture, describing the architecture fully might suffice, or if the contribution is a specific model and empirical evaluation, it may be necessary to either make it possible for others to replicate the model with the same dataset, or provide access to the model. In general. releasing code and data is often one good way to accomplish this, but reproducibility can also be provided via detailed instructions for how to replicate the results, access to a hosted model (e.g., in the case of a large language model), releasing of a model checkpoint, or other means that are appropriate to the research performed.

While NeurIPS does not require releasing code, the conference does require all submissions to provide some reasonable avenue for reproducibility, which may depend on the nature of the contribution. For example

(a) If the contribution is primarily a new algorithm, the paper should make it clear how to reproduce that algorithm.

(c) If the contribution is a new model (e.g., a large language model), then there should either be a way to access this model for reproducing the results or a way to reproduce the model (e.g., with an open-source dataset or instructions for how to construct the dataset).

(b) If the contribution is primarily a new model architecture, the paper should describe the architecture clearly and fully.

(d) We recognize that reproducibility may be tricky in some cases, in which case authors are welcome to describe the particular way they provide for reproducibility. In the case of closed-source models, it may be that access to the model is limited in some way (e.g., to registered users), but it should be possible for other researchers to have some path to reproducing or verifying the results.

5. Open access to data and code

Question: Does the paper provide open access to the data and code, with sufficient instructions to faithfully reproduce the main experimental results, as described in supplemental material?

Answer: [Yes]

Justification: We provide code at https://github.com/samholt/HDTwinGen . Additionally, the datasets and preprocessing procedure are described in Appendix C.

Guidelines:

The answer NA means that paper does not include experiments requiring code.

Please see the NeurIPS code and data submission guidelines ( https://nips.cc/ public/guides/CodeSubmissionPolicy ) for more details.

While we encourage the release of code and data, we understand that this might not be possible, so 'No' is an acceptable answer. Papers cannot be rejected simply for not including code, unless this is central to the contribution (e.g., for a new open-source benchmark).

The instructions should contain the exact command and environment needed to run to reproduce the results. See the NeurIPS code and data submission guidelines ( https: //nips.cc/public/guides/CodeSubmissionPolicy ) for more details.

The authors should provide instructions on data access and preparation, including how to access the raw data, preprocessed data, intermediate data, and generated data, etc.

The authors should provide scripts to reproduce all experimental results for the new proposed method and baselines. If only a subset of experiments are reproducible, they should state which ones are omitted from the script and why.

At submission time, to preserve anonymity, the authors should release anonymized versions (if applicable).

Providing as much information as possible in supplemental material (appended to the paper) is recommended, but including URLs to data and code is permitted.

6. Experimental Setting/Details

Question: Does the paper specify all the training and test details (e.g., data splits, hyperparameters, how they were chosen, type of optimizer, etc.) necessary to understand the results?

Answer: [Yes]

Justification: Appendices C to G details all training and test details, including data splits and hyperparameter tuning procedures for all baselines.

Guidelines:

The answer NA means that the paper does not include experiments.

The experimental setting should be presented in the core of the paper to a level of detail that is necessary to appreciate the results and make sense of them.

The full details can be provided either with the code, in appendix, or as supplemental material.

7. Experiment Statistical Significance

Question: Does the paper report error bars suitably and correctly defined or other appropriate information about the statistical significance of the experiments?

Answer: [Yes]

Justification: We report results over 10 seeded runs for all methods, reporting mean and 95% confidence interval of results.

Guidelines:

The answer NA means that the paper does not include experiments.

The authors should answer "Yes" if the results are accompanied by error bars, confidence intervals, or statistical significance tests, at least for the experiments that support the main claims of the paper.

The factors of variability that the error bars are capturing should be clearly stated (for example, train/test split, initialization, random drawing of some parameter, or overall run with given experimental conditions).

The method for calculating the error bars should be explained (closed form formula, call to a library function, bootstrap, etc.)

The assumptions made should be given (e.g., Normally distributed errors).

It should be clear whether the error bar is the standard deviation or the standard error of the mean.

It is OK to report 1-sigma error bars, but one should state it. The authors should preferably report a 2-sigma error bar than state that they have a 96% CI, if the hypothesis of Normality of errors is not verified.

For asymmetric distributions, the authors should be careful not to show in tables or figures symmetric error bars that would yield results that are out of range (e.g. negative error rates).

If error bars are reported in tables or plots, The authors should explain in the text how they were calculated and reference the corresponding figures or tables in the text.

8. Experiments Compute Resources

Question: For each experiment, does the paper provide sufficient information on the computer resources (type of compute workers, memory, time of execution) needed to reproduce the experiments?

Answer: [Yes]

Justification: In Appendix G, we report all computer resources required to reproduce the results.

Guidelines:

The answer NA means that the paper does not include experiments.

The paper should indicate the type of compute workers CPU or GPU, internal cluster, or cloud provider, including relevant memory and storage.

The paper should provide the amount of compute required for each of the individual experimental runs as well as estimate the total compute.

The paper should disclose whether the full research project required more compute than the experiments reported in the paper (e.g., preliminary or failed experiments that didn't make it into the paper).

9. Code Of Ethics

Question: Does the research conducted in the paper conform, in every respect, with the NeurIPS Code of Ethics https://neurips.cc/public/EthicsGuidelines ?

Answer: [Yes]

Justification: The authors have read the Code of Ethics and confirm that the paper conforms to the code.

Guidelines:

The answer NA means that the authors have not reviewed the NeurIPS Code of Ethics.

If the authors answer No, they should explain the special circumstances that require a deviation from the Code of Ethics.

The authors should make sure to preserve anonymity (e.g., if there is a special consideration due to laws or regulations in their jurisdiction).

10. Broader Impacts

Question: Does the paper discuss both potential positive societal impacts and negative societal impacts of the work performed?

Answer: [Yes]

Justification: Section 8 discusses the societal impacts of the work.

Guidelines:

The answer NA means that there is no societal impact of the work performed.

If the authors answer NA or No, they should explain why their work has no societal impact or why the paper does not address societal impact.

Examples of negative societal impacts include potential malicious or unintended uses (e.g., disinformation, generating fake profiles, surveillance), fairness considerations (e.g., deployment of technologies that could make decisions that unfairly impact specific groups), privacy considerations, and security considerations.

The conference expects that many papers will be foundational research and not tied to particular applications, let alone deployments. However, if there is a direct path to any negative applications, the authors should point it out. For example, it is legitimate to point out that an improvement in the quality of generative models could be used to generate deepfakes for disinformation. On the other hand, it is not needed to point out that a generic algorithm for optimizing neural networks could enable people to train models that generate Deepfakes faster.

The authors should consider possible harms that could arise when the technology is being used as intended and functioning correctly, harms that could arise when the technology is being used as intended but gives incorrect results, and harms following from (intentional or unintentional) misuse of the technology.

If there are negative societal impacts, the authors could also discuss possible mitigation strategies (e.g., gated release of models, providing defenses in addition to attacks, mechanisms for monitoring misuse, mechanisms to monitor how a system learns from feedback over time, improving the efficiency and accessibility of ML).

11. Safeguards

Question: Does the paper describe safeguards that have been put in place for responsible release of data or models that have a high risk for misuse (e.g., pretrained language models, image generators, or scraped datasets)?

Answer: [NA]

Justification: This paper does not release any pretrained models or collated datasets that might pose a risk to misuse.

Guidelines:

The answer NA means that the paper poses no such risks.

Released models that have a high risk for misuse or dual-use should be released with necessary safeguards to allow for controlled use of the model, for example by requiring that users adhere to usage guidelines or restrictions to access the model or implementing safety filters.

Datasets that have been scraped from the Internet could pose safety risks. The authors should describe how they avoided releasing unsafe images.

We recognize that providing effective safeguards is challenging, and many papers do not require this, but we encourage authors to take this into account and make a best faith effort.

12. Licenses for existing assets

Question: Are the creators or original owners of assets (e.g., code, data, models), used in the paper, properly credited and are the license and terms of use explicitly mentioned and properly respected?

Answer: [Yes]

Justification: The paper cites original owners of all code (for baselines) and datasets used in the paper.

Guidelines:

The answer NA means that the paper does not use existing assets.

The authors should cite the original paper that produced the code package or dataset.

The authors should state which version of the asset is used and, if possible, include a URL.

The name of the license (e.g., CC-BY 4.0) should be included for each asset.

For scraped data from a particular source (e.g., website), the copyright and terms of service of that source should be provided.

If assets are released, the license, copyright information, and terms of use in the package should be provided. For popular datasets, paperswithcode.com/datasets has curated licenses for some datasets. Their licensing guide can help determine the license of a dataset.

For existing datasets that are re-packaged, both the original license and the license of the derived asset (if it has changed) should be provided.

If this information is not available online, the authors are encouraged to reach out to the asset's creators.

13. New Assets

Question: Are new assets introduced in the paper well documented and is the documentation provided alongside the assets?

Answer: [NA]

Justification: This paper does not release any new assets.

Guidelines:

The answer NA means that the paper does not release new assets.

Researchers should communicate the details of the dataset/code/model as part of their submissions via structured templates. This includes details about training, license, limitations, etc.

The paper should discuss whether and how consent was obtained from people whose asset is used.

At submission time, remember to anonymize your assets (if applicable). You can either create an anonymized URL or include an anonymized zip file.

14. Crowdsourcing and Research with Human Subjects

Question: For crowdsourcing experiments and research with human subjects, does the paper include the full text of instructions given to participants and screenshots, if applicable, as well as details about compensation (if any)?

Answer: [NA]

Justification: This work does not involve crowdsourcing or research with human subjects.

Guidelines:

The answer NA means that the paper does not involve crowdsourcing nor research with human subjects.

Including this information in the supplemental material is fine, but if the main contribution of the paper involves human subjects, then as much detail as possible should be included in the main paper.

According to the NeurIPS Code of Ethics, workers involved in data collection, curation, or other labor should be paid at least the minimum wage in the country of the data collector.

15. Institutional Review Board (IRB) Approvals or Equivalent for Research with Human Subjects

Question: Does the paper describe potential risks incurred by study participants, whether such risks were disclosed to the subjects, and whether Institutional Review Board (IRB) approvals (or an equivalent approval/review based on the requirements of your country or institution) were obtained?

Answer: [NA]

Justification: This paper does not involve crowdsourcing or research with human subjects. Guidelines:

The answer NA means that the paper does not involve crowdsourcing nor research with human subjects.

Depending on the country in which research is conducted, IRB approval (or equivalent) may be required for any human subjects research. If you obtained IRB approval, you should clearly state this in the paper.

We recognize that the procedures for this may vary significantly between institutions and locations, and we expect authors to adhere to the NeurIPS Code of Ethics and the guidelines for their institution.

For initial submissions, do not include any information that would break anonymity (if applicable), such as the institution conducting the review.

Peer reviews:
{"IS_META_REVIEW": false, "comments": "SUMMARY:\nThe paper presents a neurosymbolic approach to model dynamical systems based on the usage of LLMs and gradient-based optimization. The model perform competitively against the reported baselines. \n\nFirstly, the human modeller is required to define the problem, priors and target metrics in text. Then the first LLM generates python models that are optimized with SGD, subsequently a second LLM distill the results and pass it onto the first LLM which generates a new set of candidate models to be trained again. \n\nPerformance is reported on synthetic data from different models. Proposed model outperform the reported baselines.\n\nSTRENGTHS:\n- The model allows to integrate domain knowledge by using LLM\n\n- The proposed model outperform reported baselines.\n\n- Paper is very well written.\n\n- Annex incorporate comprehensive information about the experiments.\n\nWEAKNESSES:\n- It is unclear whether the computational budget of the baselines (in terms of $\\mathcal{L}(f_{\\theta, \\omega}(o), D_{\\text{train}})$ evaluations) is similar to that of the proposed method. \n\n\n- No code is provided.\n\n- The work relies on a closed-sourced model (GPT-4) whose performance also depends on the specific checkpoints used.\n\nQUESTIONS:\n- Line 55-56: since the work is only shown in the additive case, I suggest you mention this case here also as only showing compositional case results a bit confusing.\n\n- Line 137-139: I find it confusing stating that the outer loss measures generalization. As far as I understand, the outer loss is responsible for model specification, whether this values captures generalization will the depend on whether it's evaluated on the validation dataset, not due to the fact that it is the outer loss.\n\n- I'm unsure whether all the baselines are synthetic data or only some of them. Could you please clarify this?\n\n- In terms of parameter size, how big are the found models $f_{\\theta, w(\\theta)}$ and how big are the baselines models? Both for the algebraic and neural part.\n\n- Line 188: doesn't $P^{(g)}$ contain $w(\\theta)$? If not, could you elaborate on why?\n\n- Why are two LLMs needed? Couldn't a single one do both steps? Have you tried this?\n\n- Suggestion: It'd be interesting to see how the algebraic expression evolve over time during training.\n\nLIMITATIONS:\n- The model adds a substantial amount of complexity with respect to alternative modelling approaches like the reported baseline transformers. It's unclear that the performance improvements makes it up for the added complexity of the method. \n\n- Approach is evaluated against simulated data. If one of the benefit of the approach is that it can handle small datasets, and generalize well, why not using a real dataset rather than synthetic data? This way benchmarks against SoTA on those benchmark would be standardized and therefor more meaningful that self-reported baselines. E.g. reported results for SINDy are using polynomials of order 2, this choice is not justified in the paper. Or, transformers perform similarly to paper's approach (within standard error), and it is not possible to know whether the choice of training hyper-parameters.\n\n- Like other symbolic approaches, the paper's approach still requires a human to provide modelling priors to the system, hence the claim of line 79 \"a new approach to automatically learn digital twins\" is a bit weaken.\n\n- Besides, Table 10, the explainability potential of the model remains under-investigated.", "TITLE": "Official Review", "RECOMMENDATION": 8, "REVIEWER_CONFIDENCE": 4, "SOUNDNESS_CORRECTNESS": 3, "DATE": "2024-07-10"}

{"IS_META_REVIEW": false, "comments": "SUMMARY:\nThis paper presents a LLM-powered evolutionary multi-agent algorithm to automate the composition of hybrid digital twins of dynamical systems. Experiments were conducted on several datasets including variants of PKPD model synthesized data, simulated covid-19 data, simulated plankton miscrocosm data, and a real-data of hare and lynx populations. Results versus existing neural ODE, SINDy, RNN, and Transformer demonstrated favorable performance especially in terms of generalizability, sample efficiency, and evolvability of the hybrid model.\n\nSTRENGTHS:\nHybrid models are gaining increasing importance for combining white- and black-box modeling. LLM-driven systems for automating hybrid model design, composition, and optimization are critical for enabling the practical adoption of these complex models. The proposed work is thus highly novel and of high potential impact. \n\nThe experimental evaluation considered several interesting datasets and targeted on several important desiderate of hybrid models.\n\nWEAKNESSES:\nWhile focused on hybrid models, the writing of the paper is missing important related works in recent hybrid models, such as physics-integrated VAE and APHYNITY, in both discussion of related works, and experimentation. \n\nIn experiments, the baselines of the works are primarily black-box models (NODE, RNN, Transformers). As the focus of the paper is the automated optimization of hybrid models, it’d be important to 1) include existing hybrid-models as baselines, and 2) demonstrate the benefits of automated design of these hybrid models (vs. the current approach for optimizing these hybrid models where both the white- and black-box components are predefined and only their parameters optimized). \n\nThe writing of the paper overall is high-level lacking necessary details for properly understanding and assessing the paper, potentially due to the complexity of the method. For instance, methodologically, it was not clear what is the search space of the hybrid model, for either the white-box or the black-box components; experimentally, it was not clear what the hybrid model is trained to do, what is the rough design of the hybrid components, and the MSE metric is being evaluated on what. \n\nThe performance improvements reported (e.g., Table 1) overall seems to be associated with very large standard deviation (in most cases are larger than the mean). Its gain over transformer based approaches is thus not clear given this large fluctuation and the increased complexity of the method.\n\nMost of the experimental data seem to be low in dimension (at each time frame). Please clarify.\n\nQUESTIONS:\nIt’d be helpful for the authors to clarify the relation of the presented work with existing hybrid models, and how it can benefit with the optimization of these hybrid models.\n\nIt’d be helpful if the authors could add details about the search space of the hybrid models, both in the general methodological settings and in each experimental dataset. \n\nFor each experimental dataset considered, it’d be helpful for the authors to add details about the design of the hybrid model (what white box components, what black box components, what search space, to generate what output for what task).\n\n\nClarification on the “spatial” dimension of the experimental datasets would be appreciated.\n\nLIMITATIONS:\nThe authors provided adequate discussion about the limitation and future work for the presented work.", "TITLE": "Official Review", "RECOMMENDATION": 6, "REVIEWER_CONFIDENCE": 4, "SOUNDNESS_CORRECTNESS": 3, "DATE": "2024-07-12"}

{"IS_META_REVIEW": false, "comments": "SUMMARY:\nThis paper describes a method to improve digital twins (DTs) with an evolutionary and human driven dynamics, aided by an LLM. The process is meant to optimize hybrid models with both human-driven and computer search-based optimization.The empirical study uses six datasets from the medicine domain. Suitable baselines and ablation tests are also shown. The authors show that a hybrid approach could lead to superior performance with respect to traditional approaches.\n\nSTRENGTHS:\nI have identified the following strengths: \n- The paper addresses an important problem with DT: the need for continuous optimization in front of unseen condition to main the fidelity and effectiveness of DT\n- The method suggests that significant autonomy in the optimization could be achieved by means of an evolutionary process, while still retaining the valuable contribution of human domain knowledge for the setting of the initial parameters and context. \n- The approach is general and could be applied to a variety of problem domains.\n- The approach combines LLMs with optimization techniques such as evolutionary search, producing an advanced algorithm with high potential in the successful use and deployment of DT. \n- The paper provide significant details for reproducibility in the Appendix.\n\nWEAKNESSES:\n1. I don't think that having two agents: a modelling and an evaluation agent makes the system a \"multi-agent\" system. I find it confusing. While this is not technically a weakness, I feel that this system should not be considered a multi-agent system. \n2. As the authors also state evolutionary computation could be computationally expensive and hide several levels of complexity, e.g., how thorough should the fitness evaluation be, how many individuals in a population and how many generations, what kind of mutation is applied and what intensity. I feel that all such aspects are not well described in the main paper despite the evolutionary part of the algorithm is a fundamental part of the algorithm. \n3. Following-up from the previous point, more discussion on the computational complexity of the algorithm in the main paper could be beneficial. \n4. The paper could improve the clarity in relation to which domains, or rather, which domain characteristics are more suitable to the proposed algorithm. It is likely that the algorithm might not perform equally well in different domains\n5. Despite a fair review of existing related methods in section 5, the paper does not state too clearly what are the core novelty aspects that are being introduced with respect to the state of the art: I can infer part of them by carefully examining the cited papers, but it would be better if the authors could highlight the main novelty in a more technical way with specific references to the most similar papers from the literature.\n\nQUESTIONS:\nIn section 4, the paragraph Evolutionary Optimization overview: is it possible to provide more details in relation to the computational time and various aspects as per my point 2 above (weakness) in relation to the evolutionary search? \n\nIn the limitations below, I have two questions that can be answered.\n\nLIMITATIONS:\nThe limitations section highlights relying on human input, the knowledge of the LLM,  and the limitation to continuous time systems. However, I feel that the following other limitations should be considered: \n- how can we guarantee that the LLMs, regardless of its knowledge, can provide correct information? Is there a way to test or assess the performance of the LLM? \n- The variability and stochasticity of the evolutionary search could imply that the algorithm might not be consistent across multiple runs. Can the authors speculate on how to measure variability and uncertainty introduced by the evolutionary search?  \n\nBoth points and questions above are particular relevant in critical domains and scenarios such as the medical scenarios used for demonstration in the paper. \n\nI think a discussion on the implications and ethical aspects of using LLMs, human domain knowledge and evolutionary search all in combination for a wide range of domain, e.g. medical domain, is necessary.", "TITLE": "Official Review", "RECOMMENDATION": 7, "REVIEWER_CONFIDENCE": 3, "SOUNDNESS_CORRECTNESS": 2, "DATE": "2024-07-12"}

{"IS_META_REVIEW": false, "comments": "SUMMARY:\nAn evolutionary search framework for building hybrid dynamics models, especially for so-called digital twins, is proposed. Its notable feature is the use of LLMs for the model proposal and model evaluation in the search. The effectiveness of the method is validated with multiple datasets.\n\nSTRENGTHS:\n- Learning hybrid digital twins is indeed an important research topic.\n\n- The idea of using LLM for the model proposal and evaluation in architecture search is interesting.\n\n- The experimental analysis is done carefully.\n\nWEAKNESSES:\nOnly a major concern is that in the experiment, methods with (evolutionary or whatever) search but without LLMs are not used. As the use of LLMs in the search is the most notable feature of the method, the experiments should analyze such an aspect particularly. The current baseline methods are okay but do not fit this purpose because they are not based on any search algorithms.\n\nA minor thing. Although the paper nicely overviews some of the relevant studies, it seems to lack a series of studies on hybrid modeling in a part of the ML community, for example:\n\n- Yuan Yin, Vincent Le Guen, Jérémie Dona, Emmanuel de Bézenac, Ibrahim Ayed, Nicolas Thome, and Patrick Gallinari. Augmenting physical models with deep networks for complex dynamics forecasting. Journal of Statistical Mechanics: Theory and Experiment, 2021(12):124012, 2021.\n- Naoya Takeishi and Alexandros Kalousis. Physics-integrated variational autoencoders for robust and interpretable generative modeling. Advances in Neural Information Processing Systems 34, pp.14809–14821, 2021.\n- Zhaozhi Qian, William. R. Zame, Lucas. M. Fleuren, Paul Elbers, and Mihaela van der Schaar. Integrating expert ODEs into neural ODEs: Pharmacology and disease progression. Advances in Neural Information Processing Systems 34, pp. 11364–11383, 2021.\n- Antoine Wehenkel, Jens Behrmann, Hsiang Hsu, Guillermo Sapiro, Gilles Louppe, and Jörn-Henrik Jacobsen. Robust hybrid learning with expert augmentation. Transactions on Machine Learning Research, 2023.\n\nQUESTIONS:\nAs noted in the weaknesses section, the lack of baselines using non-LLM search (e.g., a mere evolutionary search) limits the significance of the experimental results. Could you please elaborate on why the authors did not include such baselines? Or, if the current results already imply something in this direction, it would be helpful if the authors could clarify.\n\nLIMITATIONS:\nLimitations clearly discussed.", "TITLE": "Official Review", "RECOMMENDATION": 6, "REVIEWER_CONFIDENCE": 3, "SOUNDNESS_CORRECTNESS": 2, "DATE": "2024-07-13"}