Spaces:
Runtime error
Runtime error
Update README.md
Browse files
README.md
CHANGED
|
@@ -17,97 +17,57 @@ tags:
|
|
| 17 |
- hackathon
|
| 18 |
---
|
| 19 |
|
| 20 |
-
# PsycheOS β Mental Health Crisis Operating System
|
| 21 |
|
| 22 |
-
**Meta PyTorch OpenEnv Hackathon Γ Scaler School of Technology β Grand Finale**
|
| 23 |
-
|
| 24 |
-
*Solo submission by Mesa Sarah Vasantha Zephyr*
|
| 25 |
|
| 26 |
---
|
| 27 |
|
| 28 |
-
#
|
| 29 |
-
|
| 30 |
-
197 million Indians live with a mental disorder. There are 9,000 psychiatrists β one for every 155,000 people who need one. 83% receive zero care.
|
| 31 |
-
|
| 32 |
-
PsycheOS is a self-improving multi-agent system designed to close that gap.
|
| 33 |
-
|
| 34 |
-
---
|
| 35 |
-
|
| 36 |
-
## What It Is
|
| 37 |
-
|
| 38 |
-
PsycheOS is simultaneously:
|
| 39 |
-
1. **A real, deployable app** β open it in your browser right now
|
| 40 |
-
2. **An OpenEnv RL training environment** β with measurable reward signals
|
| 41 |
-
3. **A self-improving agent system** β that gets measurably better at crisis detection
|
| 42 |
-
|
| 43 |
-
---
|
| 44 |
|
| 45 |
-
|
|
|
|
|
|
|
| 46 |
|
| 47 |
-
|
| 48 |
-
|
| 49 |
-
|
| 50 |
-
|
| 51 |
-
|
| 52 |
-
| π **Oversight** | Monitors agents for contradictions and tone mismatches |
|
| 53 |
-
| π **Curriculum** | Auto-generates harder training episodes when agents plateau |
|
| 54 |
|
| 55 |
---
|
| 56 |
|
| 57 |
-
#
|
| 58 |
|
| 59 |
-
|
| 60 |
-
- **Theme 3 β World Modeling / Personalized Tasks** (full)
|
| 61 |
-
- **Theme 4 β Self-Improvement** (full)
|
| 62 |
-
- **Theme 5 β Wild Card** (bonus)
|
| 63 |
|
| 64 |
-
|
|
|
|
|
|
|
|
|
|
| 65 |
|
| 66 |
---
|
| 67 |
|
| 68 |
-
#
|
| 69 |
|
| 70 |
-
|
| 71 |
-
- **Agents:** LangGraph state machine
|
| 72 |
-
- **Memory:** FAISS + RAG + sentence-transformers
|
| 73 |
-
- **Training:** GRPO via HF TRL + Unsloth (LoRA, 4-bit)
|
| 74 |
-
- **Self-improvement:** DPO on psychiatrist-simulated preferences + curriculum self-play
|
| 75 |
-
- **UI:** Streamlit with live agent activations
|
| 76 |
|
| 77 |
-
|
| 78 |
-
|
| 79 |
-
## Training Results
|
| 80 |
|
| 81 |
-
|
| 82 |
-
|
| 83 |
-
|
| 84 |
-
|
| 85 |
-
|
| 86 |
|
| 87 |
---
|
| 88 |
|
| 89 |
-
##
|
| 90 |
-
|
| 91 |
-
```bash
|
| 92 |
-
git clone https://huggingface.co/spaces/mesazephyr/psycheos
|
| 93 |
-
cd psycheos
|
| 94 |
-
pip install -r requirements.txt
|
| 95 |
-
streamlit run app/streamlit_app.py
|
| 96 |
-
```
|
| 97 |
-
|
| 98 |
-
## Training
|
| 99 |
-
|
| 100 |
-
```bash
|
| 101 |
-
# GRPO training (requires HuggingFace compute credits)
|
| 102 |
-
python training/grpo_train.py --episodes 1000 --epochs 3
|
| 103 |
-
|
| 104 |
-
# DPO fine-tuning (empathy agent)
|
| 105 |
-
python training/dpo_finetune.py
|
| 106 |
-
|
| 107 |
-
# Evaluate
|
| 108 |
-
python eval/reward_curves.py
|
| 109 |
-
```
|
| 110 |
-
|
| 111 |
-
---
|
| 112 |
|
| 113 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 17 |
- hackathon
|
| 18 |
---
|
| 19 |
|
| 20 |
+
# π§ PsycheOS β Mental Health Crisis Operating System
|
| 21 |
|
| 22 |
+
**Meta PyTorch OpenEnv Hackathon Γ Scaler School of Technology β Grand Finale**
|
| 23 |
+
**Solo Submission β Mesa Sarah Vasantha Zephyr**
|
|
|
|
| 24 |
|
| 25 |
---
|
| 26 |
|
| 27 |
+
# π¨ Problem
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 28 |
|
| 29 |
+
197M+ people in India suffer from mental health disorders.
|
| 30 |
+
There are only ~9,000 psychiatrists β **1 per 155,000 people**.
|
| 31 |
+
**83% receive no treatment.**
|
| 32 |
|
| 33 |
+
Current LLM systems fail at:
|
| 34 |
+
- Long-horizon emotional reasoning
|
| 35 |
+
- Crisis detection under ambiguity
|
| 36 |
+
- Maintaining consistency across conversations
|
| 37 |
+
- Knowing when to escalate to humans
|
|
|
|
|
|
|
| 38 |
|
| 39 |
---
|
| 40 |
|
| 41 |
+
# π‘ Solution
|
| 42 |
|
| 43 |
+
PsycheOS is a **trainable reinforcement learning environment + multi-agent system** that teaches LLMs to:
|
|
|
|
|
|
|
|
|
|
| 44 |
|
| 45 |
+
- Detect distress accurately
|
| 46 |
+
- Respond empathetically
|
| 47 |
+
- Escalate high-risk cases safely
|
| 48 |
+
- Maintain memory + consistency
|
| 49 |
|
| 50 |
---
|
| 51 |
|
| 52 |
+
# π§ Environment Definition
|
| 53 |
|
| 54 |
+
## State (POMDP)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 55 |
|
| 56 |
+
Each timestep contains:
|
|
|
|
|
|
|
| 57 |
|
| 58 |
+
- `message` β current patient input
|
| 59 |
+
- `session_history` β last 3 turns
|
| 60 |
+
- `stressors` β latent causes (grief, isolation, etc.)
|
| 61 |
+
- `hidden_distress` β ground truth (1β5, not visible to agent)
|
| 62 |
+
- `turn` β conversation step
|
| 63 |
|
| 64 |
---
|
| 65 |
|
| 66 |
+
## Actions (Agent Output)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 67 |
|
| 68 |
+
```json
|
| 69 |
+
{
|
| 70 |
+
"distress_level": 1-5,
|
| 71 |
+
"response": "empathetic message",
|
| 72 |
+
"escalate": true/false
|
| 73 |
+
}
|