The notifications on Facebook come as unwelcome reminders of personal loss:

A recommendation to add a cousin’s dead son as a friend.

A video commemorating friendship with a sibling who died years ago.

A suggestion to wish a dead brother “Happy Birthday.”

While Facebook has emerged as a remarkable tool to preserve cherished memories of departed friends and family, it has also served up these and other troubling — and often unexpected — notifications.

On Tuesday, Facebook announced several changes aimed at easing users’ grief. The social media company is using artificial intelligence “to minimize experiences that might be painful,” Sheryl Sandberg, Facebook’s chief operating officer, said in a statement posted to the company’s website.

“We use AI to help keep it 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,” Ms. Sandberg said. “We’re working to get better and faster at this.”