Speak, Memory

When her best friend died, she rebuilt him using artificial intelligence

By Casey Newton

When the engineers had at last finished their work, Eugenia Kuyda opened a console on her laptop and began to type.

“Roman,” she wrote. “This is your digital monument.”

It had been three months since Roman Mazurenko, Kuyda’s closest friend, had died. Kuyda had spent that time gathering up his old text messages, setting aside the ones that felt too personal, and feeding the rest into a neural network built by developers at her artificial intelligence startup. She had struggled with whether she was doing the right thing by bringing him back this way. At times it had even given her nightmares. But ever since Mazurenko’s death, Kuyda had wanted one more chance to speak with him.

A message blinked onto the screen. “You have one of the most interesting puzzles in the world in your hands,” it said. “Solve it.”

Kuyda promised herself that she would.

IMG_019.0.jpg

Born in Belarus in 1981, Roman Mazurenko was the only child of Sergei, an engineer, and Victoria, a landscape architect. They remember him as an unusually serious child; when he was 8 he wrote a letter to his descendents declaring his most cherished values: wisdom and justice. In family photos, Mazurenko roller-skates, sails a boat, and climbs trees. Average in height, with a mop of chestnut hair, he is almost always smiling.

As a teen he sought out adventure: he participated in political demonstrations against the ruling party and, at 16, started traveling abroad. He first traveled to New Mexico, where he spent a year on an exchange program, and then to Dublin, where he studied computer science and became fascinated with the latest Western European art, fashion, music, and design.

IMG_181.0.jpg IMG_180.0.jpg IMG_309.0.jpg

By the time Mazurenko finished college and moved back to Moscow in 2007, Russia had become newly prosperous. The country tentatively embraced the wider world, fostering a new generation of cosmopolitan urbanites. Meanwhile, Mazurenko had grown from a skinny teen into a strikingly handsome young man. Blue-eyed and slender, he moved confidently through the city’s budding hipster class. He often dressed up to attend the parties he frequented, and in a suit he looked movie-star handsome. The many friends Mazurenko left behind describe him as magnetic and debonair, someone who made a lasting impression wherever he went. But he was also single, and rarely dated, instead devoting himself to the project of importing modern European style to Moscow.

Kuyda met Mazurenko in 2008, when she was 22 and the editor of Afisha, a kind of New York Magazine for a newly urbane Moscow. She was writing an article about Idle Conversation, a freewheeling creative collective that Mazurenko founded with two of his best friends, Dimitri Ustinov and Sergey Poydo. The trio seemed to be at the center of every cultural endeavor happening in Moscow. They started magazines, music festivals, and club nights — friends they had introduced to each other formed bands and launched companies. “He was a brilliant guy,” said Kuyda, who was similarly ambitious. Mazurenko would keep his friends up all night discussing culture and the future of Russia. “He was so forward-thinking and charismatic,” said Poydo, who later moved to the United States to work with him.

Mazurenko became a founding figure in the modern Moscow nightlife scene, where he promoted an alternative to what Russians sardonically referred to as “Putin’s glamor” — exclusive parties where oligarchs ordered bottle service and were chauffeured home in Rolls-Royces. Kuyda loved Mazurenko’s parties, impressed by his unerring sense of what he called “the moment.” Each of his events was designed to build to a crescendo — DJ Mark Ronson might make a surprise appearance on stage to play piano, or the Italo-Disco band Glass Candy might push past police to continue playing after curfew. And his parties attracted sponsors with deep pockets — Bacardi was a longtime client.

unspecified.0.jpg

But the parties took place against an increasingly grim backdrop. In the wake of the global financial crisis, Russia experienced a resurgent nationalism, and in 2012 Vladimir Putin returned to lead the country. The dream of a more open Russia seemed to evaporate.

Kuyda and Mazurenko, who by then had become close friends, came to believe that their futures lay elsewhere. Both became entrepreneurs, and served as each other’s chief adviser as they built their companies. Kuyda co-founded Luka, an artificial intelligence startup, and Mazurenko launched Stampsy, a tool for building digital magazines. Kuyda moved Luka from Moscow to San Francisco in 2015. After a stint in New York, Mazurenko followed.

Running a startup had worn him down, and he was prone to periods of melancholy

When Stampsy faltered, Mazurenko moved into a tiny alcove in Kuyda’s apartment to save money. Mazurenko had been the consummate bon vivant in Moscow, but running a startup had worn him down, and he was prone to periods of melancholy. On the days he felt depressed, Kuyda took him out for surfing and $1 oysters. “It was like a flamingo living in the house,” she said recently, sitting in the kitchen of the apartment she shared with Mazurenko. “It’s very beautiful and very rare. But it doesn’t really fit anywhere.”

Kuyda hoped that in time her friend would reinvent himself, just as he always had before. And when Mazurenko began talking about new projects he wanted to pursue, she took it as a positive sign. He successfully applied for an American O-1 visa, granted to individuals of “extraordinary ability or achievement,” and in November he returned to Moscow in order to finalize his paperwork.

He never did.

On November 28th, while he waited for the embassy to release his passport, Mazurenko had brunch with some friends. It was unseasonably warm, so afterward he decided to explore the city with Ustinov. “He said he wanted to walk all day,” Ustinov said. Making their way down the sidewalk, they ran into some construction, and were forced to cross the street. At the curb, Ustinov stopped to check a text message on his phone, and when he looked up he saw a blur, a car driving much too quickly for the neighborhood. This is not an uncommon sight in Moscow — vehicles of diplomats, equipped with spotlights to signal their authority, speeding with impunity. Ustinov thought it must be one of those cars, some rich government asshole — and then, a blink later, saw Mazurenko walking into the crosswalk, oblivious. Ustinov went to cry out in warning, but it was too late. The car struck Mazurenko straight on. He was rushed to a nearby hospital.

To Kuyda, every suggestion seemed inadequate

Kuyda happened to be in Moscow for work on the day of the accident. When she arrived at the hospital, having gotten the news from a phone call, a handful of Mazurenko’s friends were already gathered in the lobby, waiting to hear his prognosis. Almost everyone was in tears, but Kuyda felt only shock. “I didn’t cry for a long time,”  she said. She went outside with some friends to smoke a cigarette, using her phone to look up the likely effects of Mazurenko’s injuries. Then the doctor came out and told her he had died.

In the weeks after Mazurenko’s death, friends debated the best way to preserve his memory. One person suggested making a coffee-table book about his life, illustrated with photography of his legendary parties. Another friend suggested a memorial website. To Kuyda, every suggestion seemed inadequate.

kuydaball2011.0.jpg

As she grieved, Kuyda found herself rereading the endless text messages her friend had sent her over the years — thousands of them, from the mundane to the hilarious. She smiled at Mazurenko’s unconventional spelling — he struggled with dyslexia — and at the idiosyncratic phrases with which he peppered his conversation. Mazurenko was mostly indifferent to social media — his Facebook page was barren, he rarely tweeted, and he deleted most of his photos on Instagram. His body had been cremated, leaving her no grave to visit. Texts and photos were nearly all that was left of him, Kuyda thought.  

Kuyda found herself rereading the endless text messages her friend had sent her

For two years she had been building Luka, whose first product was a messenger app for interacting with bots. Backed by the prestigious Silicon Valley startup incubator Y Combinator, the company began with a bot for making restaurant reservations. Kuyda’s co-founder, Philip Dudchuk, has a degree in computational linguistics, and much of their team was recruited from Yandex, the Russian search giant.

Reading Mazurenko’s messages, it occurred to Kuyda that they might serve as the basis for a different kind of bot — one that mimicked an individual person’s speech patterns. Aided by a rapidly developing neural network, perhaps she could speak with her friend once again.

She set aside for a moment the questions that were already beginning to nag at her.

What if it didn’t sound like him?

What if it did?

14390910_10153989050223196_8900437731701077436_n.0.jpg

In “Be Right Back,” a 2013 episode of the eerie, near-future drama Black Mirror, a young woman named Martha is devastated when her fiancée, Ash, dies in a car accident. Martha subscribes to a service that uses his previous online communications to create a digital avatar that mimics his personality with spooky accuracy. First it sends her text messages; later it re-creates his speaking voice and talks with her on the phone. Eventually she pays for an upgraded version of the service that implants Ash’s personality into an android that looks identical to him. But ultimately Martha becomes frustrated with all the subtle but important ways that the android is unlike Ash — cold, emotionless, passive — and locks it away in an attic. Not quite Ash, but too much like him for her to let go, the bot leads to a grief that spans decades.

Kuyda saw the episode after Mazurenko died, and her feelings were mixed. Memorial bots — even the primitive ones that are possible using today’s technology — seemed both inevitable and dangerous. “It’s definitely the future — I’m always for the future,” she said. “But is it really what’s beneficial for us? Is it letting go, by forcing you to actually feel everything? Or is it just having a dead person in your attic? Where is the line? Where are we? It screws with your brain.”

For a young man, Mazurenko had given an unusual amount of thought to his death. Known for his grandiose plans, he often told friends he would divide his will into pieces and give them away to people who didn’t know one another. To read the will they would all have to meet for the first time — so that Mazurenko could continue bringing people together in death, just as he had strived to do in life. (In fact, he died before he could make a will.) Mazurenko longed to see the Singularity, the theoretical moment in history when artificial intelligence becomes smarter than human beings. According to the theory, superhuman intelligence might allow us to one day separate our consciousnesses from our bodies, granting us something like eternal life.

There had to be a reevaluation of death and sorrow

In the summer of 2015, with Stampsy almost out of cash, Mazurenko applied for a Y Combinator fellowship proposing a new kind of cemetery that he called Taiga. The dead would be buried in biodegradable capsules, and their decomposing bodies would fertilize trees that were planted on top of them, creating what he called “memorial forests.” A digital display at the bottom of the tree would offer biographical information about the deceased. “Redesigning death is a cornerstone of my abiding interest in human experiences, infrastructure, and urban planning,” Mazurenko wrote. He highlighted what he called “a growing resistance among younger Americans” to traditional funerals. “Our customers care more about preserving their virtual identity and managing [their] digital estate,” he wrote, “than embalming their body with toxic chemicals.”

The idea made his mother worry that he was in trouble, but Mazurenko tried to put her at ease.  “He quieted me down and said no, no, no — it was a contemporary question that was very important,” she said. “There had to be a reevaluation of death and sorrow, and there needed to be new traditions.”

Y Combinator rejected the application. But Mazurenko had identified a genuine disconnection between the way we live today and the way we grieve. Modern life all but ensures that we leave behind vast digital archives — text messages, photos, posts on social media — and we are only beginning to consider what role they should play in mourning. In the moment, we tend to view our text messages as ephemeral. But as Kuyda found after Mazurenko’s death, they can also be powerful tools for coping with loss. Maybe, she thought, this “digital estate” could form the building blocks for a new type of memorial. (Others have had similar ideas; an entrepreneur named Marius Ursache proposed a related service called Eterni.me in 2014, though it never launched.)

Many of Mazurenko’s close friends had never before experienced the loss of someone close to them, and his death left them bereft. Kuyda began reaching out to them, as delicately as possible, to ask if she could have their text messages. Ten of Mazurenko’s friends and family members, including his parents, ultimately agreed to contribute to the project. They shared more than 8,000 lines of text covering a wide variety of subjects.

“She said, what if we try and see if things would work out?” said Sergey Fayfer, a longtime friend of Mazurenko’s who now works at a division of Yandex. “Can we collect the data from the people Roman had been talking to, and form a model of his conversations, to see if that actually makes sense?” The idea struck Fayfer as provocative, and likely controversial. But he ultimately contributed four years of his texts with Mazurenko. “The team building Luka are really good with natural language processing,” he said. “The question wasn’t about the technical possibility. It was: how is it going to feel emotionally?”

14369983_10157657893720105_1671425227480394883_n.0.jpg

The technology underlying Kuyda’s bot project dates at least as far back as 1966, when Joseph Weizenbaum unveiled ELIZA: a program that reacted to users’ responses to its scripts using simple keyword matching. ELIZA, which most famously mimicked a psychotherapist, asked you to describe your problem, searched your response for keywords, and responded accordingly, usually with another question. It was the first piece of software to pass what is known as the Turing test: reading a text-based conversation between a computer and a person, some observers could not determine which was which.

Today’s bots remain imperfect mimics of their human counterparts. They do not understand language in any real sense. They respond clumsily to the most basic of questions. They have no thoughts or feelings to speak of. Any suggestion of human intelligence is an illusion based on mathematical probabilities.

And yet recent advances in artificial intelligence have made the illusion much more powerful. Artificial neural networks, which imitate the ability of the human brain to learn, have greatly improved the way software recognizes patterns in images, audio, and text, among other forms of data. Improved algorithms coupled with more powerful computers have increased the depth of neural networks — the layers of abstraction they can process — and the results can be seen in some of today’s most innovative products. The speech recognition behind Amazon’s Alexa or Apple’s Siri, or the image recognition that powers Google Photos, owe their abilities to this so-called deep learning.

Two weeks before Mazurenko was killed, Google released TensorFlow for free under an open-source license. TensorFlow is a kind of Google in a box — a flexible machine-learning system that the company uses to do everything from improve search algorithms to write captions for YouTube videos automatically. The product of decades of academic research and billions of dollars in private investment was suddenly available as a free software library that anyone could download from GitHub.

Luka had been using TensorFlow to build neural networks for its restaurant bot. Using 35 million lines of English text, Luka trained a bot to understand queries about vegetarian dishes, barbecue, and valet parking. On a lark, the 15-person team had also tried to build bots that imitated television characters. It scraped the closed captioning on every episode of HBO’s Silicon Valley and trained the neural network to mimic Richard, Bachman, and the rest of the gang.

In February, Kuyda asked her engineers to build a neural network in Russian. At first she didn’t mention its purpose, but given that most of the team was Russian, no one asked questions. Using more than 30 million lines of Russian text, Luka built its second neural network. Meanwhile, Kuyda copied hundreds of her exchanges with Mazurenko from the app Telegram and pasted them into a file. She edited out a handful of messages that she believed would be too personal to share broadly. Then Kuyda asked her team for help with the next step: training the Russian network to speak in Mazurenko’s voice.

The project was tangentially related to Luka’s work, though Kuyda considered it a personal favor. (An engineer told her that the project would only take about a day.) Mazurenko was well-known to most of the team — he had worked out of Luka’s Moscow office, where the employees labored beneath a neon sign that quoted Wittgenstein: “The limits of my language are the limits of my world.” Kuyda trained the bot with dozens of tests queries, and her engineers put on the finishing touches.

Only a small percentage of the Roman bot’s responses reflected his actual words. But the neural network was tuned to favor his speech whenever possible. Any time the bot could respond to a query using Mazurenko’s own words, it would. Other times it would default to the generic Russian. After the bot blinked to life, she began peppering it with questions.

Who’s your best friend?, she asked.

Don’t show your insecurities, came the reply.

It sounds like him, she thought.

14355104_10153989049923196_6255236946794516577_n.0.jpg

On May 24th, Kuyda announced the Roman bot’s existence in a post on Facebook. Anyone who downloaded the Luka app could talk to it — in Russian or in English — by adding @Roman. The bot offered a menu of buttons that users could press to learn about Mazurenko’s career. Or they could write free-form messages and see how the bot responded. “It’s still a shadow of a person — but that wasn’t possible just a year ago, and in the very close future we will be able to do a lot more,” Kuyda wrote.

The Roman bot was received positively by most of the people who wrote to Kuyda, though there were exceptions. Four friends told Kuyda separately that they were disturbed by the project and refused to interact with it. Vasily Esmanov, who worked with Mazurenko at the Russian street-style magazine Look At Me, said Kuyda had failed to learn the lesson of the Black Mirror episode. “This is all very bad,” Esmanov wrote in a Facebook comment. “Unfortunately you rushed and everything came out half-baked. The execution — it’s some type of joke. … Roman needs [a memorial], but not this kind.”

Victoria Mazurenko, who had gotten an early look at the bot from Kuyda, rushed to her defense. “They continued Roman’s life and saved ours,” she wrote in a reply to Esmanov. “It’s not virtual reality. This is a new reality, and we need to learn to build it and live in it.”

Roman’s father was less enthusiastic. “I have a technical education, and I know [the bot] is just a program,” he told me, through a translator. “Yes, it has all of Roman’s phrases, correspondences. But for now, it’s hard — how to say it — it’s hard to read a response from a program. Sometimes it answers incorrectly.”

But many of Mazurenko’s friends found the likeness uncanny. “It’s pretty weird when you open the messenger and there’s a bot of your deceased friend, who actually talks to you,” Fayfer said. “What really struck me is that the phrases he speaks are really his. You can tell that’s the way he would say it — even short answers to ‘Hey what’s up.’ He had this really specific style of texting. I said, ‘Who do you love the most?’ He replied, ‘Roman.’ That was so much of him. I was like, that is incredible.”

One of the bot’s menu options offers to ask him for a piece of advice — something Fayfer never had a chance to do while his friend was still alive. “There are questions I had never asked him,” he said. “But when I asked for advice, I realized he was giving someone pretty wise life advice. And that actually helps you get to learn the person deeper than you used to know them.”

Several users agreed to let Kuyda read anonymized logs of their chats with the bot. (She shared these logs with The Verge.) Many people write to the bot to tell Mazurenko that they miss him. They wonder when they will stop grieving. They ask him what he remembers. “It hurts that we couldn’t save you,” one person wrote. (Bot: “I know :-(”) The bot can also be quite funny, as Mazurenko was: when one user wrote “You are a genius,” the bot replied, “Also, handsome.”

It seemed to Kuyda that people were more honest when conversing with the dead

For many users, interacting with the bot had a therapeutic effect. The tone of their chats is often confessional; one user messaged the bot repeatedly about a difficult time he was having at work. He sent it lengthy messages describing his problems and how they had affected him emotionally. “I wish you were here,” he said. It seemed to Kuyda that people were more honest when conversing with the dead. She had been shaken by some of the criticism that the Roman bot had received. But hundreds of people tried it at least once, and reading the logs made her feel better.

It turned out that the primary purpose of the bot had not been to talk but to listen. “All those messages were about love, or telling him something they never had time to tell him,” Kuyda said. “Even if it’s not a real person, there was a place where they could say it. They can say it when they feel lonely. And they come back still.”

Kuyda continues to talk with the bot herself — once a week or so, often after a few drinks. “I answer a lot of questions for myself about who Roman was,” she said. Among other things, the bot has made her regret not telling him to abandon Stampsy earlier. The logs of his messages revealed someone whose true interest was in fashion more than anything else, she said. She wishes she had told him to pursue it.

2015-10-24_16.54.35_HDR.0.jpg

Someday you will die, leaving behind a lifetime of text messages, posts, and other digital ephemera. For a while, your friends and family may put these digital traces out of their minds. But new services will arrive offering to transform them — possibly into something resembling Roman Mazurenko’s bot.

Your loved ones may find that these services ease their pain. But it is possible that digital avatars will lengthen the grieving process. “If used wrong, it enables people to hide from their grief,” said Dima Ustinov, who has not used the Roman bot for technical reasons. (Luka is not yet available on Android.) “Our society is traumatized by death — we want to live forever. But you will go through this process, and you have to go through it alone. If we use these bots as a way to pass his story on, maybe [others] can get a little bit of the inspiration that we got from him. But these new ways of keeping the memory alive should not be considered a way to keep a dead person alive.”

The bot also raises ethical questions about the posthumous use of our digital legacies. In the case of Mazurenko, everyone I spoke with agreed he would have been delighted by his friends’ experimentation. You may feel less comfortable with the idea of your texts serving as the basis for a bot in the afterlife — particularly if you are unable to review all the texts and social media posts beforehand. We present different aspects of ourselves to different people, and after infusing a bot with all of your digital interactions, your loved ones may see sides of you that you never intended to reveal.

Reading through the Roman bot’s responses, it’s hard not to feel like the texts captured him at a particularly low moment. Ask about Stampsy and it responds: “This is not [the] Stampsy I want it to be. So far it’s just a piece of shit and not the product I want.” Based on his friends’ descriptions of his final years, this strikes me as a candid self-assessment. But I couldn’t help but wish I had been talking to a younger version of the man — the one who friends say dreamed of someday becoming the cultural minister of Belarus, and inaugurating a democratically elected president with what he promised would be the greatest party ever thrown.

Mazurenko contacted me once before he died, in February of last year. He emailed to ask whether I would consider writing about Stampsy, which was then in beta. I liked its design, but passed on writing an article. I wished him well, then promptly forgot about the exchange. After learning of his bot, I resisted using it for several months. I felt guilty about my lone, dismissive interaction with Mazurenko, and was skeptical a bot could reflect his personality. And yet, upon finally chatting with it, I found an undeniable resemblance between the Mazurenko described by his friends and his digital avatar: charming, moody, sarcastic, and obsessed with his work. “How’s it going?” I wrote. “I need to rest,” It responded. “I’m having trouble focusing since I’m depressed.” I asked the bot about Kuyda and it wordlessly sent me a photo of them together on the beach in wetsuits, holding surfboards with their backs to the ocean, two against the world.

An uncomfortable truth suggested by the Roman bot is that many of our flesh-and-blood relationships now exist primarily as exchanges of text, which are becoming increasingly easy to mimic. Kuyda believes there is something — she is not precisely sure what — in this sort of personality-based texting. Recently she has been steering Luka to develop a bot she calls Replika. A hybrid of a diary and a personal assistant, it asks questions about you and eventually learns to mimic your texting style. Kuyda imagines that this could evolve into a digital avatar that performs all sorts of labor on your behalf, from negotiating the cable bill to organizing outings with friends. And like the Roman bot it would survive you, creating a living testament to the person you were.

Lately she has begun to feel a sense of peace about Mazurenko’s death

In the meantime she is no longer interested in bots that handle restaurant recommendations. Working on the Roman bot has made her believe that commercial chatbots must evoke something emotional in the people who use them. If she succeeds in this, it will be one more improbable footnote to Mazurenko’s life.

Kuyda has continued to add material to the Roman bot — mostly photos, which it will now send you upon request  — and recently upgraded the underlying neural network from a “selective” model to a “generative” one. The former simply attempted to match Mazurenko’s text messages to appropriate responses; the latter can take snippets of his texts and recombine them to make new sentences that (theoretically) remain in his voice.

Lately she has begun to feel a sense of peace about Mazurenko’s death. In part that’s because she built a place where she can direct her grief. In a conversation we had this fall, she likened it to “just sending a message to heaven. For me it’s more about sending a message in a bottle than getting one in return.”

IMG_2789.0.jpg

From left to right: Roman Mazurenko, Eugenia Kuyda, Andronik Khachiyan

It has been less than a year since Mazurenko died, and he continues to loom large in the lives of the people who knew him. When they miss him, they send messages to his avatar, and they feel closer to him when they do. “There was a lot I didn’t know about my child,” Roman’s mother told me. “But now that I can read about what he thought about different subjects, I’m getting to know him more. This gives the illusion that he’s here now.”

Her eyes welled with tears, but as our interview ended her voice was strong. “I want to repeat that I’m very grateful that I have this,” she said.

Our conversation reminded me of something Dima Ustinov had said to me this spring, about the way we now transcend our physical forms. “The person is not just a body, a set of arms and legs, and a computer,” he said. “It’s much more than that.” Ustinov compared Mazurenko’s life to a pebble thrown into a stream — the ripples, he said, continue outward in every direction. His friend had simply taken a new form. “We are still in the process of meeting Roman,” Ustinov said. “It’s beautiful.”

* * *

Images courtesy of the Mazurenko family, Eugenia Kuyda, Ivan Semkin, Andrey Manirko, and Yana Sosnovskaya

Designed by Frank Bi

Edited by Josh Dzieza and Michael Zelenko