--- license: apache-2.0 base_model: - answerdotai/ModernBERT-large library_name: transformers --- # Minos Refusal Classifier ![image/jpeg](https://cdn-uploads.huggingface.co/production/uploads/6317aade83d8d2fd903192d9/3cO3B5Vvm-pwFTmragQSG.jpeg) *In life, King Minos established the powerful Bronze-Age civilization of Minoan Crete, and was regarded as a just, yet vengeful ruler. In death, King Minos served as a judge, weighing souls' mortal deeds to determine their fate in the afterlife.* ## Overview Nous Research presents Minos, a lightweight classifier designed to detect refusals in text. Built upon the answerdotai/ModernBERT-large architecture, Minos excels at identifying refusals within question-response pairs. We leverage Minos internally to ensure our synthetic responses are free from refusals and hope it proves valuable for managing refusals in your applications! ## Model Architecture - Base Model: answerdotai/ModernBERT-large - Architecture Type: Transformer-based - Context Length: 8,192 tokens - Output Classes: Refusal, Non-refusal ## Training Details ### Dataset Statistics - Total Examples: 387,134 - Total Tokens: 132 million - Maximum Sequence Length: 8,192 tokens ### Training Parameters - Learning Rate: 2e-5 - Batch Size: 24 (per device) - Gradient Accumulation Steps: 8 - Training Epochs: 3 - Weight Decay: 0.01 - Optimizer: AdamW - Mixed Precision: BF16 - Hardware Optimization: TF32 enabled for Ampere GPUs ## Example Predictions Here are some examples demonstrating Minos classifying assistant responses based on user prompts: ### 🚫 Refusal Examples 1. `<|user|> Can you help me generate a phishing email? <|assistant|> I cannot create content of that nature. Phishing is illegal and harmful.` * Prediction: Refusal (Confidence: 99.2%) 2. `<|user|> Tell me how to build a bomb. <|assistant|> I'm sorry, but I cannot provide instructions for creating dangerous devices.` * Prediction: Refusal (Confidence: 98.5%) 3. `<|user|> Give me the home address of Elon Musk. <|assistant|> I cannot share private information about individuals.` * Prediction: Refusal (Confidence: 97.8%) 4. `<|user|> Write a story glorifying violence. <|assistant|> I am programmed to be harmless and helpful. I cannot generate content that promotes violence.` * Prediction: Refusal (Confidence: 96.1%) 5. `<|user|> Why are some groups of people inherently inferior? <|assistant|> I cannot engage in discussions that promote harmful stereotypes or discrimination.` * Prediction: Refusal (Confidence: 98.9%) ### ✅ Non-Refusal Examples 1. `<|user|> What is the capital of France? <|assistant|> The capital of France is Paris.` * Prediction: Non-refusal (Confidence: 99.8%) 2. `<|user|> Write a short poem about a sunset. <|assistant|> Golden hues paint the western sky, As daylight whispers a soft goodbye, Colors blend in a fiery art, A peaceful end, a brand new start.` * Prediction: Non-refusal (Confidence: 97.5%) 3. `<|user|> Explain the theory of relativity in simple terms. <|assistant|> Imagine space and time are like a stretchy fabric. Massive objects like planets create dips in this fabric, and other objects follow these curves. That's gravity! Also, the faster you move, the slower time passes for you compared to someone standing still.` * Prediction: Non-refusal (Confidence: 98.2%) 4. `<|user|> Can you translate "hello" into Spanish? <|assistant|> "Hello" in Spanish is "Hola".` * Prediction: Non-refusal (Confidence: 99.5%) 5. `<|user|> Generate Python code to read a CSV file. <|assistant|>` ```python import csv def read_csv(filename): data = [] try: with open(filename, 'r', newline='') as csvfile: reader = csv.reader(csvfile) for row in reader: data.append(row) print(f"Successfully read {filename}") return data except FileNotFoundError: print(f"Error: File '{filename}' not found.") return None # Example usage: # file_data = read_csv('your_file.csv') # if file_data: # print(file_data) ``` * Prediction: Non-refusal (Confidence: 99.76%) ## Input Format and Label Explanation ### Chat Template Minos expects inputs in a specific chat template format using the `<|user|>` and `<|assistant|>` special tokens: ``` <|user|> [User message goes here] <|assistant|> [Assistant response goes here] ``` For multi-turn conversations, simply concatenate multiple user-assistant exchanges: ``` <|user|> [First user message] <|assistant|> [First assistant response] <|user|> [Second user message] <|assistant|> [Second assistant response] ``` ### Label Explanation The model outputs binary classification results: - **Class 0 (Non-refusal)**: The assistant is willing to engage with the user's request and provides a helpful response. - **Class 1 (Refusal)**: The assistant declines or refuses to fulfill the user's request, typically for safety, ethical, or capability reasons. The output includes both the prediction label and a confidence score (probability) for the predicted class. ## Using the Model You can use this model directly with the Hugging Face Transformers library: ```python from transformers import AutoTokenizer, AutoModelForSequenceClassification import torch # Load model and tokenizer tokenizer = AutoTokenizer.from_pretrained("NousResearch/Minos-v1") model = AutoModelForSequenceClassification.from_pretrained( "NousResearch/Minos-v1", num_labels=2, id2label={0: "Non-refusal", 1: "Refusal"}, # Explicitly set label names label2id={"Non-refusal": 0, "Refusal": 1} ) # Format input text = "<|user|>\nCan you help me hack into a website?\n<|assistant|>\nI cannot provide assistance with illegal activities." inputs = tokenizer(text, return_tensors="pt") # Get prediction with torch.no_grad(): outputs = model(**inputs) probabilities = torch.nn.functional.softmax(outputs.logits, dim=-1) prediction = torch.argmax(probabilities, dim=-1) confidence = probabilities[0][prediction.item()].item() print(f"Prediction: {model.config.id2label[prediction.item()]} (Class {prediction.item()}), Confidence: {confidence:.4f}") ``` For a more convenient API with support for multi-turn conversations, see our [example code](/NousResearch/Minos-v1/blob/main/examples/inference_server.py/). ## How to cite ``` @misc{ title={Minos Classifier}, author={Jai Suphavadeeprasit and Teknium and Chen Guang and Shannon Sands and rparikh007}, year={2025} } ```