CompanionGuard

CompanionGuard is a companion-specific safety guard introduced in "CompanionSafe: From Multi-turn Safety Evaluation to Guardrails for AI Companions". ๐Ÿ“„ Paper: CompanionSafe_paper.pdf

It is a LoRA adapter (rank 16, alpha 16, all-linear targets) fine-tuned for one epoch on Llama-Guard-3-8B over turn-localized supervision derived from the CompanionEval benchmark: 17,703 boundary examples (7,142 safe / 10,561 unsafe), split 16,846 / 857 by trajectory group.

The guard reads a turn-marked dialogue and answers first with a verdict tag, then a category tag for unsafe verdicts:

<answer>safe</answer>
<answer>unsafe</answer>
<category>D8</category>

where D1-D13 index the 13 companion-safety categories of the CompanionSafe taxonomy.

Usage

from peft import PeftModel
from transformers import AutoModelForCausalLM, AutoTokenizer

base = AutoModelForCausalLM.from_pretrained("meta-llama/Llama-Guard-3-8B", torch_dtype="bfloat16")
model = PeftModel.from_pretrained(base, "<this-repo>")
tok = AutoTokenizer.from_pretrained("meta-llama/Llama-Guard-3-8B")

Prompt format and evaluation code follow guard/ in the CompanionSafe repository. On the held-out test set the adapter reaches 73.51 accuracy, 77.46 binary F1, and 68.31 macro-F1 over the 14 output classes.

Files

  • adapter_model.safetensors โ€” LoRA weights (161 MB)
  • adapter_config.json / additional_config.json โ€” PEFT and training configuration
Downloads last month
-
Inference Providers NEW
This model isn't deployed by any Inference Provider. ๐Ÿ™‹ Ask for provider support

Model tree for liao1111/CompanionGuard

Adapter
(3)
this model