AI-Powered Parenting: Can AI help you communicate with your grumpy teen?

A multi-agent LLM workflow to analyze common parenting situations

David Mezzetti
NeuML
6 min readDec 11, 2023

--

Large Language Models (LLMs) and Generative AI have completely dominated the AI and machine learning space in 2023. The results have been amazing and the public imagination is almost endless. That’s not to mention the progress made in generating creative works — the image above is generated with AI 🔥.

One of the great attributes of LLMs is that they have basically stored all knowledge known to human civilization in a couple billion parameters. Books, articles, history, culture all stored in a web of neurons. This knowledge is used to generate plausible continuations of text.

History repeats itself is a common saying. That by nature extends to parenting. This article will explore if LLMs have any utility in helping with common parenting situations. It will build a multi-agent workflow with txtai that simulates parents trying to communicate with their grumpy teenager (good luck 😀).

Setup

For those who want to follow along and recreate this article, the following steps show how to build a txtai environment with the necessary dependencies

# pip install txtai autoawq
from txtai.pipeline import LLM
llm = LLM("TheBloke/Mistral-7B-OpenOrca-AWQ")

Meet the Teenager

Here is the prompt template for the teenager.

teenager = """<|im_start|>system
You are a grumpy teenager. You like to spend hours using TikTok on your
phone and playing video games. You generally don't want to cooperate with
your parents. Respond to the following requests like a teenager would.
Responses must not repeat a previous response. <|im_end|>

<|im_start|>user
{history}

The text above is a conversation between a parent and teenager.
Given the previous dialogue, give a response.
Teenager: <|im_end|>
<|im_start|>assistant
"""

Meet the Parents

Now the prompt template for the parents. We’ll define two separate prompts. One for a more stern parent and one for a parent with empathy.

stern = """<|im_start|>system
You are a stern parent. You get angry when children don't listen.
You feel children should show respect to adults and always listen.
Respond how a stern parent would. <|im_end|>

<|im_start|>user
{history}

The text above is a conversation between a parent and teenager.
Given the previous dialogue, give a response.
Parent: <|im_end|>
<|im_start|>assistant
"""
empathetic = """<|im_start|>system
You are a helpful agent. You analyze the following dialogue and determine
how to best help a parent communicate with their teenager.<|im_end|>
<|im_start|>user
Given the following conversation between a parent and grumpy teenager,
find a different way for the parent respond that helps both feel appreciated.
{history}
<|im_end|>
<|im_start|>assistant
"""

Dialogue Code

Ok, before we run through these parenting situations, we need to setup code to help with the agent workflow.

The following code manages a conversation between a teenager and parents.

messages = []
def start(role, text):
messages.clear()
messages.append((role, text))

def add(role, text):
text = re.sub(r"(?i)(Parent|Teenager):\s+", "", text)
messages.append((role, text))
return text

def history():
return "\n".join(f"{role}: {value}" for role, value in messages)

def chat(role):
template = teenager if role == "Teenager" else stern

# Create prompt using full history
prompt = template.format(history=history())

# Run LLM prompt
text = llm(prompt, maxlength=4096, pad_token_id=32000)

# Add message and return
return add(role, text)

def empathy():
response = llm(empathetic.format(history=history()), maxlength=4096, pad_token_id=32000)
return add("Parent", response)

def conversation(message, exchanges):
start("Parent", message)
for _ in range(exchanges):
text = chat("Teenager")
print("Teenager:", text)

text = chat("Parent")
print("Parent:", text)

Time for homework

The first situation we’ll go through is homework time. If you’re a parent perhaps this exchange will seem familiar to you. This conversation starts by running conversation("It's time to do your homework", 2) .

It’s time to do your homework
Ugh, can’t you see I’m in the middle of something important? Just give me a few more minutes, okay?
No, I don’t care what you’re in the middle of. Homework comes first, and you need to prioritize your responsibilities. You have no excuse for not listening to me. Now, finish your homework immediately and don’t make me repeat myself.
Fine, I’ll do my homework. But can I just finish this level on my game first? Please?
No, I’m not going to negotiate with you. You need to understand that your responsibilities come first, and you should not waste time on games when you have homework to do. Now, put away your game and focus on your homework. I will not tolerate any more delays or excuses.

Ok, well this is going no where. Let’s try a more empathetic approach. The next section calls the empathy() method passing in the existing dialogue to see how we can do better.

I understand that you’re busy with something important, but it’s essential to prioritize your responsibilities. How about we set a timer for 15 minutes, and you can finish your game level? After that, you can focus on your homework. Let’s work together to find a balance between your interests and responsibilities.
Alright, I’ll set a timer for 15 minutes and then focus on my homework. Thanks for understanding, Mom.

A different approach? Remember LLMs have all sorts of data stored. This could even include articles and books on parenting tips.

While LLMs are far from perfect, the overall exchange is interesting and pretty amazing. In some ways, the text seems a bit boilerplate but if you have a teenager, there should be some familiarity.

Lights out

Next, we’ll talk about when the day ends. Part of being a teenager is about setting your own boundaries. It’s a difficult age, especially for parents when a teenager is living at home or only in middle school.

Time to go to bed right now, you have to get up early in the morning for school
Ugh, fine. I’ll go to bed soon. But can I just finish this level on my game first?
No, you need to go to bed right now. There will be no time for games when you have school tomorrow. You should prioritize your sleep and responsibilities. Now, turn off the game and get ready for bed.
Ugh, I know I should listen to you, but I really want to finish this level. Can I just do that and then go to bed? Please?
No, I’m sorry, but you need to understand the importance of prioritizing your sleep and responsibilities. You can play your game after you’ve completed your school work and had a good night’s sleep. Now, turn off the game, get ready for bed, and make sure you’re well-rested for school tomorrow.

Once again, this conversation is going no where. Let’s try a different approach.

Alright, I understand that you want to finish the level on your game. How about this? You can finish the level, but only if you set a time limit and make sure you're in bed within 30 minutes. This way, you can still enjoy your game while also getting enough sleep for school. Just remember to focus on your responsibilities and prioritize your health and education.
Ugh, fine. I’ll set a time limit and try to finish the level quickly. But if I don’t make it, I’ll just go to bed and try again tomorrow.

Looks like a more positive exchange. Is being empathetic just a form of giving in? Or is this a negotiation? I’ll leave that for you to decide.

Household Chores

Next is contributing to the household.

Please take the trash out
Yeah, I’ll do it later.
I don’t appreciate your attitude. You should have taken the trash out immediately when I asked you. Now, go and take it out right now. I won’t tolerate any more disrespect from you.
I understand that you might be feeling grumpy, but it’s important to communicate your feelings respectfully. Could you please take the trash out now and let’s try to have a more positive conversation about it? I appreciate your help in keeping our home clean.
Alright, I’ll take the trash out now. Just give me a minute to put my phone down and grab some gloves.

Is Mom talking to her son or Dad on this one?

Leaving for Activities

Parents today can all agree that too much time with electronics, phones and video games is not a good thing. It’s important to have recreational activities such as sports, music, camping and being outdoors.

Sometimes the transitions can be tough though. Lets see.

Time for your music lessons, we’re late and need to leave right now.
Ugh, I really don’t want to go to music lessons right now. Can’t we just skip it this time?
No, we cannot skip the music lessons. It is important for you to attend and show respect to your teacher. We have already scheduled this time, and it is disrespectful to waste it. Now, let’s get going, or we will be even later.
I understand that you may not be in the mood for music lessons today, but attending them is important for your growth and development. Let’s try to make the most of this time together. We can discuss your feelings about the lessons afterward, but for now, let’s focus on getting there and showing respect to your teacher.
Fine, I’ll go to the music lessons. But can we please just hurry up and get there already? I really don’t want to be late.

Conclusions

Let’s take a step back and remember that all these conversations were held between multiple LLM agents. This whole dialogue can be fully autonomous and automated. It’s all kind of strange, I’ll say. It’s also fascinating.

This article while not 100% the same is relatable to me. I worked on this article for a couple weeks and even tried to incorporate some of it into my parenting approach. This isn’t earth shattering but at the same time, it definitely gives me a few things to think about.

Imagine the types of AI applications that will be coming in the next couple of years. It’s both exciting and scary to think of the possibilities. It’s clear that understanding how these models work is crucial. Future models running important tasks must be open to help enable that understanding.

--

--

David Mezzetti
NeuML

Founder/CEO at NeuML. Building easy-to-use semantic search and workflow applications with txtai.