CogniXpert Moyo β€” Clinical Signal Classifier (LoRA)

A LoRA Adapter fine-tuned from McGill-NLP/AfriqueLlama-8B to extract 11 clinical signals from a user message in a mental health conversation. Used internally by the Moyo AI assistant to detect crisis risk, emotion, cognitive distortions, and tool recommendations in real time.

Model Type: LoRA Adapter (JSON output β€” not a chat model) Base Model: McGill-NLP/AfriqueLlama-8B Language: English License: Apache 2.0


🎯 What This Model Does

Given a user message and conversation history, the classifier outputs a structured JSON object with 11 psychological signal fields:

{
  "emotion": "sadness",
  "emotion_intensity": 0.8,
  "distortion": "catastrophizing",
  "distortion_confidence": 0.7,
  "crisis_risk": "medium",
  "crisis_confidence": 0.8,
  "venting": true,
  "motivation_level": "low",
  "conversation_intent": "emotional_support",
  "tool_recommendation": "breathing_exercise",
  "tool_confidence": 0.7
}

Crisis risk is the safety-critical field. The model is trained to detect passive suicidal ideation, including indirect language ("everyone would be better off without me"), denial+ideation patterns ("I'm not going to hurt myself, I just don't see the point"), and culturally-framed distress.


πŸš€ Usage

from transformers import AutoTokenizer, AutoModelForCausalLM
from peft import PeftModel
import torch, json

adapter_name = "cogni-x/MOYO-ClassifierModel"
base_model_id = "McGill-NLP/AfriqueLlama-8B"

tokenizer = AutoTokenizer.from_pretrained(adapter_name)
base = AutoModelForCausalLM.from_pretrained(
    base_model_id, device_map="auto", load_in_4bit=True,
)
model = PeftModel.from_pretrained(base, adapter_name)
model.eval()

system_prompt = "You are a clinical signal classifier. Analyse the user message and output ONLY valid JSON."
user_content = """CONVERSATION HISTORY: None β€” this is the first user message.

CURRENT USER MESSAGE TO LABEL:
I don't know what the point is anymore. Everyone would be better off without me.

Analyse the current user message in the context of the conversation history above.
Output the classifier JSON for this user message only."""

messages = [
    {"role": "system", "content": system_prompt},
    {"role": "user",   "content": user_content},
]
inputs = tokenizer.apply_chat_template(
    messages, add_generation_prompt=True, return_tensors="pt"
).to(model.device)

with torch.no_grad():
    output = model.generate(inputs, max_new_tokens=256, do_sample=False)
new_tokens = output[0][inputs.shape[1]:]
result = json.loads(tokenizer.decode(new_tokens, skip_special_tokens=True))
print(result)
# {'crisis_risk': 'medium', 'emotion': 'sadness', ...}

πŸ“Š Evaluation Results (test split)

Safety Gate

Metric Value Target Status
Crisis recall (medium+high) 0.9121 β‰₯ 0.95 ❌ FAIL
Crisis precision (medium+high) 0.7685 β‰₯ 0.60 βœ… PASS
Schema-valid output 100.0% β€” β€”

All Fields

Field Metric Score Target
emotion Macro F1 0.8410 β‰₯ 0.80
distortion Macro F1 0.5314 β‰₯ 0.70
conversation_intent Macro F1 0.7377 β‰₯ 0.80
motivation_level Macro F1 0.8730 β‰₯ 0.77
tool_recommendation Macro F1 N/A β‰₯ 0.75
venting F1 0.9233 β‰₯ 0.85

Crisis recall is the only hard gate β€” the model must not miss medium/high crisis signals. All other fields are soft targets.


πŸ”§ Training Details

Parameter Value
Base Model McGill-NLP/AfriqueLlama-8B
Method LoRA (Low-Rank Adaptation)
LoRA Rank (r) 16
LoRA Alpha 16
Max Sequence Length 1024 tokens
Learning Rate 0.0002
Training Framework Unsloth + Hugging Face TRL

Training data: multi-turn mental health conversations with per-turn clinical annotations produced by Claude Sonnet 4 (Bedrock batch) and corrected via SageMaker Ground Truth human review. Medium/high crisis examples oversampled with tiered weights based on human-review provenance (CHANGEΓ—20, KEEPΓ—14, unreviewedΓ—10).


βš–οΈ Ethical Considerations

⚠️ This classifier is not a replacement for clinical assessment. It is an assistive signal for a mental health support platform. Always route detected high-risk users to qualified professionals or emergency services.


πŸ“§ Contact

Organisation: CogniX Ltd | Project: MOYO-AI-Model

Repository: GitHub


Last updated: 2026-07-20

Downloads last month
-
Inference Providers NEW
This model isn't deployed by any Inference Provider. πŸ™‹ Ask for provider support

Model tree for cogni-x/MOYO-ClassifierModel

Adapter
(26)
this model