KediTherapist-nano-base
KediTherapist-nano-base is a small dense Llama-style language model trained from scratch for psychology, therapy, counseling, and human-relationship language modeling. It has 25.2M parameters (12.6M excluding the embedding table) and was pretrained on 600M tokens.
This is a tiny base model, before any instruction tuning or alignment. It continues text; it does not follow instructions. It is a research and educational artifact: it writes fluent, in-domain psychology and counseling prose but frequently makes up facts and loops after a sentence or two. Do not use it for medical, mental-health, or clinical advice.
The KediTherapist family
KediTherapist models share one Llama-style GQA architecture and tokenizer, scaling smoothly from local iGPU prototyping (pico) to multi-GPU tiers (large).
| Scale | Hidden | Layers | Heads (query / KV) | FFN | Context | RoPE ΞΈ | Total | Non-embedding |
|---|---|---|---|---|---|---|---|---|
pico |
256 | 6 | 4 / 2 | 704 | 1,024 | 10,000 | 12.8M | 4.4M |
nano β this model |
384 | 8 | 6 / 2 | 1024 | 1,024 | 10,000 | 25.2M | 12.6M |
micro |
512 | 10 | 8 / 2 | 1408 | 2,048 | 50,000 | 45.0M | 28.2M |
mini |
640 | 12 | 10 / 2 | 1728 | 2,048 | 50,000 | 72.6M | 51.6M |
small |
768 | 18 | 12 / 4 | 2048 | 4,096 | 100,000 | 138.4M | 113.3M |
base |
1024 | 24 | 16 / 4 | 2752 | 4,096 | 100,000 | 299.4M | 265.9M |
medium |
2048 | 24 | 16 / 4 | 5504 | 8,192 | 500,000 | 1,130.5M | 1,063.4M |
large |
3072 | 28 | 24 / 8 | 8192 | 8,192 | 500,000 | 2,919.4M | 2,818.8M |
Architecture
A dense, Llama-style decoder-only transformer (llama_gqa).
| Component | This model |
|---|---|
| Parameters | 25.17M total, 12.59M excluding the embedding table |
| Layers / hidden size | 8 / 384, pre-norm (RMSNorm, eps 1e-06) |
| Attention | Grouped-query attention: 6 query heads sharing 2 key/value heads, head dim 64, QK-norm |
| Positions | RoPE (ΞΈ = 10,000); YaRN scaling available for longer contexts |
| Feed-forward | SwiGLU, 1024 hidden |
| Embeddings | Input embedding and output head tied |
| Output | Logit soft-cap 30 (cap Β· tanh(logits / cap)) |
| Context | 1,024 tokens |
Training
| Data | 600M tokens (~48 tokens per non-embedding parameter) |
| Tokenizer | Byte-level BPE, 32,768 tokens, with individual digit splitting and chat, reasoning, and tool-call special tokens |
| Steps | 36,597 Γ 16,384 tokens (batch 4 Γ 1,024 Γ 4 accumulation) |
| Optimizer | AdamW (Ξ² = 0.9, 0.95, Ξ΅ = 1e-8), weight decay 0.1 (not on norms), gradient clipping 1.0 |
| Learning rate | 2.5e-3 peak; WSD: 1,469 warm-up steps, 25,128 constant, then cosine decay to 5% of peak over the last 10,000 |
| Precision | bf16 autocast |
| Compute | ~4.5e16 FLOPs (6 Γ non-embedding parameters Γ tokens) |
| Hardware | One AMD Radeon 890M (laptop iGPU, ROCm on Windows): 34.0 hours at ~5.0K tokens/s |
Evaluation
| Metric | Value |
|---|---|
| Validation loss (nats/token, held-out) | 3.601 |
| Perplexity | 36.6 |
Validation loss over training: 10.46 (0M tok) β 4.05 (106M tok) β 3.99 (221M tok) β 3.96 (328M tok) β 3.93 (438M tok) β 3.87 (492M tok) β 3.71 (549M tok) β 3.60 (600M tok)
Zero-shot Cloze benchmarks (main.py --mode bench --prompt-style cloze)
| Task | acc_norm | acc | gold_bpb | Items | Split | Chance |
|---|---|---|---|---|---|---|
| BLiMP | 61.4% Β± 1.5% | 68.9% | 2.138 | 1,000 | 1,000 stratified pairs (20 phenomena) | 50% |
| SciQ (Psychology) | 57.2% Β± 3.6% | 66.3% | 1.770 | 187 | validation + test psychology slice | 25% |
| MMLU High School Psychology | 34.5% Β± 1.9% | 37.7% | 1.345 | 605 | validation + test | 25% |
| MMLU Professional Psychology | 28.6% Β± 1.7% | 26.3% | 1.272 | 681 | validation + test | 25% |
| SocialIQA | 40.7% Β± 1.1% | 35.6% | 2.008 | 1,954 | validation | 33% |
Each answer choice is scored by continuation log-likelihood in cloze format (in-place blank substitution for fill-in-the-blank items, natural prose continuation for stems/questions, and full-sentence scoring for BLiMP minimal pairs). acc_norm divides log-likelihood by the continuation's length in UTF-8 bytes; acc does not; gold_bpb is bits per byte on the correct continuation (lower is better). Β± is one standard error.
Scale Comparison
| This model | KediTherapist-pico-base | |
|---|---|---|
| Parameters (total) | 25.2M | 12.8M |
| Non-embedding parameters | 12.6M | 4.4M |
| Training tokens | 600M | 410M |
| BLiMP (acc_norm) | 61.4% | 57.1% |
| SciQ (Psychology) (acc_norm) | 57.2% | 58.8% |
| MMLU High School Psychology (acc_norm) | 34.5% | 33.7% |
| MMLU Professional Psychology (acc_norm) | 28.6% | 27.8% |
| SocialIQA (acc_norm) | 40.7% | 40.0% |
| Validation loss (held-out) | 3.601 | 3.827 |
What it can and can't do
This is the second rung of the KediTherapist ladder: a dense 25.2M-parameter model (12.6M excluding the embedding table β nearly 3Γ pico's non-embedding capacity) trained from scratch on a laptop's integrated GPU, reaching a held-out validation loss of 3.601 (perplexity 36.6, down 0.226 nats from pico) after 600M tokens (~48 tokens per non-embedding parameter). Compared with pico, its opening sentences are noticeably sharper and better grounded in clinical and psychological concepts, and every benchmark's gold_bpb improves by ~`0.10β0.11bits per byte. Likepico`, it still loses multi-sentence coherence, conflates adjacent concepts, and loops on abstract definitions. It is a research and educational artifact β not a clinical tool or source of mental-health advice.
What it does
- β Writes sharper, better-grounded clinical openings. Prompted with "When a client feels overwhelmed by anxiety, a therapist can help by", it continues "providing a safe space for them to work through their feelings" and lists real clinical anxiety-disorder categories (Generalized Anxiety Disorder, Panic Disorder, Obsessive Compulsive Disorder, Separation anxiety). Prompted with "Active listening in counseling involves", it opens with "listening to and understanding the speaker without judgment"; prompted with "In attachment theory, secure attachment develops when", it identifies "a child is in a secure attachment with a primary caregiver".
- β
Clear scaling gains over
picoacross all five zero-shot Cloze benchmarks:- BLiMP (
n=1,000, 20 phenomena, chance 50%): 61.4%acc_norm/ 68.9%acc(+4.3 / +5.8 pts overpico;gold_bpb2.242 β 2.138) - SciQ (Psychology) (
n=187, chance 25%): 57.2%acc_norm/ 66.3%acc(+4.8 pts rawaccoverpico;gold_bpb1.884 β 1.770) - MMLU High School Psychology (
n=605, chance 25%): 34.5%acc_norm/ 37.7%acc(+4.5 pts rawaccoverpico;gold_bpb1.455 β 1.345) - MMLU Professional Psychology (
n=681, chance 25%): 28.6%acc_norm/ 26.3%acc(gold_bpb1.367 β 1.272) - SocialIQA (
n=1,954, chance 33.3%): 40.7%acc_norm/ 35.6%acc(gold_bpb2.117 β 2.008)
- BLiMP (
What it can't do
- β Clinical accuracy or advice. This is an unaligned 25.2M-parameter base model. Never rely on it for diagnosis, crisis support, therapeutic guidance, or factual medical/psychological claims.
- β Concept separation and factual precision. It still blends adjacent topics (e.g., turning cognitive behavioral therapy into "12-stepβ¦ 13-stepβ¦ 14-step groups") and occasionally flips polarity ("Boundaries in healthy relationships are not healthy, but are healthy"). Treat every fact, citation, and clinical claim as unreliable.
- β Sustained multi-paragraph coherence. While less loop-prone than
pico, it still falls into repetition loops after a few sentences, especially on abstract definitions ("the ego is the center of the psyche, the center of the psyche"). - β Instruction following or chat. Pretrained only β no SFT, preference tuning, or safety alignment yet.
- β Long context. Trained at a 1,024-token sequence length (YaRN scaling is implemented in the architecture but not fine-tuned for longer contexts at this size).
Decoding
Use sampling with temperature β 0.7 and top-k β 40 (the defaults of KediTherapistModel.generate) and keep max_new_tokens moderate (60β100 tokens). Greedy decoding still loops quickly.
Usage
PyTorch (needs the keditherapist package):
import torch
from keditherapist.models.model import KediTherapistModel
from keditherapist.tokenizer.tokenizer import KediTokenizer
model = KediTherapistModel.from_pretrained(".") # this folder: config.json + model.safetensors
tok = KediTokenizer.load("tokenizer.json")
ids = torch.tensor([tok.encode("In cognitive behavioral therapy, ", add_bos=True)])
out = model.generate(ids, max_new_tokens=60, temperature=0.7, top_k=40)
print(tok.decode(out[0].tolist(), skip_special_tokens=True))
Files
| File | Contents |
|---|---|
model.safetensors |
PyTorch weights, keditherapist parameter names; the output head is tied to tok_embeddings.weight and not stored |
config.json |
ModelConfig for keditherapist |
tokenizer.json |
Byte-level BPE tokenizer (Hugging Face tokenizers format) |
Card generated 2026-12-05 by prepare_release.py from llama_gqa_nano_therapy_cooldown.pt.
- Downloads last month
- -