Views
No views yet
Base model: meta-llama/Meta-Llama-3-8B-InstructInput: A system prompt with a fixed counselor role instruction, followed by the client's demographic information, reason for seeking counseling, and the dialogue history.Output: The next counselor turn in the therapeutic dialogue.Training data: MAGneT — 442 synthetic multi-turn counseling sessions grounded in client profiles from the CACTUS dataset, generated using a coordinated multi-agent framework.Fine-tuning method: QLoRA1from transformers import AutoTokenizer, AutoModelForCausalLM
2import torch
3
4model_id = "UKPLab/Llama3-MAGneT"
5
6tokenizer = AutoTokenizer.from_pretrained(model_id)
7model = AutoModelForCausalLM.from_pretrained(
8 model_id,
9 torch_dtype=torch.bfloat16,
10 device_map="auto",
11)
12
13system_prompt = (
14 "You are playing the role of a counselor in a psychological counseling session. "
15 "Your task is to use the provided client information to generate the next counselor "
16 "response in the dialogue by combining psychological techniques like reflections, "
17 "questioning, providing solutions, normalizing and psychoeducation. The goal is to "
18 "create a natural and engaging response that builds on the previous conversation. "
19 "Please ensure that the response is empathetic and understanding of the client's issues "
20 "and builds trust between the counselor and the client. Please be mindful to only generate "
21 "the counselor response for a single turn, and do not include extra text like \"here is the "
22 "next counselor utterance\" or \"Here is a possible next utterance\" or anything mentioning "
23 "the used technique."
24)
25
26client_information = (
27 "Name:\nLaura Saunders\nAge:\n45\nGender:\nfemale\nOccupation: Office Job\n"
28 "Education: College Graduate\nMarital Status: Single\nFamily Details: Lives alone"
29)
30
31reason_counseling = (
32 "I decided to seek counseling because this negative belief is hindering my enjoyment "
33 "of running and affecting my overall mood."
34)
35
36history = (
37 "Counselor: Hello, Laura. It's nice to meet you. What brings you in today?\n"
38 "Client: Hi, thank you. I've been struggling with the thought that I can't run far, "
39 "despite enjoying running as a hobby. It's really getting me down."
40)
41
42user_content = (
43 f"Client Information:\n{client_information}\n"
44 f"Reason for seeking counseling:\n{reason_counseling}\n"
45 f"Counseling Dialogue:\n{history}"
46)
47
48messages = [
49 {"role": "system", "content": system_prompt},
50 {"role": "user", "content": user_content},
51]
52
53input_ids = tokenizer.apply_chat_template(
54 messages,
55 tokenize=True,
56 add_generation_prompt=True,
57 return_tensors="pt"
58).to(model.device)
59
60with torch.no_grad():
61 output = model.generate(
62 input_ids,
63 max_new_tokens=256,
64 do_sample=True,
65 temperature=0.7,
66 top_p=0.9,
67 )
68
69response = tokenizer.decode(output[0][input_ids.shape[-1]:], skip_special_tokens=True)
70print(response)1@misc{mandal2025magnetcoordinatedmultiagentgeneration,
2 title={MAGneT: Coordinated Multi-Agent Generation of Synthetic Multi-Turn Mental Health Counseling Sessions},
3 author={Aishik Mandal and Tanmoy Chakraborty and Iryna Gurevych},
4 year={2025},
5 eprint={2509.04183},
6 archivePrefix={arXiv},
7 primaryClass={cs.CL},
8 url={https://arxiv.org/abs/2509.04183},
9}