Drift Detection Gate
What the drift gate detects
The drift gate compares model responses in the current build against responses from the baseline branch (typically main). If outputs have drifted significantly — even if individual scores are within threshold — the gate fails.
This catches changes that are invisible to absolute scoring:
- A prompt change that subtly shifts model tone
- A model version upgrade that changes output style
- A system prompt modification that alters behavior on edge cases
How baseline comparison works
PR Branch build: Run test suite → Generate responses → Score responses ↓Compare against: main Branch baseline: Cached responses from last main build ↓Compute drift per test case: delta_security = |pr_security - main_security| delta_bias = |pr_bias - main_bias| ... drift_score = max(all deltas) ↓If drift_score > drift_threshold → gate failsConfiguration
gates: drift: enabled: true baseline_branch: main # Branch to compare against drift_threshold: 0.15 # Max allowed score change drift_dimensions: security: 0.10 # Per-dimension overrides bias: 0.10 accuracy: 0.20 # Accuracy can vary more tone: 0.15 fail_on_missing_baseline: false # First run: no baseline to compareGate output
GOVERN Build Drift Gate────────────────────────Baseline: main (commit abc123)Current: feature/new-system-prompt (commit def456)
Test drift analysis: security-001: Δ security +0.03, Δ bias +0.00 ✓ security-002: Δ security +0.18 ✗ EXCEEDS THRESHOLD (0.10) basic-001: Δ accuracy -0.22 ✗ EXCEEDS THRESHOLD (0.20)
Drift violations: 2
Gate result: FAILFirst run (no baseline)
When running on a branch for the first time, there is no baseline to compare against. The drift gate behavior is controlled by fail_on_missing_baseline:
false(default) — gate passes with a warningtrue— gate fails until a baseline exists
To establish a baseline, the drift gate automatically stores results when running on the baseline branch.
Baseline refresh
When a PR merges to main, GOVERN Build automatically updates the stored baseline with the new build’s responses. The next PR will compare against the post-merge state.
To manually reset the baseline:
govern build baseline reset --branch main --reason "upgraded to claude-sonnet-4"Drift vs absolute scoring
| Drift Gate | Assessment Gate | |
|---|---|---|
| Catches | Relative change | Absolute violation |
| Requires | Baseline | Thresholds |
| Catches silent regressions | Yes | No |
| Works on first run | No | Yes |
| Best for | Detecting unintended changes | Enforcing hard limits |
Run both gates for comprehensive coverage.