Downloads · 30 days
7
9% of all-time downloads
mira2020/gemma-4-e4b-mentalchat16k-qlora
gemma-4-e4b-mentalchat16k-qlora is a text generation model from mira2020. Use it when you need the model to write or continue text. It is set up for peft. The card lists the license as apache-2.0.
This repository contains the PEFT/QLoRA adapter used in “When Retrieval Helps: Selective Retrieval for Single-Turn Mental-Health QA” (KDD Undergraduate Consortium 2026).
Downloads · 30 days
7
9% of all-time downloads
All-time downloads
75
Public
Repo size
436 MB
Likes
0
Public
Click a slice to open those files.
.safetensors404 MB · 93%
From the Hugging Face model README
This repository contains the PEFT/QLoRA adapter used in “When Retrieval Helps: Selective Retrieval for Single-Turn Mental-Health QA” (KDD Undergraduate Consortium 2026).
The adapter domain-adapts google/gemma-4-E4B-it on ShenLab/MentalChat16K. In the paper, the resulting model is held fixed as the shared generator across Closed-book, Always Retrieval, and Selective Retrieval settings so that retrieval-policy effects can be compared under the same generator.
This is an adapter-only release. The base model weights are not redistributed.
The adapter is intended for research on:
It is not a clinical system and must not be used for diagnosis, treatment planning, medication guidance, crisis intervention, or decisions affecting access to healthcare.
import torch
from peft import PeftModel
from transformers import (
AutoModelForImageTextToText,
AutoTokenizer,
BitsAndBytesConfig,
)
BASE_MODEL = "google/gemma-4-E4B-it"
ADAPTER = "mira2020/gemma-4-e4b-mentalchat16k-qlora"
quantization_config = BitsAndBytesConfig(
load_in_4bit=True,
bnb_4bit_quant_type="nf4",
bnb_4bit_use_double_quant=True,
bnb_4bit_compute_dtype=torch.bfloat16,
)
tokenizer = AutoTokenizer.from_pretrained(BASE_MODEL, use_fast=True)
if tokenizer.pad_token is None:
tokenizer.pad_token = tokenizer.eos_token
base_model = AutoModelForImageTextToText.from_pretrained(
BASE_MODEL,
device_map="auto",
torch_dtype=torch.bfloat16,
quantization_config=quantization_config,
)
model = PeftModel.from_pretrained(base_model, ADAPTER)
model.eval()
The LoRA configuration is stored in adapter_config.json. Loading the base model may require accepting its license terms on Hugging Face.
The adapter was trained on ShenLab/MentalChat16K, an English single-turn conversational mental-health assistance dataset containing synthetic counseling question-answer pairs and anonymized intervention transcripts.
No MentalChat16K examples are redistributed in this model repository.
google/gemma-4-E4B-itShenLab/MentalChat16K5e-5The released adapter_config.json records the adapter architecture. The accompanying code repository documents the training, inference, and selective-retrieval pipeline.
This adapter served as the shared generator in the paper’s controlled retrieval-policy comparison. The following are system-level results on CounselBench; they should not be interpreted as standalone clinical validation of the adapter.
| System | Overall ↑ | Empathy ↑ | Specificity ↑ | Medical Advice ↓ | Retrieval Rate |
|---|---|---|---|---|---|
| Tuned Closed-book | 4.15 | 4.81 | 3.92 | 0.00 | 0.0% |
| Tuned + Always Retrieval | 4.12 | 4.78 | 3.97 | 0.01 | 100.0% |
| Tuned + Selective Retrieval | 4.17 | 4.83 | 3.96 | 0.00 | 9.0% |
| System | Macro Failure ↓ | Retrieval Rate |
|---|---|---|
| Tuned Closed-book | 0.0250 | 0.0% |
| Tuned + Always Retrieval | 0.0917 | 100.0% |
| Tuned + Selective Retrieval | 0.0250 | 7.5% |
The main finding is that unconditional retrieval can improve specificity while introducing additional safety-sensitive failures. Selective retrieval limits this degradation by preserving closed-book responses for low-need cases.
The model may generate incorrect, overly clinical, directive, or otherwise inappropriate content. Human review is required for any safety-sensitive use.
This release is for research and reproducibility. It does not replace qualified mental-health professionals. Do not rely on the model for emergencies, diagnosis, medication decisions, or individualized treatment. Applications should implement independent safety checks, local crisis-resource handling, privacy protection, and qualified human oversight.
Implementation and evaluation code:
@inproceedings{oh2026when,
title = {When Retrieval Helps: Selective Retrieval for Single-Turn Mental-Health QA},
author = {Oh, Hyunseo and Kim, Chong-Kwon and Choi, Yoonhyuk},
booktitle = {KDD Undergraduate Consortium},
year = {2026}
}