Text Generation
Safetensors
English
llama
conversational
Jitaishik commited on
Commit
f58ba6d
·
verified ·
1 Parent(s): 61718c5

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +112 -1
README.md CHANGED
@@ -7,4 +7,115 @@ language:
7
  base_model:
8
  - meta-llama/Meta-Llama-3-8B-Instruct
9
  pipeline_tag: text-generation
10
- ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7
  base_model:
8
  - meta-llama/Meta-Llama-3-8B-Instruct
9
  pipeline_tag: text-generation
10
+ arxiv: 2509.04183
11
+ ---
12
+ # Model Card for Llama3-MAGneT
13
+
14
+ Llama-3-8B-Instruct fine-tuned on the [MAGneT dataset](https://huggingface.co/datasets/UKPLab/MAGneT) for mental health counseling dialogue generation. MAGneT sessions are generated using a coordinated multi-agent framework incorporating specialized response agents (reflection, questioning, solutions, normalizing, psycho-education), a technique agent, a CBT agent, and a response generation agent — resulting in more nuanced and clinically grounded counseling dialogues than single-agent approaches.
15
+
16
+ ## Model Details
17
+
18
+ `Base model`: [meta-llama/Meta-Llama-3-8B-Instruct](https://huggingface.co/meta-llama/Meta-Llama-3-8B-Instruct)
19
+
20
+ `Input`: A system prompt with a fixed counselor role instruction, followed by the client's demographic information, reason for seeking counseling, and the dialogue history.
21
+
22
+ `Output`: The next counselor turn in the therapeutic dialogue.
23
+
24
+ `Training data`: [MAGneT](https://huggingface.co/datasets/UKPLab/MAGneT) — 442 synthetic multi-turn counseling sessions grounded in client profiles from the [CACTUS](https://huggingface.co/datasets/LangAGI-Lab/cactus) dataset, generated using a coordinated multi-agent framework.
25
+
26
+ `Fine-tuning method`: QLoRA
27
+
28
+ ## Usage
29
+
30
+ ```python
31
+ from transformers import AutoTokenizer, AutoModelForCausalLM
32
+ import torch
33
+
34
+ model_id = "UKPLab/Llama3-MAGneT"
35
+
36
+ tokenizer = AutoTokenizer.from_pretrained(model_id)
37
+ model = AutoModelForCausalLM.from_pretrained(
38
+ model_id,
39
+ torch_dtype=torch.bfloat16,
40
+ device_map="auto",
41
+ )
42
+
43
+ system_prompt = (
44
+ "You are playing the role of a counselor in a psychological counseling session. "
45
+ "Your task is to use the provided client information to generate the next counselor "
46
+ "response in the dialogue by combining psychological techniques like reflections, "
47
+ "questioning, providing solutions, normalizing and psychoeducation. The goal is to "
48
+ "create a natural and engaging response that builds on the previous conversation. "
49
+ "Please ensure that the response is empathetic and understanding of the client's issues "
50
+ "and builds trust between the counselor and the client. Please be mindful to only generate "
51
+ "the counselor response for a single turn, and do not include extra text like \"here is the "
52
+ "next counselor utterance\" or \"Here is a possible next utterance\" or anything mentioning "
53
+ "the used technique."
54
+ )
55
+
56
+ client_information = (
57
+ "Name:\nLaura Saunders\nAge:\n45\nGender:\nfemale\nOccupation: Office Job\n"
58
+ "Education: College Graduate\nMarital Status: Single\nFamily Details: Lives alone"
59
+ )
60
+
61
+ reason_counseling = (
62
+ "I decided to seek counseling because this negative belief is hindering my enjoyment "
63
+ "of running and affecting my overall mood."
64
+ )
65
+
66
+ history = (
67
+ "Counselor: Hello, Laura. It's nice to meet you. What brings you in today?\n"
68
+ "Client: Hi, thank you. I've been struggling with the thought that I can't run far, "
69
+ "despite enjoying running as a hobby. It's really getting me down."
70
+ )
71
+
72
+ user_content = (
73
+ f"Client Information:\n{client_information}\n"
74
+ f"Reason for seeking counseling:\n{reason_counseling}\n"
75
+ f"Counseling Dialogue:\n{history}"
76
+ )
77
+
78
+ messages = [
79
+ {"role": "system", "content": system_prompt},
80
+ {"role": "user", "content": user_content},
81
+ ]
82
+
83
+ input_ids = tokenizer.apply_chat_template(
84
+ messages,
85
+ tokenize=True,
86
+ add_generation_prompt=True,
87
+ return_tensors="pt"
88
+ ).to(model.device)
89
+
90
+ with torch.no_grad():
91
+ output = model.generate(
92
+ input_ids,
93
+ max_new_tokens=256,
94
+ do_sample=True,
95
+ temperature=0.7,
96
+ top_p=0.9,
97
+ )
98
+
99
+ response = tokenizer.decode(output[0][input_ids.shape[-1]:], skip_special_tokens=True)
100
+ print(response)
101
+ ```
102
+
103
+ ## Citation
104
+
105
+ Please cite this model using:
106
+
107
+ ```bibtex
108
+ @misc{mandal2025magnetcoordinatedmultiagentgeneration,
109
+ title={MAGneT: Coordinated Multi-Agent Generation of Synthetic Multi-Turn Mental Health Counseling Sessions},
110
+ author={Aishik Mandal and Tanmoy Chakraborty and Iryna Gurevych},
111
+ year={2025},
112
+ eprint={2509.04183},
113
+ archivePrefix={arXiv},
114
+ primaryClass={cs.CL},
115
+ url={https://arxiv.org/abs/2509.04183},
116
+ }
117
+ ```
118
+
119
+ ## Contact
120
+
121
+ For questions or feedback, please contact: [aishik.mandal@tu-darmstadt.de](mailto:aishik.mandal@tu-darmstadt.de)