Skip to content

Code Generation

A distinctive feature of this library, compared to other PDE simulation libraries, is its innovative use of AI for automating code generation. This approach significantly enhances user-friendliness, with the end goal of only requiring problem definition from the user.

The first approach that is researched is the following :

  1. The user (or an AI from a user-supplied natural language problem description) provides a conceptual graph describing the numerical scheme (problem definition, numerical method(s), time stepping…)
  2. This conceptual graph is systematically transformed into actual source code, which is then compiled into an optimized executable program for HPC (High-Performance Computing).

This approach allows for great flexibility, while retaining performance as the end result is an executable optimized for only one problem. It avoids the traditional costs incurred by abstraction and polyvalence.

It is yet undecided if the resulting executable will support changing the values of parameters, or if a new compilation will occur. The choice will depend on the potential performance gains procured by statically linking parameter values.

Visual Programming

Code Programming

Natural Language

Preprocessor Macros

Template Generation

LLM Generation

User

Conceptual Numerical Scheme

LLM

Source Code

Compilation

Executable

Simulation Code Generation

Visual Programming

Code Programming

Natural Language

Preprocessor Macros

Template Generation

LLM Generation

User

Conceptual Numerical Scheme

LLM

Source Code

Compilation

Executable

Simulation Code Generation

For the LLM approach, an interesting possibility is repeated prompting with the results of previous compilations. In this way, the numerical scheme could automatically get refined for better convergence and accuracy (element types, solver, preconditioner…), thus replacing the need for traditional human experimentation.

However, the model could still ask (or be given) human feedback. It doesn’t have to be a linear process, there is a lot of room for iterations and interactivity. A chatbot approach would be appropriate, with tool calling and chain of thoughts.

Express scientific/engineer problem

Presents results or ask for decisions

User

LLM

Simulation execution

Interactive Iterative Simulation Generation & Execution

Express scientific/engineer problem

Presents results or ask for decisions

User

LLM

Simulation execution

Interactive Iterative Simulation Generation & Execution

Not investigated yet, probably not flexible enough for complex simulation.