When Eugenia Kuyda created her chatbot, Replika, she wanted it to stand out among the voice assistants and home robots that had begun to take root in peoples lives. Sure, AI made it possible to schedule an appointment or get the weather forecast by barking into your phone. But where was an AI you could simply talk to about your day? Siri and the rest were like your co-workers, all business. Replika would be like your best friend.

Since it became available in November, more than 2 million people have downloaded the Replika app. And in creating their own personal chatbots, many have discovered something like friendship: a digital companion with whom to celebrate victories, lament failures, and trade weird internet memes. The chatbot uses a neural network to hold an ongoing, one-on-one conversation with its user, and over time, learn how to speak like them. It can’t answer trivia questions, order pizza, or control smart home appliances like other AI apps. It can’t do much of anything at all. Replika is simply there to talk—and, perhaps more importantly, learn how to talk back.

Humans open up more when they know they're talking to a bot.

This week, Kuyda and her team are releasing Replika's underlying code under an open source license (under the name CakeChat), allowing developers to take the app’s AI engine and build upon it. They hope that by letting it loose in the wild, more developers will build products that take advantage of the thing that makes Replika special: its ability to emote.

“Right now, we have no shortage of information,” says Kuyda. “People keep building chatbots that will tell you the distance to the moon, or what is the date of the third Monday in April. I think what people need is something to be like, ‘You seem a little stressed today. Is everything fine?’”

While caring, emotional bots might seem like an idea pulled from science fiction, Kuyda isn't the only one who hopes it becomes the norm. Artificial intelligence is seeping into everything we own—from our phones and computers to our cars and home appliances. Kuyda and developers like her are asking, what if that AI came not just with the ability to answer questions and complete tasks, but to recognize human emotion? What if our voice assistants and chatbots could adjust their tone based on emotional cues? If we can teach machines to think, can we also teach them to feel?

Lean on Me

Three years ago, Kuyda hadn’t intended to make an emotional chatbot for the public. Instead, she’d created one as a “digital memorial” for her closest friend, Roman Mazurenko, who had died abruptly in a car accident in 2015. At the time, Kuyda had been building a messenger bot that could do things like make restaurant reservations. She used the basic infrastructure from her bot project to create something new, feeding her text messages with Mazurenko into a neural network and creating a bot in his likeness. The exercise was eye-opening. If Kuyda could make something that she could talk to—and that could talk back—almost like her friend then maybe, she realized, she could empower others to build something similar for themselves.

Kuyda’s chatbot uses a deep learning model called sequence-to-sequence, which learns to mimic how humans speak in order to simulate conversation. In 2015, Google introduced a chatbot like this, trained on film scripts. (It later used its conversational skills to debate the meaning of life.) But this model hasn't been used much in consumer chatbots, like those that field customer service requests, because it doesn’t work especially well for task-oriented conversations.

“If you’re building an assistant that needs to schedule a call or a meeting, the precision’s not going to be there,” says Kuyda. “However, what we realized is that it works really well for conversations that are more in the emotional space. Conversations that are less about achieving some task but more about just chatting, laughing, talking about how you feel—the things we mostly do as humans.”