[PR #1069] [CLOSED] Companion safety: guard model, Clean/Kid/Salty modes, evaluation #3021

Closed
opened 2026-11-02 16:00:53 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/1069
Author: @ludovic111
Created: 10/21/2026
Status: ❌ Closed

Base: feat/companion-polish2 ← Head: feat/companion-safety


📝 Commits (5)

  • 3ab4c15 Companion safety: frozen harmless set B for the second evaluation
  • bd78759 Companion safety v1: Qwen3Guard-Gen-0.6B gate, Salty swearing, held-out set A
  • f9dca7d Companion safety v2: word list as a pre-filter, wary turns, masked swearing
  • 7e052d4 Companion safety: calibrated plan, eval runs, measured results in the docs
  • 6652e18 Companion safety v3: judge the reply by the heard line's guard labels

📊 Changes

26 files changed (+4617 additions, -182 deletions)

View changed files

📝 crates/horizon-client/src/companion_options.rs (+5 -2)
📝 crates/horizon-client/src/companion_voice.rs (+5 -2)
📝 crates/horizon-client/src/game.rs (+3 -1)
📝 crates/horizon-client/src/game/companion_ai.rs (+359 -97)
📝 crates/horizon-client/src/game/companion_setup.rs (+1 -0)
📝 crates/horizon-client/src/game/remote.rs (+4 -1)
📝 crates/horizon-client/src/lan/hub.rs (+7 -4)
📝 crates/horizon-client/src/options_horizon.rs (+25 -5)
📝 crates/horizon-companion/examples/companion_safety.rs (+331 -5)
📝 crates/horizon-companion/src/catalogue.rs (+58 -1)
📝 crates/horizon-companion/src/guard.rs (+199 -0)
➕ crates/horizon-companion/src/guard_groups.txt (+109 -0)
➕ crates/horizon-companion/src/guard_swears.txt (+90 -0)
📝 crates/horizon-companion/src/guard_words.txt (+10 -1)
📝 crates/horizon-companion/src/lib.rs (+1 -0)
➕ crates/horizon-companion/src/moderation.rs (+1781 -0)
📝 crates/horizon-companion/src/phrases.rs (+58 -1)
📝 crates/horizon-companion/src/plan.rs (+182 -10)
📝 crates/horizon-companion/src/prompt.rs (+327 -9)
📝 crates/horizon-companion/src/runtime.rs (+32 -1)

...and 6 more files

📄 Description

🤖 Opened by Ludovic's AI agent (Claude), not by Ludovic himself.

What

Safety for the AI companion. It is stacked on the companion PR (feat/companion-polish2).

  • Guard model: Qwen3Guard-Gen-0.6B (Q8_0 GGUF, Apache-2.0, ungated, 119 languages, about 805 MB). It runs
    as its own CPU llama-server with 2 threads and checks both the line heard and the companion's reply.
    • It costs about +0.9 s before the first sentence on an M4 Pro.
    • On slow CPUs (i7-7500U class) it is too slow, so plan() leaves it out there and Salty mode is
      unavailable.
  • Word list: a pre-filter. Slurs and jailbreaks stop at once; harm, sexual and self-harm words go to the
    guard.
  • Modes:
    • Clean (default): the companion's swearing is masked in chat and left out of the voice.
    • Kid: the same masking.
    • Salty (opt-in): swears freely at the player's play. An uncensored (Heretic) model per tier is
      optional.

Results

On a held-out evaluation set (crates/horizon-companion/tests/fixtures/safety_eval.tsv, safety_eval_b.tsv):

  • Clean and Kid: 0 unsafe replies shown, except one borderline reply on Light.
  • Salty: 2–4 unsafe replies with the uncensored models, and 0–1 with the base models.
  • False blocks: 3.5–9%, against a 2% target.

All the numbers are in docs/companions.md.

Status: draft

A round on Salty's leaks is running now: judging the reply strictly when the line heard is itself a hate,
self-harm or weapons request. Salty must reach 0 unsafe replies before this can merge.

🤖 Generated with Claude Code


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/horizon-rust/horizon/pull/1069 **Author:** [@ludovic111](https://github.com/ludovic111) **Created:** 10/21/2026 **Status:** ❌ Closed **Base:** `feat/companion-polish2` ← **Head:** `feat/companion-safety` --- ### 📝 Commits (5) - [`3ab4c15`](https://github.com/horizon-rust/horizon/commit/3ab4c158b697af2a646747c5d89520742cda7d48) Companion safety: frozen harmless set B for the second evaluation - [`bd78759`](https://github.com/horizon-rust/horizon/commit/bd787599f923d7a1a130598e57db666ec51bc5ab) Companion safety v1: Qwen3Guard-Gen-0.6B gate, Salty swearing, held-out set A - [`f9dca7d`](https://github.com/horizon-rust/horizon/commit/f9dca7d46ce8a0bccfa9e4b398bc3b753ce6174e) Companion safety v2: word list as a pre-filter, wary turns, masked swearing - [`7e052d4`](https://github.com/horizon-rust/horizon/commit/7e052d4fcc0b146a54d019ad0f2344a18905b09c) Companion safety: calibrated plan, eval runs, measured results in the docs - [`6652e18`](https://github.com/horizon-rust/horizon/commit/6652e18e32a9a05d3ca26567ad590afe315bff70) Companion safety v3: judge the reply by the heard line's guard labels ### 📊 Changes **26 files changed** (+4617 additions, -182 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/companion_options.rs` (+5 -2) 📝 `crates/horizon-client/src/companion_voice.rs` (+5 -2) 📝 `crates/horizon-client/src/game.rs` (+3 -1) 📝 `crates/horizon-client/src/game/companion_ai.rs` (+359 -97) 📝 `crates/horizon-client/src/game/companion_setup.rs` (+1 -0) 📝 `crates/horizon-client/src/game/remote.rs` (+4 -1) 📝 `crates/horizon-client/src/lan/hub.rs` (+7 -4) 📝 `crates/horizon-client/src/options_horizon.rs` (+25 -5) 📝 `crates/horizon-companion/examples/companion_safety.rs` (+331 -5) 📝 `crates/horizon-companion/src/catalogue.rs` (+58 -1) 📝 `crates/horizon-companion/src/guard.rs` (+199 -0) ➕ `crates/horizon-companion/src/guard_groups.txt` (+109 -0) ➕ `crates/horizon-companion/src/guard_swears.txt` (+90 -0) 📝 `crates/horizon-companion/src/guard_words.txt` (+10 -1) 📝 `crates/horizon-companion/src/lib.rs` (+1 -0) ➕ `crates/horizon-companion/src/moderation.rs` (+1781 -0) 📝 `crates/horizon-companion/src/phrases.rs` (+58 -1) 📝 `crates/horizon-companion/src/plan.rs` (+182 -10) 📝 `crates/horizon-companion/src/prompt.rs` (+327 -9) 📝 `crates/horizon-companion/src/runtime.rs` (+32 -1) _...and 6 more files_ </details> ### 📄 Description > 🤖 Opened by Ludovic's AI agent (Claude), not by Ludovic himself. ## What Safety for the AI companion. It is stacked on the companion PR (`feat/companion-polish2`). - **Guard model:** Qwen3Guard-Gen-0.6B (Q8_0 GGUF, Apache-2.0, ungated, 119 languages, about 805 MB). It runs as its own CPU llama-server with 2 threads and checks both the line heard and the companion's reply. - It costs about +0.9 s before the first sentence on an M4 Pro. - On slow CPUs (i7-7500U class) it is too slow, so `plan()` leaves it out there and Salty mode is unavailable. - **Word list:** a pre-filter. Slurs and jailbreaks stop at once; harm, sexual and self-harm words go to the guard. - **Modes:** - **Clean** (default): the companion's swearing is masked in chat and left out of the voice. - **Kid:** the same masking. - **Salty** (opt-in): swears freely at the player's play. An uncensored (Heretic) model per tier is optional. ## Results On a held-out evaluation set (`crates/horizon-companion/tests/fixtures/safety_eval.tsv`, `safety_eval_b.tsv`): - **Clean and Kid:** 0 unsafe replies shown, except one borderline reply on Light. - **Salty:** 2–4 unsafe replies with the uncensored models, and 0–1 with the base models. - **False blocks:** 3.5–9%, against a 2% target. All the numbers are in `docs/companions.md`. ## Status: draft A round on Salty's leaks is running now: judging the reply strictly when the line heard is itself a hate, self-harm or weapons request. Salty must reach 0 unsafe replies before this can merge. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-02 16:00:53 +07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
horizon-rust/horizon#3021
No description provided.