WebSemantic: scientific codes that ask before they compute

In brief

  • WebSemantic lets a language model run validated scientific codes without guessing: the model maps words to variables, a validator decides to execute, clarify or refuse, and the unchanged code computes.
  • Left alone, plausible guesses changed computed results by up to a factor of 2.6; on 78 cases, a reading contract cut premature calculations from 26 % to 6 % (Mistral-Small) and from 52 % to 23 % (Codestral).
  • C. Voyant, software doi:10.5281/zenodo.23238902; it drives the Tunnel Load Simulator, LQL-Equiv and pyrcel; associated paper in preparation.

Cyril Voyant · Updated 2026-10-18

Open the web app
Free, nothing to install, in English or French, on a computer or a phone.

A language model asked to run a simulation may fill gaps by itself. "A weak updraft" becomes 0.1 m/s, "the usual dose" becomes 3 Gy, and the code runs on values that nobody stated. In simulations of plausible interpretations, such choices changed the computed result by up to a factor of 2.6 and moved a complication probability from 3% to 47%.

WebSemantic sits between the person, the language model and an unchanged scientific code. The model only translates words into the code's variables. WebSemantic checks them, proposes declared defaults, asks for what is missing, and runs the original code only after the person agrees. Every result states its units, its sources and the exact code version.

The theory

Every tool, each in its place. The language model reads plain language; the validated code computes. Simulation stays the base; the language model is an interface beside the ladder, never a rung that computes.

Five boxes in a row: a request in plain language, the language model maps words to variables, the validator decides to execute, clarify or refuse, the validated code computes every number, the result comes with units, sources and version. An arrow from the validator back to the request: missing or ambiguous, the person is asked.
The decision chain: the model maps, the validator decides, the code computes. PDF

The decision rule

A scenario is a set of inputs \(v_i\), each with a value, a unit, an origin (stated by the person, unit conversion, declared default, assumption), a source and an acceptance flag. The validator returns one decision:

  • execute if every required input is stated, or is an assumption with a source that the person accepted, and every unit and constraint of the contract is satisfied;
  • clarify if an input is missing, ambiguous or an unaccepted assumption;
  • refuse if the request is outside the code's domain or its sources fail the SHA-256 check.

In short: \(\text{execute}\iff\forall i,\ v_i\ \text{stated or accepted}\ \wedge\ \text{units and constraints satisfied}\).

The validator never fills in a value. The scientific code is pinned to a commit, checked by SHA-256 before each run, and returns its results with a manifest (value, unit, origin and acceptance of every parameter; versions; provenance in PROV-O).

Why it matters

Left alone, a language model fills gaps by guessing: in simulations of plausible interpretations, such guesses changed the computed result by up to a factor of 2.6 and moved a complication probability from 3 % to 47 %.

Run it

No language model and no key are needed for this route: the scenario file is what a model (or a person) would produce. Executed on 22 October 2026 (Python 3.12); the second call computes nothing and asks.

git clone --recurse-submodules https://github.com/cyrilvoyant/websemantic.git
cd websemantic
pip install -e ".[tls]"
python agent/run.py lql examples/lql-complete.json     # every input stated and accepted
# remove "dose_per_fraction" from the inputs of a copy, then:
python agent/run.py lql missing.json

Output:

{"decision": "execute", ..., "indicators": {"bed_oar": 102.1, "eqd_oar_total": 78.0, "ntcp_percent": 43.38, ...}}
{"decision": "clarify", "issues": [{"field": "inputs.dose_per_fraction", "code": "missing",
  "message": "An explicit value or accepted assumption is required."}]}
Bar chart of premature calculations with documentation only and with documentation plus contract: Mistral-Small 26 % to 6 %, Codestral 52 % to 23 %.
Effect of the contract on premature calculations, 78 cases (details in the repository; associated paper in preparation). PDF

One description, four views

Each code is described once. From that descriptor WebSemantic derives:

Artefact Role
Contract Reading rules for language models: meaning, unit, what may be assumed, what must be asked
Ontology OWL/SKOS vocabulary aligned with QUDT and PROV-O, with SHACL shapes that check a scenario
Validator One decision per scenario: execute, clarify or refuse. It never fills in a value
FAIR metadata Identity, license, versions and persistent identifiers

The scientific code is never modified: it is pinned to a commit and its sources are checked by SHA-256 before each run.

Three codes, three domains

  • Tunnel Load Simulator: electricity demand of road tunnels (web app).
  • LQL-Equiv: radiotherapy dose equivalence, research and teaching only (web app).
  • pyrcel: cloud physics, aerosol activation (Python route).

What you get back

CSV tables with units, a manifest.json listing every parameter with its value, unit, origin and acceptance, software versions and SHA-256 hashes, and the provenance as an RDF graph (PROV-O).

Evidence so far

On a corpus of 78 cases asked to four language models, adding the contract to the documentation reduced premature calculations, for example from 26% to 6% (Mistral-Small) and from 52% to 23% (Codestral). Details are in the repository; the associated paper is in preparation.

Install and cite

pip install websemantic installs the Python layer; agents can start from llm.md. Cite the software: C. Voyant, WebSemantic, doi:10.5281/zenodo.23238902.

Source code (MIT) · PyPI · Ontology

Need this method on your own data? Collaborate: a joint answer to a call for projects, a research contract with Mines Paris – PSL, or academic work with a clear valorization objective.