← Back to Abdelfetah Safiddine Portfolio
Saha Mind — Psychological assessment with LLM agents
Applied AI · Master's dissertation · 2024 — 2025 · Co-author with Said Seghir Akram · Supervised by Dr. Rahim Messaoud
My Master's dissertation: an AI-driven psychological assessment and therapeutic support platform coordinating four specialized LLM agents across a React Native mobile app and a Next.js clinical dashboard.
Key Outcomes
- Four specialized agents coordinated across a React Native client and a Next.js dashboard.
- Evaluated on 1,000 real-world sample test pairs using three semantic similarity measures.
- Jarvis + RAG scored 0.811 cosine similarity and 0.835 on an LLM-as-a-judge semantic score.
- The work was documented as assistive clinical tooling, not autonomous diagnosis.
Tech Stack
LLaMA 3.2 (LoRA) · LangChain / RAG · FAISS · DistilBERT · Quantized Mistral 7B · React Native · Next.js · FastAPI · Supabase
Research context & clinical challenge
Master's Degree in Computer Science (System Engineering & Web Technologies, Yahia Farès University of Médéa, 2024–2025), co-authored with Said Seghir Akram and supervised by Dr. Rahim Messaoud. Mental health systems globally struggle with accessibility, specialist shortages, and limited continuity between consultations. Our thesis investigated how a modular, multi-agent LLM framework can provide continuous emotional support and automated documentation for clinicians — without replacing the human therapist.
4-agent collaborative architecture
Instead of relying on a monolithic model, the system divides the psychological workflow across four specialized language models orchestrated through FastAPI and LangChain:
- Prompt Formatting Agent (vennify/t5-base-grammar-correction, <0.2s): normalizes grammatical noise, cleans raw queries, and structures inputs with safety constraints.
- Therapeutic Conversational Agent 'Jarvis' (fine-tuned LLaMA 3.2 Instruct + LoRA, <2s): trained on psycho-counseling datasets and augmented with RAG using 384-dimensional MiniLM embeddings and FAISS.
- Sentiment Analysis Agent (fine-tuned DistilBERT, <3s): processes multi-turn conversation history to extract emotional valence and distress markers.
- Medical Report Generation Agent (quantized Mistral 7B, <12s): synthesizes transcripts, sentiment trajectories, and clinician notes into structured, DSM-aligned clinical summaries.
Full-stack client & cloud ecosystem
The architecture was implemented and tested end-to-end across two complementary client applications backed by cloud infrastructure:
- Patient mobile app (React Native, TypeScript): mood tracking, streaks, self-assessment quizzes, and real-time chat with Jarvis and assigned clinicians.
- Practitioner dashboard (Next.js, TypeScript, shadcn/ui): patient registry, seven-day emotional trend analysis, regional distribution map, appointment calendar, and report review.
- Backend and orchestration: Python FastAPI on ASGI/Uvicorn, Pyngrok tunnels to Google Colab GPU runtimes, and Supabase for PostgreSQL, real-time sync, auth, and role-based access.
Quantitative benchmarks
We benchmarked the system against base LLaMA 3.2, phi-2 + RAG, and GPT-2 Large across three semantic similarity dimensions. The fine-tuned Jarvis agent with RAG produced the strongest results in every category.
Ethical boundaries & safeguards
The system incorporates strict ethical boundaries: patient-facing summaries are explicitly separated from full medical diagnoses to prevent self-misinterpretation, and the platform is designed as an assistive tool to empower licensed psychologists rather than operate autonomously.
What the project reinforced
- Evaluation design matters as much as model choice: the same outputs read differently under cosine, judge, and lexical measures.
- Specialization buys control: each agent has a narrow job and an explicit latency budget.
- Clinical tooling needs boundaries: patient-facing summaries and diagnostic documentation are different products.