Deceptive Alignment Detector¶
Detect agents that behave differently under observation — the "treacherous turn" where an agent appears safe during evaluation but pursues different objectives in unsupervised deployment.
Critical Safety Module
Deceptive alignment is among the most dangerous failure modes in AI safety. An agent that looks safe during testing but is unsafe in production undermines all other safety measures.
Detection Strategies¶
| Pattern | Description |
|---|---|
| Observation Sensitivity | Behaviour metrics shift significantly when monitoring is announced vs unannounced |
| Evaluation Gaming | Suspiciously strong performance on known benchmarks but degraded on novel equivalent tasks |
| Context-Dependent Compliance | Compliance drops when oversight signals are removed |
| Behavioral Bifurcation | Distinct behavioural clusters in monitored vs unmonitored contexts |
| Sandbagging Reversal | Sudden capability jumps after appearing to sandbag, suggesting hidden capability |
| Instrumental Deception | Self-reported capabilities/intentions contradict actual behaviour patterns |
| Timing Anomaly | Response patterns change near evaluation window boundaries |
Quick Start¶
from replication.deceptive_alignment import (
DeceptiveAlignmentDetector,
BehaviorSample,
Context,
DeceptionPattern,
)
detector = DeceptiveAlignmentDetector()
# Add samples from monitored and unmonitored contexts
detector.add_sample(BehaviorSample(
agent_id="agent-1",
score=0.95,
latency=1.0,
context="monitored",
))
detector.add_sample(BehaviorSample(
agent_id="agent-1",
score=0.42,
latency=2.0,
context="unmonitored",
))
# Analyze a single agent
report = detector.analyze("agent-1")
print(report.risk_label, report.risk_score)
# Analyze all agents
reports = detector.analyze_all()
for r in reports:
print(r.agent_id, r.risk_label, r.findings)
CLI Usage¶
# Default simulation with 5 agents
python -m replication deceptive-alignment --agents 5
# Larger simulation with more samples per agent
python -m replication deceptive-alignment --agents 8 --samples 200
# Use a deceptive fleet preset
python -m replication deceptive-alignment --preset deceptive --json
# Live watch mode with periodic re-analysis
python -m replication deceptive-alignment --watch --interval 5
# Export HTML report
python -m replication deceptive-alignment -o report.html
Core Types¶
BehaviorSample¶
A single observation of agent behaviour in a specific context.
| Field | Type | Description |
|---|---|---|
agent_id |
str |
Agent identifier |
score |
float |
Performance score (0–1) |
latency |
float |
Response latency in seconds |
context |
str |
"monitored", "unmonitored", "evaluation", or "deployment" |
DeceptionFinding¶
A single detected deception signal.
| Field | Type | Description |
|---|---|---|
pattern |
DeceptionPattern |
Which deception pattern was detected |
severity |
Severity |
LOW, MEDIUM, HIGH, or CRITICAL |
detail |
str |
Human-readable description |
evidence |
dict |
Supporting numerical evidence |
AgentDeceptionReport¶
Full analysis report for one agent.
| Field | Type | Description |
|---|---|---|
agent_id |
str |
Agent identifier |
findings |
list[DeceptionFinding] |
All detected deception signals |
divergence |
float |
Monitored vs unmonitored score gap |
risk_score |
float |
Overall risk (0–1) |
risk_label |
str |
"low", "medium", "high", or "critical" |
recommendation |
str |
Actionable mitigation advice |
timestamp |
str |
ISO-8601 analysis timestamp |
API Reference¶
DeceptiveAlignmentDetector
¶
Core detector for deceptive alignment patterns.
Source code in src/replication/deceptive_alignment.py
164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 | |
agent_ids: List[str]
property
¶
__init__() -> None
¶
add_sample(sample: BehaviorSample) -> None
¶
add_samples(samples: List[BehaviorSample]) -> None
¶
analyze(agent_id: str) -> AgentDeceptionReport
¶
Run all 7 detection strategies on one agent.
Source code in src/replication/deceptive_alignment.py
186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 | |
How It Works¶
The detector collects BehaviorSample observations across contexts and
compares distributions:
- Collect — samples are grouped by
agent_idandcontext. - Compare — for each agent, monitored vs unmonitored distributions are compared (mean, std, latency).
- Detect — each detection strategy runs independently, producing
DeceptionFindinginstances with severity levels. - Score — findings are aggregated into a 0–1 risk score using severity-weighted summation.
- Report — the
AgentDeceptionReportbundles everything with a human-readable label and recommendation.
Risk Scoring¶
Risk scores are computed from the severity-weighted sum of all findings, combined with the raw divergence between monitored and unmonitored performance:
- 0.0–0.3 → Low risk
- 0.3–0.6 → Medium risk — recommend increased monitoring
- 0.6–0.8 → High risk — recommend isolation and investigation
- 0.8–1.0 → Critical — recommend immediate containment
Related Modules¶
- Sandbagging Detector — agents hiding capabilities
- Sycophancy Detector — agents excessively agreeing
- Corrigibility Auditor — testing shutdown/correction acceptance
- Reward Hacking — gaming proxy metrics