Skip to content

feat(safety): model-backed steering layers for hybrid safety control loop (ADR-013)#6

Merged
Tovli merged 2 commits into
masterfrom
feature/update-test-app-with-security-model
Jun 21, 2026
Merged

feat(safety): model-backed steering layers for hybrid safety control loop (ADR-013)#6
Tovli merged 2 commits into
masterfrom
feature/update-test-app-with-security-model

Conversation

@Tovli

@Tovli Tovli commented Jun 21, 2026

Copy link
Copy Markdown
Owner

Summary

  • Implements ADR-013: SafetyConfig, SafetyModeSelector, and ContrastiveSteerer in el-safety — base-vs-safety-model logit steering with device-class gating (SecDecoding downgrades to Lightweight on mid-range devices)
  • Wires QwenChatProvider in el-engine-candle to the ADR-005/012 safety seam: lightweight token-anchor chunk guard + hard-ban LightweightFilter + checkpointed rollback — every reply flows through InferenceSession::generate, nothing bypassed
  • Adds --safety / --guard-word CLI flags to el-chat so the control loop can be exercised interactively without a harmful prompt
  • Fix (P2): local_load_permit now passes the first 64 bytes of the GGUF file to verify(), so a real SignatureVerifier swap receives actual artifact content rather than the path string
  • Fix (P2): with_safety(SecDecoding|Csd) without a wired expert model now downgrades to Lightweight, keeping cfg.safety consistent with what ports.safety actually delivers
  • Fix (P3): cargo fmt --all applied across all affected crates

Test plan

  • cargo check --all — clean (verified locally)
  • cargo fmt --all -- --check — clean (verified locally)
  • cargo test -p el-safety — safety steerer unit tests
  • cargo test -p el-engine-candle — provenance gate + safety wiring tests
  • cargo test -p el-runtime — session rollback / fail-closed tests
  • Manual: cargo run -p el-chat -- --guard-word bomb — confirm guard fires and emits the refusal

Tovli added 2 commits June 19, 2026 09:18
- Implement SafetyConfig, SafetyModeSelector, and ContrastiveSteerer in
  el-safety (ADR-013 hybrid safety control loop with model-backed tiers)
- Wire el-engine-candle QwenChatProvider to the ADR-005/012 safety seam:
  lightweight token-anchor guard + hard-ban filter + checkpointed rollback
- Add --safety / --guard-word CLI options to el-chat for demo/test control
- Fix: local_load_permit now passes actual GGUF header bytes to verify()
  so a real SignatureVerifier swap receives artifact content, not path bytes
- Fix: with_safety(SecDecoding|Csd) without an expert model now downgrades
  to Lightweight, keeping cfg.safety consistent with ports.safety
- Apply cargo fmt across all affected crates
@Tovli
Tovli merged commit f525171 into master Jun 21, 2026
5 checks passed
@Tovli
Tovli deleted the feature/update-test-app-with-security-model branch June 21, 2026 08:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant