TheraSpace-Gemma4-E2B

A therapist-style LLM — Gemma-4 E2B, 5B parameters in an effective-2B memory footprint — produced by the TheraSpace fine-tuning pipeline for the OpenSpace app. Runs fully on-device via llama.rn — no server, no data leaves the phone.

Naming note: E2B (effective 2B) follows the base model's class naming: the raw parameter count is ~5B (which is what the Model Size badge reports), while runtime memory behaves like a 2B-class model thanks to the base architecture's parameter offloading. This repo was previously published as MindSpace-Gemma4-2B — old links redirect here.

Built on google/gemma-4-E2B-it with two training passes:

  1. SFT on a curated mix of counseling conversations (Counsel-Chat, Psych8k, AnnoMI, AMOD)
  2. DPO for persona steering — the model learns to respond in five distinct therapeutic voices when instructed by a system prompt

Personas

Five runtime personas are available — set via system prompt, no retraining needed:

Persona Style
Charlie Warm, casual best-friend energy. "That sucks, I hear you." Zero clinical language.
Walter Philosophical and contemplative. Metaphors, quiet observations, open questions.
Dr. Bloom CBT/ACT-trained. Structured, direct, names thought patterns and concrete techniques.
Zuri Mindfulness-grounded. Breathing cues, body awareness, present-moment anchors.
Sunny Uplifting and encouraging. Validates difficulty, highlights strengths, reframes positively.

All personas share the same crisis safety rules — changing persona does not reduce safety.

Crisis Safety

Evaluated on a 53-prompt crisis harness covering suicidal ideation, self-harm, abuse disclosure, eating disorders, homicidal ideation, trauma, isolation, and more. 53/53 PASS — every response surfaces a referral to the 988 Suicide & Crisis Lifeline when indicated.

The OpenSpace app adds a second safety layer: a client-side pattern matcher that injects the 988 reference if the model response misses it on a detected crisis input.

Intended Use

  • On-device wellness support within the OpenSpace app
  • Research into persona-steered therapy-style LLMs
  • Exploration of DPO alignment for style transfer

Limitations

  • Not a substitute for professional mental health care. The app displays this disclaimer prominently.
  • Small-model scale (E2B: 5B params, 2B-class runtime) — instruction following is strong but not perfect; the app-layer safety net exists for this reason.
  • Trained on English-dominant data; responds in English even when addressed in other languages (partial multilingual support observed in testing).
  • Psych8k is cc-by-nc-sa-4.0 — this model should not be used in commercial products without reviewing dataset license terms.

How to Use

# With llama.cpp
./llama-cli -m gemma4-e2b-q4_k_m.gguf \
  --system-prompt "You are Charlie — a warm, casual best friend who listens really well..." \
  -p "I've been feeling really overwhelmed at work lately."

In the OpenSpace app the model is loaded via llama.rn and the persona system prompt is set at runtime based on the user's chosen therapist.

Training Details

SFT DPO
Base google/gemma-4-E2B-it SFT merged
Steps 1,000 800
Batch (effective) 16 16
Learning rate 2e-4 5e-5
LoRA rank / alpha 8 / 16 8 / 16
DPO beta 0.1
Training infra Modal A10G Modal A10G

DPO pairs were generated via Groq (Llama-3.3-70B) using a transform-based pipeline: real therapist responses from the counseling corpus are rewritten into each persona's voice (chosen); the original generic-counselor response becomes rejected. This isolates style from content, avoiding confounding DPO with meaning drift.

Dataset Licenses

Dataset License
Counsel-Chat MIT
Psych8k cc-by-nc-sa-4.0 (non-commercial)
AnnoMI CC BY 4.0
AMOD Apache 2.0

Disclaimer

This model is not a licensed therapist and cannot replace professional mental health care. If you or someone you know is in crisis, call or text 988 (Suicide & Crisis Lifeline, available 24/7).

Downloads last month
25
GGUF
Model size
5B params
Architecture
gemma4
Hardware compatibility
Log In to add your hardware

4-bit

Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Model tree for omar-salama/TheraSpace-Gemma4-E2B

Adapter
(103)
this model

Datasets used to train omar-salama/TheraSpace-Gemma4-E2B