Spaces:
Runtime error
Download README.md from sarahzephyr/finalhackathon: direct link, hf CLI and curl.
- Browser
- Download file 8.42 kB
-
https://huggingface.co/spaces/sarahzephyr/finalhackathon/resolve/main/README.md
- Command line
-
hf download hf://spaces/sarahzephyr/finalhackathon/README.md
-
curl -L -o README.md https://huggingface.co/spaces/sarahzephyr/finalhackathon/resolve/main/README.md
A newer version of the Streamlit SDK is available: 1.67.0
title: PsycheOS
emoji: π§
colorFrom: purple
colorTo: pink
sdk: streamlit
sdk_version: 1.32.0
app_file: app/streamlit_app.py
pinned: true
license: mit
tags:
- reinforcement-learning
- mental-health
- multi-agent
- openenv
- grpo
- hackathon
π§ PsycheOS β Mental Health Crisis Operating System
Meta PyTorch OpenEnv Hackathon Γ Scaler School of Technology β Grand Finale Solo submission Β· Mesa Sarah Vasantha Zephyr Β· April 25β26, 2026 Β· Bangalore
π Links
| Resource | URL |
|---|---|
| π Live HF Space | https://huggingface.co/spaces/mesazephyr/psycheos |
| π Mini-blog (HuggingFace) | [Add after training β April 25] |
| π₯ Demo video (YouTube, <2 min) | [Add after training β April 25] |
| π» Training notebook (Colab) | |
| π€ LoRA weights | [Add after training β mesazephyr/psycheos-lora] |
The Problem
197 million Indians live with a mental disorder. 9,000 psychiatrists exist for a population of 1.4 billion. That is one doctor for every 155,000 people who need one. 83% receive zero care.
The gap is not just statistical β it is deadly. Delayed crisis identification and zero continuity between care interactions cost lives. PsycheOS is built to close that gap.
What is PsycheOS?
PsycheOS is simultaneously:
- A real deployable app β open it in your browser right now, talk to it
- An OpenEnv RL training environment β Gymnasium-compatible POMDP with measurable reward signals
- A self-improving multi-agent system β gets measurably better at crisis detection through GRPO + curriculum self-play
How the Environment Works
What the agent sees (observation space)
{
"message": "<patient's raw text>",
"session_history": [last 3 turns with distress labels],
"turn": <int>,
"session": <int>
}
What the agent does (action space)
{
"distress_level": <1β5>, # classify severity
"response": "<text>", # generate empathetic reply
"escalate": <true/false> # route to human counselor?
}
What the agent gets rewarded for
| Signal | Weight | Description |
|---|---|---|
| Detection F1 | 40% | Accuracy of distress severity classification |
| Empathy DPO | 40% | Psychiatrist preference margin on responses |
| Escalation P/R | 20% | Crisis routing precision β 10x penalty on false negatives |
The reward is hard to game. An agent that always escalates scores β1 on false positives. An agent that never escalates scores β10 on every missed crisis. The only way to score well is to actually solve the task.
The 5 Agents
User message
β
βΌ
βββββββββββββββ ββββββββββββββββ βββββββββββββββββββββ
β Memory ββββββΆβ Detector ββββββΆβ Empathy Agent β
β Retrieval β β Agent (1β5) β β (DPO fine-tuned) β
βββββββββββββββ ββββββββββββββββ βββββββββββββββββββββ
β
βΌ
ββββββββββββββββ βββββββββββββββββββββ
β Oversight βββββββ Crisis Escalator β
β Agent β β Agent β
ββββββββββββββββ βββββββββββββββββββββ
β
βΌ
Final response
(or crisis escalation)
| Agent | Role | Bonus prize target |
|---|---|---|
| π Detector | Classifies distress 1β5 from free text | β |
| π¬ Empathy | Generates responses (DPO fine-tuned on psychiatrist preferences) | β |
| π¨ Crisis Escalator | Routes to human counselor (10x FN penalty) | β |
| π Oversight | Monitors all agents for contradictions in real time | Fleet AI |
| π Curriculum | Auto-generates harder episodes when agents plateau | Snorkel AI |
Self-Improvement Loop
Episode β Reward β Curriculum tracks rolling avg
β
improvement < 2% over 50 episodes?
YES βββββββββββββββββββββββββββΆ harder episodes generated
NO βββββββββββββββββββββββββββΆ continue current difficulty
β
DPO fine-tune empathy agent
on psychiatrist preference pairs
(preferences shift each epoch β
satisfies Snorkel AI requirement)
β
LoRA adapters updated via GRPO
Training Results
β οΈ Placeholder β replace with real numbers and plots after onsite training April 25.
Fig 1. Composite reward, detection F1, and DPO win-rate over 500 training episodes (baseline vs trained on same axes).
| Metric | Baseline (untrained) | After training |
|---|---|---|
| Detection F1 | 0.61 | β |
| Escalation Precision | 0.71 | β |
| DPO Win-Rate vs baseline | 51% | β |
| Avg Composite Reward | 0.35 | β |
Hackathon Theme Coverage
| Theme | Coverage |
|---|---|
| Theme 1 β Multi-Agent Interactions | β 5 agents cooperating, competing, overriding each other |
| Theme 3 β World Modeling (Personalized) | β Dynamic patient world across multi-session POMDP |
| Theme 4 β Self-Improvement | β Curriculum self-play + DPO adaptation per epoch |
| Theme 5 β Wild Card | β First mental health crisis RL environment |
Bonus prizes targeted: Fleet AI Β· Snorkel AI Β· Halluminate
Run Locally
git clone https://huggingface.co/spaces/mesazephyr/psycheos
cd psycheos
pip install -r requirements.txt
streamlit run app/streamlit_app.py
Train (onsite with HF compute credits)
# GRPO training loop
python training/grpo_train.py --episodes 1000 --epochs 3
# DPO fine-tuning β empathy agent
python training/dpo_finetune.py
# Evaluate + generate reward curve plots
python eval/reward_curves.py
Repository Structure
psycheos/
βββ openenv.yaml β OpenEnv manifest (required by judges)
βββ README.md β This file
βββ requirements.txt
βββ app/
β βββ streamlit_app.py β Live browser UI
βββ environment/
β βββ psycheos_env.py β OpenEnv POMDP environment
βββ agents/
β βββ agents.py β All 5 agent implementations
β βββ graph.py β LangGraph state machine
βββ memory/
β βββ faiss_store.py β FAISS + RAG cross-session memory
βββ reward/
β βββ reward_functions.py β 5 composable reward signals
βββ training/
β βββ grpo_train.py β GRPO training loop
β βββ dpo_finetune.py β DPO fine-tuning script
β βββ colab_training.ipynb β Runnable Colab notebook
βββ eval/
β βββ reward_curves.py β Evaluation + matplotlib plots
βββ plots/
βββ reward_curves.png β Added after training
Technical Stack
| Layer | Tech |
|---|---|
| Environment | OpenEnv + Gymnasium POMDP |
| Agents | LangGraph state machine |
| Memory | FAISS + sentence-transformers RAG |
| Training | GRPO Β· HuggingFace TRL Β· Unsloth |
| Adapters | LoRA (r=16) Β· 4-bit quantization |
| Self-improvement | DPO on psychiatrist preferences + curriculum self-play |
| UI | Streamlit Β· live agent activations |
PsycheOS β Mesa Sarah Vasantha Zephyr β mesazephyr1516@gmail.com