Facebook has promised to use artificial intelligence to stop suggesting users invite their dead friends to parties.

The site’s freshly emotionally intelligent AI is part of a rash of changes to how Facebook handles “memorialised” accounts – pages whose owner has been reported deceased, but that are kept on the social network in their memory.

Memorialisation of accounts allows for treasured images, videos and posts to be kept online, as well as providing a focal point for grieving friends and relatives to share memories.

But the feature has caused its fair share of pain: since the account is kept on the social network and treated similarly to any other Facebook user, it is used for the same algorithmic features as anything else. That means users have been sent recommendations to invite dead relatives to parties, suggestions to wish them a happy birthday, and more.

Facebook said that should be a thing of the past. “Once an account is memorialised, we use AI to help keep the profile from showing up in places that might cause distress, like recommending that person be invited to events or sending a birthday reminder to their friends,” wrote Facebook’s chief operating officer, Sheryl Sandberg, in a blogpost published on Tuesday. “We’re working to get better and faster at this.” [See update below].

Alongside the AI, Sandberg announced other changes. Most notably, the company is introducing a “tribute” section, separating posts made after an account is memorialised from those made while the user was alive. It is also adding more powers to “legacy contacts”, nominated while the former user was still alive, allowing them to moderate the tribute section themselves.

Death of Facebook users is a tricky topic for the company. In 2014, it had to apologise after launching its first “Year in Review” feature, which automatically cut together cheery videos of highly engaged posts, after several clips included pictures of friends and relatives who had died over the year.

Eric Meyer, a web designer, wrote on his blog that Facebook had shown him a picture of his daughter, Rebecca, who died in 2014. “Yes, my year looked like that. True enough. My year looked like the now-absent face of my little girl. It was still unkind to remind me so forcefully,” he wrote in a post titled “Inadvertent Algorithmic Cruelty”.

More recently, Facebook lost a three-year court battle over access to the private messages of a 15-year-old girl who had been killed by a train at a Berlin station in 2012. Her mother wanted to see her messages to find out whether she was being bullied when she died, and eventually the German courts ruled social media accounts can be inherited in the same way as diaries and private letters.

Update added on 10 April 2019: After this story was published, Facebook edited Sandberg’s blogpost to alter the statement. The post now says that AI will be used, not to keep memorialised accounts from showing up in algorithmic features, but to keep accounts that haven’t been memorialised from doing so. “If an account hasn’t yet been memorialized, we use AI to help keep it from showing up in places that might cause distress,” Sandberg is now quoted as saying. In other words, Facebook’s AI is being deployed to work out which of its users are dead, rather than waiting to be told. The company also clarified that once an account is memorialised, it shouldn’t show up in algorithmic recommendations either before or after this change.