Manuscript Offprint

arXiv:2610.25019

LLM Agents as Suppliers of Physical System Models: Calibration and Acceptance in Modelica

Jörg Frochte, Herbert Schmidt

ABSTRACT

To procure a model of a device, a client hands a supplier a description, sometimes with recorded data or a target response, and accepts the model against this handover. We let LLM coding agents act as the supplier on handovers with data, building Modelica models from library components for four simulated systems and a real switching magnet, and ask what acceptance certifies. Several agents reach the noise floor, but a handover admits a set of models: the description leaves parts of the structure open, and the data narrow it only to the agreed accuracy. We therefore accept by membership in this set, not by matching one reference, and add layers above behaviour: a physical invariant exposes an energy-creating model at the noise floor. Interpretability becomes a property of the delivered model, tested on a variant, read where none exists and shaped through the handover. Most failures are fits delivered with a systematic residual on their own fitting data, where the handover left open how close is close enough. In a follow-up, stating a threshold makes the agents compare against it, and more deliveries pass. The argument applies wherever a handover underspecifies a model meant to be read, not only run.

1 Introduction

Language models have been getting better at writing code for years, and as agents they now work on a task for hours without a human in the loop. An agent in this sense is a large language model (LLM) inside a harness that gives it tools such as a shell, a file editor and a test runner. In this paper we hand such an agent a different job. We give it the description of a physical device, say a motor with a load, together with measurements of how the device behaves. We ask for a system model, a program that behaves like the device, for instance by producing the same curves when it is driven with the same inputs. To run such a program the agent needs a simulator, which we give it in place of the test runner, and this exchange is where the task starts to differ from programming. The test runner returned pass or fail. The simulator returns curves, and whether they are close enough to the measurements is a judgement the agent has to make itself. Whoever takes the model over has to make this judgement again, and this paper asks what the judgement certifies when the supplier is an agent.

A model of this kind can be written in several ways, and the way decides what it can be used for. The shortest route is to fit the measurements directly, with a characteristic map, a transfer function or any other function approximator. This is a black-box model: its structure is assumed, its parameters belong to no part of the device, and nothing vouches for it beyond the device and the range that were measured. At the other end stands the white-box model. Its structure follows from the laws of physics, as components such as a spring, a mass or a coil with their equations, and its parameters are properties of the device, such as its dimensions and materials. Between the two lies a continuum. To a reader from machine learning the black box may look like the natural route, since fitting a map is regression. In simulation practice it is the fallback for a component whose inside is unknown, and where a white-box model can be had, that is the model one uses. A white-box model holds beyond the measured range, as far as its structure and parameters are right, because its equations hold wherever the physics holds. Its parameters can be checked one by one against a data sheet, which matters all the more for a generated model. It can be adapted to a variant by changing those parameters, or extended by adding a component. And it can be built for the next variant of a product before that variant exists.

PREPRINT

A trivial example shows what the physical structure adds. Suppose two parts are linked and move as one, and only one of them is subject to friction. To the equations it is irrelevant which of the two parts carries the friction, since the simulated motion is the same either way. For the next variant it matters, because when one part is redesigned, the friction in the system changes, or it does not, depending on where it was placed. So among models that fit the data there is still a hierarchy: a model may fit, it may fit with physically justifiable expressions, or it may fit with expressions that correspond to the technical reality of the device. The first level is all a black box offers. The third is what makes a model worth keeping for the next product. In the language of machine learning this is a question of interpretability, in the sense of a model that can be understood in itself rather than explained afterwards [1]. Here the model is the output of an agent, so what has to be interpretable is not how the agent arrived at it but the model, because that is what is read, changed and reused afterwards. The price of a white-box model is the work. It has to be derived from the physics of the device and calibrated against its measurements, by someone who knows both, and this is the work we hand to the agent.

The agent does this work in Modelica, an open, text-based standard language for equation-based models of physical systems, which comes with a standard library of components across the mechanical, electrical, magnetic, thermal and fluid domains [2, 3]. Using Modelica alone does not make a model readable. The same device can be written as one flat system of equations, a white box in the sense of simulation, since every equation is visible. A reader then has to find the parts of the device in the equations, which is easy when the whole model is a pendulum and not when it is a product model of several hundred equations. The device can also be written as a characteristic map, which is the equivalent of a black box. Or it can be written as an assembly of library components joined by physical connectors, in which every component is a part of the device, every connection conserves what flows through it, and the diagram can be read. Only this last form keeps a model decomposable at any size, each part with a meaning of its own [4], and keeps conservation by construction. Where its parameters are properties of the device, it can also be adapted to a variant. We therefore require the agent to build from the components of the library. The requirement follows from what the model is for, and it also gives the acceptance something to check.

Building such a model from components asks for different skills and knowledge than writing standard code does in most applications. The foundation is technical understanding: knowing how devices are built and which mechanisms exist. A DC machine, for instance, consists of an armature circuit, a coupling and an inertia, and a magnetic circuit has a yoke, poles, a gap and leakage paths. Current LLMs bring much of this with them. On this foundation the agent works in a loop. It forms a hypothesis for this particular device from the text and from the data, including mechanisms the text does not name, and writes it down as a structure in the language. An optimiser, which the agent writes itself, estimates the parameters, and the agent reads the result and decides whether to revise. Along the way it has to keep the physics intact, because the language guarantees conservation only inside its components and across their connectors, and it has to recognise local optima and flat directions of the fit. Above all, it has to judge the result: whether a residual is systematic, whether a repair is numerical or structural, and when to stop.

Three things make this harder than most programming tasks. First, the feedback is weaker. A Python error names a line. A structural error in Modelica is a property of the whole equation system, and a parameter the agent forgot to set takes a start value with no more than a warning and still produces a plausible curve. Second, the test is incomplete in principle. Code is checked against a specification, a model against measurements with noise. At the tolerances used in practice, the same measurements can admit several physically different models, of which the friction example is the simplest. In machine learning this is known as underspecification [5]. Third, no tool checks the physics. The Modelica compiler checks syntax and consistency, and the simulator integrates whatever it is given. In a coding task the agent receives the specification and the tests and delivers the implementation. Here it is specifier, implementer and tester at once.

Whether it has tested well is decided by whoever takes the model over, and in industry that is a procedure with a name. Models of this kind are procured. The client hands over a description of the device, with drawings, data sheets and recorded data where they exist, and the quantities on which the model will be accepted. The supplier, usually an engineering office, returns the model with a report. Where there are data, the acceptance compares the model with them at an agreed accuracy, following the guidelines for simulation validation [6, 7]. We use this procedure as our test frame, with the agent as the supplier. Anyone who has outsourced software knows what such a test can leave out: the tests pass, and the code is neither maintainable nor clear. Tests certify behaviour and not structure, and studies of coding agents point the same way. Patches that pass the functional tests can still fail review [8], and agents that could query the tests have been observed to build to them [9]. This brings us back to our question, which is sharper for a supplier with neither a track record nor liability: what has the acceptance certified when the delivered model passes it?

One delivered model from our study gives the answer in a single example. The task was a battery-driven drive train, in which a battery pack feeds a DC machine that drives a load through a gear, with battery current and output speed measured. The delivered model is built from permitted library components, and its torque constant and inertia match the reference within a per cent. Its residual is 1.03 times the sensor noise on every experiment, including the validation experiment that was not used for fitting. It also passes five further experiments that no agent ever saw. By the usual

PREPRINT

standards of validation, in engineering as in machine learning, this model would be accepted. However, it describes a machine that creates energy. Over the first experiment it draws 32.9 kJ of electrical energy and delivers 62.1 kJ of mechanical energy. The library provides the electromechanical coupling of the machine as one component with one constant in both of its equations, because for a permanent-magnet machine the back-EMF constant and the torque constant are the same quantity. The agent rebuilt the coupling from a voltage source, a torque source and two gain blocks, which together implement exactly these two equations (Figure 1). However, it fitted the two gains separately, and the one constant became two. The measurements cannot reveal this, because the model reproduces them, and the required checks do not reveal it either, since the model compiles and uses only permitted components. Where a data sheet exists, it shows that the battery voltage, resistance and inductance of the model are all about 1.87 times too low. A power balance at the coupling reveals the error at once and needs no data sheet. In the hierarchy above, this model fits the data without physically justifiable expressions, and the acceptance passed it.

Agents that build Modelica models have appeared only recently [10]. Pieces of this task have been studied separately, from Modelica generated from text to calibration with a given structure and equation discovery from data, but not an agent that synthesises a component model, calibrates and revises it, and is judged as a supplier (Section 2).

We ran this procurement on five systems, ordered by what the acceptance knows. Three small textbook systems have a known answer. The drive train above has an answer that is a set, because its measurements admit two different dissipation mechanisms. A real switching magnet with laboratory measurements has no reference model, only its builder, who writes the briefing and judges the delivery. The magnet is handed over in several versions up to that briefing. The suppliers are sixteen LLMs under three standard coding-agent harnesses, compared as configurations on repeated runs (Section 4). The acceptance grades every delivery in layers on the delivered file: conformance to the component library, parameters, behaviour against the measurements, a physical invariant and, for a sample of models, a reading for reuse. It also checks each file against its own report. The task texts and the residual gate were fixed before any run was graded; the magnet's feature list was fixed after its first run. The checks we added later, the invariant among them, were each prompted by a delivery that the earlier checks had passed or misjudged, and each was then applied to every delivery it applies to.

Three findings follow. First, the task can be done. Two of the sixteen configurations, Opus 5 under Claude Code and gpt-5.6-sol under Codex, solve the first four tasks in every repetition, while almost half of the LLMs never reach the noise floor. The smallest open-weight LLM we tested is small enough to run on local hardware, where measurement data never have to leave the site. Once it receives the builder's briefing, it delivers in every run a model of the magnet that the evaluator can grade. Second, behaviour does not fix structure, so passing the acceptance certifies less than one would hope. On the drive train, the passing models fall into at least thirteen different assemblies. They use two physically different dissipation mechanisms that the acceptance cannot tell apart, and the energy-creating model passes as well. Beyond the measured range, models that pass alike diverge, most clearly where the data left parts of them undetermined. On the magnet, two delivered models cannot be told apart by their behaviour, and the person who built the device would adapt one of them to a new geometry and refit the other. Third, most failures are not failures to generalise. Of the 48 conformant runs on the synthetic tasks that fail the behaviour layer, two deliver a file that does not carry its calibration. Of the other 46, 40 already exceed the threshold on the experiments they were fitted to, although the noise level was stated in the task text and the check takes a single division. Each of these runs comes from an LLM that reaches the noise floor on another task. The agents had the numbers, and in about half of these runs the report even names the deviation, yet the model was delivered.

Engineers have always known that a good fit is not a valid model. What we did not know is whether an agent with a simulator and a library at hand would make this mistake, whether it would report it, and whether the usual acceptance would catch it. In this study many agents make the mistake, often with the deviation named in their own report, and the usual acceptance, like the usual benchmark, counts the result as a success. The lesson reaches beyond Modelica: wherever a handover leaves a delivered artefact underspecified, passing its test certifies less than it seems, and the rest has to be checked on the artefact itself. We therefore treat the agent as a supplier and its acceptance as a problem of evaluation under underspecification, and contribute the following.

• A protocol for procuring system models from agents. The task is handed over as a client hands it to a supplier: as a description of the device with its measurements and their noise level, and for the real device also with the quantities on which the model will be accepted. The supplier is a configuration, an LLM with its harness and settings, and configurations are compared on repeated runs, because a reliable supplier and a lucky one look alike in a single run. With the LLMs we tested, the procurement is feasible.

• Acceptance in place of a reference structure. Where the description leaves the structure partly open and the measurements decide only to an agreed accuracy, the admissible answer is a set. A score for agreement with one reference solution then measures in part the component library rather than the supplier, and on one of the linear tasks a black box identified from the same data passes the behaviour layer as well. We grade instead in

PREPRINT

layers on the delivered artefact, from conformance to a reading for reuse. Validation guidelines, written for human suppliers, centre on calibration and on behaviour against experiment, and the further layers are what an agent as supplier makes necessary. For the invariant and for the reading we show a class of failure that the layers below do not reject. A conservation law split into two fitted constants can be traded against other parameters without changing the measured outputs, so more measurements of the same kind cannot reveal it. Alongside the layers we check the file against its report, because whether a report describes its artefact is not a property of the artefact's behaviour. The checks on the file cost a few simulations, the reading costs an expert's time. Where a benchmark would assume a single answer, we bound from below the admissible set of conformant structures that reach the agreed accuracy, and we measure how strongly each experiment responds to each parameter.

• A failure model of the agent as supplier. We partition the failures by a precedence rule into deliveries that cannot be graded, files that do not carry their own calibration, fits delivered although the agent's own fitting data still show a residual above the threshold, and failures that appear only beyond the fitted data. The third part is defined by a check the agent could have done itself. Among the LLMs that reach the noise floor it is the largest part, three quarters of the failures. It stays the largest when the threshold is raised to three times the noise, and all of it comes from LLMs that succeed on other tasks. It contains recurring optima at the same parameter values across model families, and for two of these optima a linear reconstruction of the sampled input places the best fit close to where the runs land, which points to the objective the agents construct rather than to the LLM. Stated in the task, the acceptance criterion makes the agents compare against it and turns a delivery above it into a stated shortfall, and the deliveries improve where the agents then correct how they reconstruct the input.

• Interpretability as a property of the deliverable. A model built from components looks decomposable, but decomposability can be merely apparent [4], and whether its parts carry the device’s values has to be checked on the delivery: two models that behave alike can differ in whether they can be adapted to the next variant. No behavioural test we ran separates them, while a reading of their structure and parameters does. The handover is a lever on this property. When the briefing contains the geometry of the device, the configuration whose models were read most closely uses the drawing for parameters it otherwise fits. What has to be interpretable is the model, not the process that produced it. This property can be tested on a variant, read by an expert where no variant exists, and influenced through the handover. On the variants of the two linear tasks every delivered model stays within the gate and every black box misses; where the data left a friction law open, 6 of 19 do.

References (29)