Views
No views yet
[!NOTE] This is a pilot training run for research purposes. It is not an official release and has not been validated for general deployment.
[!WARNING] DISCLAIMER: This model is a domain-specific proof-of-concept for therapeutic guidance and research. It has NOT been clinically validated and has not undergone regulatory review. It may produce incorrect, unsafe, or misleading psychological advice. Do not use this model as a substitute for professional therapy, diagnosis, or psychiatric treatment. Always consult a qualified psychologist or healthcare professional.
| Base Model | google/gemma-4-E4B-it |
| Architecture | Dense + PLE (Parameter-Layer-Embedding) |
| Total Parameters | 8,000,000,000 (8B) |
| Effective Parameters | 4,500,000,000 (4.5B) |
| Layers | 42 |
| Shared KV cache layers | 18 |
| Context length | 4,096 (Configured) |
| Attention Pattern | Alternating local sliding-window (512 tokens) and global full-context |
| Precision | bfloat16 |
| Flash attention | ❌ (Disabled) |
| Parameter | Value |
|---|---|
| Sequence length | 4,096 |
| Sample packing | false |
| Pad to sequence length | true |
| Num. epochs | 20 |
| Save steps | 40 |
| Eval steps | 20 |
| Logging steps | 5 |
| Optimizer | adamw_torch |
| Learning rate | 5e-5 |
| LR scheduler | cosine |
| Warmup ratio | 0.05 |
| Weight decay | 0.01 |
| Micro batch size | 1 |
| Gradient accumulation steps | 2 |
| Gradient checkpointing | true |
| Val set size | 0.05 |
| Seed | 42 |
| BF16 | true |
| FP16 | false |
| Fine-Tuning Method | SFT (Supervised Fine-Tuning) |
| Adapter | LoRA |
| LoRA R | 16 |
| LoRA Alpha | 32 |
| LoRA Dropout | 0.05 |
| LoRA Target Modules | `model.language_model.layers.[\d]+.(_checkpoint_wrapped_module.)?(mlp |
1from transformers import AutoTokenizer, AutoModelForCausalLM
2import torch
3
4model_id = "SINAI/ALIA-es-gemma-clinical-psychology-sft"
5
6# System prompt used to steer the model towards empathetic therapy
7system_prompt = (
8 "Eres un terapeuta psicológico empático y profesional. "
9 "Escucha activamente al paciente y responde de forma apropiada, "
10 "validando sus emociones y explorando su experiencia."
11)
12
13# Example conversation structure (using the Gemma 4 chat template style)
14messages = [
15 {"role": "system", "content": system_prompt},
16 {"role": "user", "content": "Hola. Pues llevo desde hace mucho sintiendome con mucha ansiedad por basicamente casi todo"}
17]
18
19tokenizer = AutoTokenizer.from_pretrained(model_id)
20model = AutoModelForCausalLM.from_pretrained(
21 model_id,
22 device_map="auto",
23 torch_dtype=torch.bfloat16
24)
25
26# Apply the chat template
27prompt = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
28
29inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
30outputs = model.generate(**inputs, max_new_tokens=200)
31
32# Decode the generated tokens (skipping the prompt part)
33generated_tokens = outputs[0][inputs.input_ids.shape[1]:]
34print(tokenizer.decode(generated_tokens, skip_special_tokens=True))[!NOTE] Data Availability: The dataset used for training is publicly available on Hugging Face at SINAI/ALIA-es-clinical-psychology-dialogues.
ALIA-es-clinical-psychology-dialogues.jsonl (containing 67 multi-turn sessions)conversations history. The target responses (assistant) are human-curated/edited therapist dialogues that prioritize validation, empathy, active listening, and safe, explorative therapeutic interaction in Spanish.1@misc{ALIA-es-gemma-clinical-psychology-sft,
2 title={ALIA-es-gemma-clinical-psychology-sft: Empathetic Psychology SFT Model for Spanish},
3 author={SINAI Research Group},
4 year={2026},
5 publisher={HuggingFace},
6 howpublished={\url{https://huggingface.co/SINAI/ALIA-es-gemma-clinical-psychology-sft}}
7}1@misc{gemma4_2026,
2 title={Gemma 4: Open Weights Multimodal Models},
3 author={Google DeepMind},
4 year={2026},
5 url={https://deepmind.google/gemma}
6}