# OIP-0012: MODEL-OBSERVER profile: model runs, derived and simulated values

| Field | Value |
|---|---|
| Status | DRAFT |
| Functions | `describe` (§5.3), `observe` (§5.5), `qualify` (§5.6), `prove` (§5.11); no new function (the register keeps exactly twelve) |
| Affects | §4.2, §7.1, new §7.3; new schema `model-run`; `registers/conformance-profiles.yaml` (new profile `OBSP-MODEL-OBSERVER`); `registers/functions.yaml` (`qualify` and `prove` objects gain `model-run`); `registers/relations.yaml` (new `EXT-CYCLONEDX`); `conformance/suite.yaml`; the profile enumerations of `conformance-claim`, `conformance-report` and `participant-manifest` (additive); new cases CT-MODEL-001 to CT-MODEL-006 |
| Protocol version | obsp/0.1 |
| Work packages | WP-PR-06 (frontier profiles: model observer) |
| Requires | OIP-0006 (universal observation: `origin`, `observer.class` `MODEL`, `modelRef` on the observation record). Acceptance order: OIP-0006 first, then this proposal. The patches here apply to the current tree on their own and do not depend on OIP-0006's files: the new object is self-contained and reads OIP-0006 fields by name only |
| Last call | 30 days (new profile and object, additive) unless the editors rule otherwise |

## Problem

OIP-0006 lets an observation say that a model produced it (`origin` `MODEL_DERIVED` or `SIMULATED`, `modelRef` to the
model manifest). That names the model, not the run. Nobody can tell from the record:

1. which weights and configuration were loaded, so the value cannot be reproduced or traced to a later model recall;
2. which inputs drove it, at which version and digest, so a correction of an input (§5.9) cannot find the values that
   depend on it, and a forecast driven by a scenario can travel as if it estimated reality;
3. how good the model is for this kind of run, against which reference data and over which period, so skill claims
   cannot be checked or compared;
4. how the uncertainty the value carries was estimated (an ensemble, a posterior, a conformal set, an analytic bound or
   nothing);
5. whether the run executed on the platform that acquired the data (onboard satellite or edge inference) and at which
   processing level the outputs stand.

Weather centres, hydrological services, Earth-observation operators and onboard-processing missions all produce such
values. Labelling rules for content generated by artificial intelligence (for example Regulation (EU) 2024/1689,
Article 50) also ask that generated values be marked in a machine-readable way; the protocol has no such marking beyond
the origin field.

## Change

### Normative text

A new §7.3 "Model observer profile (`OBSP-MODEL-OBSERVER`)" with requirements MOD-1 to MOD-8 in an id table (full text
in `patches/spec.patch`); §4.2 gains the row `ModelRun | model-run | Describe, Observe, Qualify, Prove`; §7.1 gains the
profile row. In short:

1. **MOD-1 (Observe).** A `MODEL_DERIVED` or `SIMULATED` observation record MUST be listed, by UNI and digest, among the
   outputs of a ModelRun whose model is the record's model.
2. **MOD-2 (Describe).** A run MUST name its ModelManifest (UNI and digest), the digest of the weights it loaded (the
   manifest's artifact or rollback digest) and the digest of its configuration; it SHOULD reference its model card and
   its CycloneDX ML-BOM by URI and digest.
3. **MOD-3 (Prove).** A run MUST list every input by UNI, version and digest with its role and origin; an output MUST NOT
   be an input of the same run; the run MUST NOT end before it starts; a compute attestation it references MUST be an
   AttestationResult (RFC 9334).
4. **MOD-4 (Qualify).** A run SHOULD state its skill; each skill entry MUST name its metric, value, reference data (by
   UNI and digest), period and verification method, and MUST NOT be computed against the run's own outputs.
5. **MOD-5 (Qualify).** A run MUST state its uncertainty method (`ENSEMBLE` with member count, `BAYESIAN`, `CONFORMAL`,
   `ANALYTIC`, `NONE`); an output with an uncertainty MUST NOT come from a `NONE` run; an ensemble uncertainty MUST come
   from an ensemble run with the same member count.
6. **MOD-6 (Observe).** Outputs MUST carry the run's output origin (`MODEL_DERIVED` or `SIMULATED`), never stronger than
   the weakest input origin (order `MEASURED`, `NETWORK_DERIVED`, `MODEL_DERIVED` and `DECLARED`, `SIMULATED`) unless a
   method record says why; a `SCENARIO` run MUST produce `SIMULATED` outputs.
7. **MOD-7 (Observe).** A run MUST state whether it ran onboard; an onboard run MUST name the spacecraft, platform or edge
   node that executed it and the processing level of its outputs (`L0` to `L4`, optional sub-level letter).
8. **MOD-8 (Observe).** A participant that forwards, exports or republishes a model-derived or simulated value MUST keep
   its origin and model-run reference.

Labelling: origin and model run together are the protocol's machine-readable marking of model-generated values,
including content generated or manipulated by an artificial intelligence system. The protocol records the marking; it
does not judge whether a participant meets a legal duty such as Regulation (EU) 2024/1689, Article 50. No text of the
regulation is reproduced.

### Contract: `model-run` (schemaVersion `3.1.0`, `$id` `urn:obsp:schema:v3.1:modelrun`)

| Property | Required | Shape |
|---|---|---|
| `schemaVersion`, `apiVersion`, `kind`, `protocolVersion` | yes | `3.1.0`, `obsp/model-run/v3.1`, `ModelRun`, `obsp/0.1` |
| `runUni` | yes | UNI |
| `runKind` | yes | `FORECAST`, `NOWCAST`, `HINDCAST`, `REANALYSIS`, `SCENARIO`, `INFERENCE`, `DOWNSCALING` |
| `modelRef` | yes | `{uni, version?, digest}` of the existing `model-manifest` (its `modelUni` and the digest of the manifest document) |
| `weightsDigest` | yes | digest of the artefact loaded |
| `modelCardRef` | no | `{uri, digest}` |
| `mlBomRef` | no | `{uri, digest, format: CycloneDX, specVersion}` (1.5 or later) |
| `inputs` | yes, at least one | `{uni, version, digest, role, origin, objectKind?}`; role `INITIAL_CONDITION`, `BOUNDARY_CONDITION`, `FORCING`, `OBSERVATION`, `IMAGERY`, `STATIC`, `PARAMETER`; origin in the OIP-0006 vocabulary |
| `configurationDigest` | yes | digest; `configurationRef` `{uri, digest}` optional |
| `referenceTime` | no | RFC 3339 |
| `runStart`, `runEnd` | yes | RFC 3339 with offset |
| `hostUni` | when `onboard` is true | UNI of the node, edge device or spacecraft |
| `computeAttestationRef` | no | `{uni, digest}` of an `attestation-result` |
| `onboard` | yes | boolean; `processingLevel` (`^L[0-4][A-D]?$`) required when true |
| `uncertaintyMethod` | yes | `ENSEMBLE` (with `ensembleMembers` ≥ 2), `BAYESIAN`, `CONFORMAL`, `ANALYTIC`, `NONE`; `uncertaintyMethodRef` optional |
| `skill` | no (SHOULD) | entries `{metric, metricUri?, value, unit?, against: {refs[≥1], description?}, period: {start, end}, method: {uri, digest}}`; metric `RMSE`, `MAE`, `BIAS`, `CORRELATION`, `ACC`, `CRPS`, `BRIER_SCORE`, `ROC_AUC`, `CSI`, `POD`, `FAR`, `F1`, `IOU`, `NSE`, `KGE`, or `OTHER` with `metricUri` |
| `outputOrigin` | yes | `MODEL_DERIVED` or `SIMULATED` (`SIMULATED` for `SCENARIO`); `originMethodRef` optional |
| `outputs` | yes, at least one | `{uni, version?, digest, objectKind?}` |
| `provenanceRef`, `extensions` | no | as elsewhere |
| `operatorUni`, `recordedAt` | yes | participant UNI by role; RFC 3339 |

The observation record is not changed here: the link from an observation to its run is the run's `outputs` list
(MOD-1), resolved by the observation's UNI. A direct `modelRunRef` on the observation is an open question (below).

### Profile

`OBSP-MODEL-OBSERVER` in `registers/conformance-profiles.yaml`: functions `describe`, `observe`, `qualify`, `prove`; it
extends no profile. `conformance/suite.yaml` lists it; the Makefile runs its example set
(`conformance/examples/OBSP-MODEL-OBSERVER/`: model manifest, attestation result, an ML weather forecast run and an
onboard cloud-mask run, and the attestation for the manual case). The profile enumerations of `conformance-claim`,
`conformance-report` and `participant-manifest` gain the id (additive, schemas stay `3.1.0`).

### Invariants (suite module `sdk/python/src/obsp/model_runs.py`, merged into the suite's table; unit tests in `sdk/python/tests/test_model_run.py`)

| Invariant | Rule |
|---|---|
| `model-output-has-run` | a record with OIP-0006 `origin` `MODEL_DERIVED` or `SIMULATED` is an output of a run in the set, and that run's model is the record's `modelRef` (MOD-1); records without `origin` are skipped |
| `model-run-links-manifest` | `modelRef` names a `model-manifest` in the set, its digest is the manifest's RFC 8785 digest, and `weightsDigest` is the manifest's artifact or rollback digest (MOD-2) |
| `model-run-inputs-pinned` | no input twice, no output among the inputs, `runEnd` not before `runStart` (compared as instants), `computeAttestationRef` resolves to an `attestation-result` in the set by UNI and digest (MOD-3) |
| `model-run-skill-referenced` | each skill period ends after it starts; no skill reference is an output of the run (MOD-4) |
| `model-run-uncertainty-method` | an output record with an uncertainty does not come from a `NONE` run; an `ENSEMBLE` uncertainty comes from an `ENSEMBLE` run with the same member count (MOD-5) |
| `model-run-origin-inherited` | `outputOrigin` is not stronger than the origin inherited from the inputs without `originMethodRef`; every output record in the set carries `outputOrigin` (MOD-6) |

### Relation

`EXT-CYCLONEDX` (aligns-with): CycloneDX bill of materials specification, machine-learning BOM (ECMA-424), functions
`describe`, `prove`, schema `model-run`, profile `OBSP-MODEL-OBSERVER`. `implements-edges.json` regenerated (42 edges).

## Compatibility

Additive: a new object, a new profile and three enumerations that gain a value. No existing record changes. MOD-1,
MOD-5 and MOD-6 read the observation-record fields of OIP-0006 (`origin`, `modelRef`, `uncertainty`); until OIP-0006
is accepted the invariants skip records without those fields, so the patches apply and pass on the current tree.

Draft interplay: the invariants and their tests are new files (`obsp/model_runs.py`, `test_model_run.py`) joined to
the suite by three lines placed away from the lines other drafts edit, and the §4.2 row, the `functions.yaml` objects
and the relation row sit where no other draft's patch has context, so OIP-0001, OIP-0005, OIP-0006, OIP-0007 and
OIP-0008 still apply on top of these patches except for one generated line: the `"count"` of
`registers/implements-edges.json`, which OIP-0005, OIP-0006 and OIP-0008 also change. That file is generated
(`python3 tools/build_edges.py`), as is `registers/requirements.yaml` (`python3 tools/requirements.py`); the proposal
accepted second regenerates them. OIP-0013 (MOBILE profile) adds a profile at the same lines (`conformance-profiles.yaml`,
`suite.yaml`, Makefile `PROFILES`, the three profile enumerations, §7.1 and a §7.4 after this §7.3), so whichever of
the two is accepted second is rebased on the first.

## Tests

| Requirement | Case | Kind | Evidence and invariants |
|---|---|---|---|
| MOD-2 | CT-MODEL-001 | invariant | `model-run`, `model-manifest`; `model-run-links-manifest` |
| MOD-1, MOD-6 | CT-MODEL-002 | invariant | `model-run`; `model-output-has-run`, `model-run-origin-inherited` |
| MOD-3 | CT-MODEL-003 | invariant | `model-run`, `attestation-result`; `model-run-inputs-pinned` |
| MOD-4, MOD-5 | CT-MODEL-004 | invariant | `model-run`; `model-run-skill-referenced`, `model-run-uncertainty-method` |
| MOD-7 | CT-MODEL-005 | schema | `model-run` |
| MOD-8 | CT-MODEL-006 | manual | procedure: forward a model-derived value through every path; origin and run reference survive |

Case ids follow `CT-<PROFILE>-NNN` (`obsp.ids.CASE_ID`); `MODEL` is the profile's short id, and the cases live in
`conformance/cases/OBSP-MODEL-OBSERVER/` as the suite requires.

Positive fixtures (the four worked examples): `model-run.valid` (machine-learning weather forecast, 50-member
ensemble, RMSE and CRPS against station verification data), `model-run.flood-model` (hydrological forecast, Bayesian
uncertainty, NSE and KGE against gauge discharge), `model-run.flood-scenario` (design-storm scenario, `SIMULATED`),
`model-run.eo-segmentation` (Earth-observation foundation model segmenting flood water, conformal uncertainty, IoU
against held-out reference polygons), `model-run.onboard-cloud-mask` (onboard satellite cloud mask, processing level
`L2A`).

Negative fixtures, one broken rule each: `missing-inputs`, `input-without-digest`, `input-without-version`,
`input-without-origin`, `missing-configuration-digest`, `missing-weights-digest`, `missing-model-ref`,
`skill-without-reference`, `skill-without-period`, `skill-empty-reference`, `skill-other-without-uri`,
`unknown-uncertainty-method`, `missing-uncertainty-method`, `ensemble-without-members`,
`onboard-without-processing-level`, `onboard-without-host`, `bad-processing-level`, `missing-onboard`,
`output-origin-measured`, `scenario-not-simulated`, `ml-bom-not-cyclonedx`, `ml-bom-without-digest`, `empty-outputs`,
`run-end-not-rfc3339`. Rules the schema cannot express (digests against documents in the set, time order, self-skill,
inheritance, agreement with output records) are proved by 22 unit tests, including one that runs the profile on the
example set (PASS, report valid against `conformance-report`) and one that runs it on a broken copy and sees only
CT-MODEL-004 fail.

## Open questions

1. Should OIP-0006 give the observation record a direct `modelRunRef` (`{uni, digest}`) next to `modelRef`, so a
   record names its run without a set lookup? It is additive on top of OIP-0006 and can be folded into it before
   acceptance; this draft does not touch the observation record so that it stays independent of OIP-0006's files.
2. The inheritance order puts `DECLARED` level with `MODEL_DERIVED` (a declared value is not measured, but a model that
   uses a declared orography does not simulate). Editors to confirm, or rank `DECLARED` with `SIMULATED`.
3. Processing levels `L0` to `L4` with a sub-level letter follow common Earth-observation practice (the data processing
   levels space agencies publish, and product levels such as `L1C` and `L2A`); no source was opened for this draft.
   Should the protocol name one scheme?
4. CycloneDX: machine-learning BOM elements are cited from memory as introduced in specification 1.5, and ECMA-424 as
   the Ecma edition of CycloneDX 1.6; neither was opened. Should SPDX 3.0 AI and dataset profiles be accepted as an
   alternative `format`?
5. The skill metric list is a convenience list, not a standard; `OTHER` with `metricUri` covers the rest. Should the
   list follow a verification vocabulary (for example the WMO verification guidance) instead?
6. MOD-8 is tested by a manual case. Once the exchange APIs of OIP-0001 are accepted, should it become an invariant on
   exported documents?
7. Regulation (EU) 2024/1689, Article 50 is cited by identifier only and was not opened for this draft; the protocol
   makes no compliance statement about it.

Acceptance needs appointed editors and a last-call window. Until then this proposal stays at DRAFT.
