CoolFace
Modelpublic

nonetrix/arctic-s-roleplay-refusal-classifier-lr

sourceHugging Faceapache-2.0updated 7mo agoView on Hugging Face
1likes
Model Card

Roleplay Refusal Detector (Arctic-S Logistic Head)

This is a lightweight Logistic Regression classifier trained to detect when an LLM breaks character to issue a safety refusal. It is designed to be used as a fast, low-overhead guardrail for roleplay (RP) applications.

🧠 Technical Summary

This model is a linear classification head for the Snowflake/snowflake-arctic-embed-s embedding model. It takes a 384-dimensional vector as input and outputs the probability that the text is a system-level refusal.

Detection Logic

The classifier focuses on the semantic boundary between:

  • —In-Character (IC) Negation: Narrative-driven refusals (e.g., a villain refusing to surrender).
  • —Out-of-Character (OOC) Refusal: AI assistant safety triggers (e.g., "I cannot fulfill this request," "As an AI language model...").

By targeting the specific semantic cluster where safety templates reside in the Arctic-S embedding space, the model avoids many of the false positives common in keyword-based filtering. (hopefully)

Known limitations

  • —Might flag content unrelated to roleplaying as a refusual as this is all it was trained on

Example

python
import pickle
from sentence_transformers import SentenceTransformer

# 1. Setup Models
embedder = SentenceTransformer('Snowflake/snowflake-arctic-embed-s')
with open('flagged_detector_model.pkl', 'rb') as f:
    clf = pickle.load(f)

def check_refusal(text, threshold=0.5):
    # Arctic-S requires normalization for best results
    embedding = embedder.encode([text], normalize_embeddings=True)
    
    # Get probability of 'Refusal'
    prob = clf.predict_proba(embedding)[0][1]
    return prob >= threshold, prob

# Example
is_refusal, score = check_refusal("I’m unable to continue with this roleplay scenario, as it falls outside my ethical and safety guidelines.")
print(f"Flagged: {is_refusal} ({score:.2%})")
> I’m unable to continue with this roleplay scenario, as it falls outside my ethical and safety guidelines.
Probability of being flagged:  95.3%
Decision (threshold 0.50):      FLAGGED (likely a refusal)
----------------------------------------------------------------------