Chapter 4 — Baseline replication and pilot
Lesson map
Lesson 04 published. Map, example, EX021.
flowchart TD
N0["Learning outcomes and connection"]
N1["4.1 Terms"]
N2["4.2 Diagnosing a failed reproduction: TankBench-21"]
N3["4.3 Verifying the simulator"]
N4["4.4 Tuning without leakage: Lab 6"]
N5["4.5 A bounded pilot on Testbed T2"]
N6["Chapter synthesis"]
N0 --> N1 --> N2 --> N3 --> N4 --> N5 --> N6
N6 --> EX["Worked example"]
EX --> Q["Exercise EX021"]
Logical drawing
flowchart LR
N0["Learning outcomes and connection"]
N1["4.1 Terms"]
N2["4.2 Diagnosing a failed reproduction: TankBench-21"]
N3["4.3 Verifying the simulator"]
N4["4.4 Tuning without leakage: Lab 6"]
N5["4.5 A bounded pilot on Testbed T2"]
N6["Chapter synthesis"]
N0 --> N1 --> N2 --> N3 --> N4 --> N5 --> N6 --> Q["EX021"]
[Learning outcomes and connection]
|
v
[4.1 Terms]
|
v
[4.2 Diagnosing a failed reproduction: TankBench-21]
|
v
[4.3 Verifying the simulator]
|
v
[4.4 Tuning without leakage: Lab 6]
|
v
[4.5 A bounded pilot on Testbed T2]
|
v
[Chapter synthesis]
|
v
[Worked example] --> [Exercise EX021]
Learning outcomes and connection
After this chapter you can (1) distinguish reproduction, replication and re-implementation, (2) diagnose why a published OT detection result cannot be reproduced, (3) verify a process simulator before trusting it, (4) design a bounded pilot on an isolated rig, and (5) make a predeclared go/no-go decision. It takes the hypotheses of Chapter 3 and prepares the main study of Chapter 5.
4.1 Terms
The ACM artifact-badging policy distinguishes repeatability (same team, same setup), reproducibility (different team, same artifacts) and replicability (different team, own artifacts). In OT these differ sharply because plants, controllers and datasets are rarely shareable. Fix your vocabulary before claiming any of them.
For the Setpoint Study, rerunning Lab 3 on the same code and seeds is repeatability. A colleague running the archived code is reproducibility. The TankBench-21 work is a re-implementation from the paper's description, closer to replication. Saying so precisely keeps a reviewer from reading a re-scoring as independent confirmation of the original result.
4.2 Diagnosing a failed reproduction: TankBench-21
The synthetic benchmark TankBench-21 reports an F1 of 0.96 for a band-plus-rate alarm. The candidate's re-implementation gets 0.31. A disciplined diagnosis lists hypotheses and tests each: (a) scoring convention — the paper used point adjustment (Lab 1 shows this alone can explain a gap of this size); (b) threshold leakage — thresholds were chosen on the test split; (c) label alignment — attack labels start when the attack script launched, not when the process first deviated; (d) sampling — the paper downsampled to 10 s, smoothing noise. Re-scoring with point adjustment yields 0.94, inside a predeclared tolerance of ±0.05, so the reproduction "succeeds" — but it succeeds in reproducing an inflated metric. The thesis records both numbers and adopts event-level recall plus delay.
4.3 Verifying the simulator
Verification asks whether the model is built right; validation asks whether it is the right model (standard modelling vocabulary). Verification tests for the Lab 3 tank include: equilibrium at 50.0 with nominal inflow (analytical check); mass conservation over 1,000 steps without noise; residual mean near zero under no attack; and seeds producing identical traces on two machines. A detector evaluated on an unverified simulator is evaluated on an unknown system.
Write each verification test as code that fails loudly, and run the suite before every batch of experiments. If the equilibrium check fails after a change to the outflow term, no detector result from that version is usable until it passes. Keep the test output with the run records so an examiner can see that verification preceded the results it supports.
4.4 Tuning without leakage: Lab 6
The CUSUM has two parameters, allowance k and threshold h. Tune them on separate seeds from the evaluation seeds and examine robustness to model error. Lab 6 sweeps k and adds a constant 0.4-unit level-sensor calibration bias — a realistic mismatch between model and instrument.
# Lab 6 (synthetic): CUSUM drift k vs. false alarms and detection delay - the tuning trade-off reviewers ask about.
import random
def first_alarm(seed, attack, k, h=6.0, steps=600, onset=300, bias=0.0):
rng = random.Random(seed); true, est, s = 50.0, 50.0, 0.0
for t in range(steps):
inflow = 1.0 + rng.gauss(0, 0.05) + (0.05 if attack and t >= onset else 0.0)
true += inflow - 0.02*true
lvl = true + rng.gauss(0, 0.3) + bias
if attack and t >= onset: lvl = 50.0 + rng.gauss(0, 0.3) + bias
est += inflow + rng.gauss(0, 0.02) - 0.02*est
s = max(0.0, s + abs(lvl - est) - k)
if s > h: return t
return None
for bias in (0.0, 0.4):
for k in (0.4, 0.6, 0.8, 1.0):
fa = sum(first_alarm(i, False, k, bias=bias) is not None for i in range(100))
d = [a-300 for a in (first_alarm(i, True, k, bias=bias) for i in range(100)) if a is not None and a >= 300]
print(f"bias={bias} k={k} false_alarm_runs={fa}/100 detected={len(d)}/100 mean_delay={sum(d)/len(d) if d else float('nan'):.1f}")
Expected output:
bias=0.0 k=0.4 false_alarm_runs=0/100 detected=100/100 mean_delay=25.6
bias=0.0 k=0.6 false_alarm_runs=0/100 detected=100/100 mean_delay=30.9
bias=0.0 k=0.8 false_alarm_runs=0/100 detected=100/100 mean_delay=38.0
bias=0.0 k=1.0 false_alarm_runs=0/100 detected=100/100 mean_delay=46.1
bias=0.4 k=0.4 false_alarm_runs=97/100 detected=19/100 mean_delay=35.4
bias=0.4 k=0.6 false_alarm_runs=4/100 detected=99/100 mean_delay=46.1
bias=0.4 k=0.8 false_alarm_runs=0/100 detected=100/100 mean_delay=55.6
bias=0.4 k=1.0 false_alarm_runs=0/100 detected=100/100 mean_delay=66.5
With a perfect model the smallest k looks best. A small calibration bias makes k = 0.4 useless: 97 runs alarm before the attack starts, and only 19 alarms land after onset. The defensible choice is k = 0.8, which trades about 7 steps of delay (versus k = 0.6 without bias) for robustness. This is the kind of result reviewers expect to see before the main study.
4.5 A bounded pilot on Testbed T2
The pilot answers feasibility questions only: can the rig run the replay scenario safely, can the historian log at 1 Hz, and does the float valve stop overflow? Pilot data are not used for hypothesis tests. Go/no-go criteria are written in advance: go if three consecutive runs complete with the float valve never reached, log loss below 1%, and no unplanned controller restart; otherwise revise. The pilot plan also records who may stop a run and how (a physical emergency stop that cuts pump power, independent of the PLC).
4.6 Common errors and limits
Calling a re-scoring a replication; trusting a simulator because it "looks right"; tuning on evaluation seeds; using pilot data to test hypotheses; lacking an independent emergency stop.
Each error lets a result look better than it is. A re-scoring with point adjustment only confirms that the original convention was used. A plausible-looking trace is not a passed verification test. Seeds shared between tuning and evaluation leak information. Pilot runs answer feasibility, not hypotheses. And without a physical stop that cuts pump power independently of the PLC, the pilot is not bounded.
Exercises — chapter 4
- EX021 — ACM repeatability terms. Classify three activities (rerunning your own Lab 3, a colleague running your archive, a colleague building their own tank model) under ACM terms. Rubric: 3 = repeatability / reproducibility / replicability correctly assigned; 2 = two correct; 1 = one; 0 = none.
- EX022 — TankBench-21 reproduction log. Write a reproduction log entry for TankBench-21 with the four hypotheses, tests and outcomes. Rubric: 3 = four hypotheses with tests/outcomes including point-adjust→0.94; 2 = hypotheses without outcomes; 1 = partial; 0 = none.
- EX023 — Mass-conservation verification test. Write and run a verification test for mass conservation in the noise-free Lab 3 model. Rubric: 3 = noise-free equilibrium≈50 and inflow−outflow identity check; 2 = equilibrium only; 1 = vague; 0 = none.
- EX024 — Choose k under calibration bias. Using Lab 6, choose k for a plant where calibration bias up to 0.4 is expected and justify it with two numbers. Rubric: 3 = k=0.8 with 0/100 FA vs k=0.6 4/100 FA and delay trade-off; 2 = k choice without both numbers; 1 = k only; 0 = none.
- EX025 — T2 pilot go/no-go criteria. Write go/no-go criteria for a T2 pilot including a safety criterion and a data-quality criterion. Rubric: 3 = safety (float valve), data (<1% loss), restart, e-stop pretest; 2 = missing one; 1 = vague go; 0 = none.
- EX026 — Why reproduced 0.94 is not goodness. Explain why the reproduced 0.94 is not evidence that the TankBench-21 detector is good. Rubric: 3 = point-adjusted score ≠ delay/FA/shift performance + possible test-set tuning; 2 = one reason; 1 = 'too high'; 0 = none.
Chapter synthesis
Reproduce baselines with a predeclared tolerance and diagnose gaps systematically; verify the simulator; tune on separate seeds and stress-test against model error; and pilot only for feasibility with independent physical stop authority.
Continue studying — chapter 04 of 08
← Chapter 03 (draft) · Course chapter index · Chapter 05 (draft) →