Skip to content

The three treatment modalities

🟡 Partial — Code and parameter modalities are built; the prompt modality is planned.

The three treatment modalities are ways to apply ISO 23894 §6.5 (risk treatment) in a versioned AI system. All three close the same red/green loop: the treatment is committed to git, sei run re-measures, and the evidence bundle is re-anchored.


Reference scenario: loan (consumer credit, EU AI Act Annex III §5).

The treatment consists of a modification to the training code that produces a variant of the model (V2) with better fairness metrics than the previous version (V1). The digest of model.pkl in sei.lock changes, activating Drift B (re-measurement without re-triage, provided the purpose does not change).

Treatment flow — code change
# 1. Modify train.py (V2 variant)
git add train.py
git commit -m "fix(loan): reduce disparate impact on gender group (V2)"
# 2. Re-run the pipeline and re-anchor the evidence
sei run
# 3. Verify the risk gate is green
sei status # exit 0

The git log of the bundle (.sei/bundle.json) records the treatment: the commit that turned the fairness control from red to green is visible and attributable.

Status: built and demonstrated in the loan scenario.


Reference scenario: retinopathy (retinal screening, EU AI Act Annex III §6).

The treatment consists of modifying a parameter declared in params.yaml without changing the training code. In retinopathy, params.yaml selects the model variant via use_mitigated: false activates V1 (unmitigated, train.py); true activates V2 (mitigated, train_mitigated.py with class_weight=balanced + threshold=0.30). The DVC pipeline detects the parameter change as an input change and re-runs the evaluate stage.

Treatment flow — parameter adjustment
# 1. Adjust the parameter (selects the mitigated V2 variant)
# params.yaml: use_mitigated: false → true
git add params.yaml
git commit -m "treat(retinopathy): activate V2 (use_mitigated=true)"
# 2. Re-run the pipeline (DVC sees the params change → stage stale → re-eval)
sei run
# 3. Verify
sei status # exit 0 — GREEN gate

This modality demonstrates that the engine is agnostic to the type of change: the treatment loop closes identically whether the change is in code or in a configuration parameter. In retinopathy the arc is real (T0 V1 RED gate model-dr-sensitivity≈0.41 → T1 V2 GREEN gate ≈0.88); both are versioned changes under ISO 23894, the difference is the modality.

Status: built and demonstrated in the retinopathy scenario.


Use case: LLM-based AI system where the treatment consists of modifying the system prompt to reduce a detected demographic bias.

🚧 Planned — The prompt modality (LLM case) is not built in v1; see Status & gaps.

Prompt adjustment is the third treatment modality because in LLM systems the prompt is the artifact that controls model behaviour, analogous to training code in supervised systems. Its management raises specific challenges:

  • Demographic bias detection in text is less stable than in binary classifiers (metrics vary with the prompt used for evaluation).
  • Smaller-scale models (sub-3B parameters) may be insensitive to prompt changes in fairness tasks, making it difficult to demonstrate the treatment empirically.

For these reasons, the prompt modality is deferred to a later version. See Status & gaps for the deferral rationale and future options.


The loop is the same across all three modalities

Section titled “The loop is the same across all three modalities”

Regardless of the modality, the treatment loop follows the same structure:

StepAction
Control in redsei run reports a blocking control outside the threshold
Choose modalityCode change / parameter adjustment / prompt adjustment
Commit the treatmentgit commit documents the change with authorship and date
Re-measuresei run re-runs the pipeline and re-anchors the evidence
Control in greenThe risk gate passes; sei reconstruct classifies the cycle as CLOSED

The detail of the red/green loop is in The red/green loop.