Evil clowns. Undead pets. Haunted hotels. New England-based horror writer Stephen King has been scaring us all for decades.

Now — just in time for Halloween — a team at the Massachusetts Institute of Technology is at the center of what might be the only tale that could scare the modern world’s most frightening writer.

They’ve created an artificial intelligence that can turn one of the internet’s most infamous online communities into an AI that turns snippets of text into spine-tingling stories.

Heeeeere’s Shelley.

“We’re interested in how AI induces emotions, fear in this particular case,” said Manuel Cebrian, a research scientist in the MIT Media Lab. “So Halloween is always a great time to roll out a mass-scale AI agent that tests our emotion-inducing capability.”

It’s Alive! AI Brings Infamous Reddit Horror Community to Life

Named after famed “Frankenstein” author Mary Shelley, the team’s concoction was trained on 140,000 horror stories from Reddit’s r/nosleep subreddit.

Shelley composes horror tales by starting with a random seed or short snippet of text. But what really sets it apart is the algorithm’s ability to learn from reader feedback.

Shelley starts new stories every hour on her Twitter feed , and any time a follower responds with a new sentence, it uses that contribution and all that came before it to determine a logical next sentence, steadily building a story in concert with her followers. A recent effort:

The budding writer is a GPU-powered combination of learning algorithm and multi-layer recurrent neural network running on NVIDIA GPUs for both training and inference.

Pinar Yanardag, a postdoctoral research associate in the MIT Media Lab, said Shelley would have remained a theoretical possibility without them. “Speed is a critical benefit that TITAN X GPUs provide to us (because) Shelley has to respond to Twitter users in a prompt manner.”

Why Researchers Care About a Good Scare

While Shelley is good spooky fun, the work has sharpened the team’s AI skills on other emotion-related fronts.

“We are working on several other deep-learning projects to be released in the next few months where we tackle how to induce emotions, such as empathy, through AI,” said Iyad Rahwan, an associate professor in the MIT Media Lab who worked on Shelley.

Down the line, the team sees its work on Shelley becoming a model for future content creation. It’d be a vast improvement to automated programs cranking out stories according to rigid formulas.

“This work can be applied to all creative genres of literature, including marketing and advertising,” said Cebrian. “Maybe the technology behind Shelley will help solve writer’s block forever, if fed with the author’s own data.”

Now there’s an objective Jack Torrance, the frustrated writer turned axe murderer in Stephen King’s “The Shining,” could really get behind.