Xapagy might be able to tell you what happens next… (Image: John Lund/Getty)

“MY, WHAT a big mouth you have, Grandma,” says Little Red Riding Hood, with just a hint of suspicion. The wolf sneezes. “Bless you,” says the little girl.

Sound odd? That’s because this snippet of Little Red Riding Hood was written not by a person but by a piece of software called Xapagy. It may not seem like much, but it demonstrates a first step towards computers that can invent stories. It also signals a new approach to designing a more human-like artificial intelligence.

Lotzi Bölöni of the University of Central Florida first fed Xapagy stories, which had been manually translated into a language the system can understand. But instead of using these stories to build rigid logic rules for future actions, as most AI systems would, Xapagy keeps them just as they are – a series of interconnected events.


When it comes across words in new stories, it looks for familiar connections in its memory. If it finds any, it uses them to predict what will happen next and then tells the story. The trick is that each word can have many different associations in Xapagy’s memory, depending on the stories it has read. When it doesn’t find any clear connections, it just substitutes in its own word that makes grammatical sense, like the sneezing wolf, and continues the story in a way that makes narrative sense (arxiv.org/abs/1211.5643).

“The idea of an architecture based on narrative is clever,” says Stan Franklin of the University of Memphis, who developed the famous AI system LIDA. “It might lead to learning about narrative, an important topic in cognition.”

Xapagy works in a mix of English and a computer language called Xapi, which allows for easier communication between the two. The sentence, “My, what a big mouth you have Grandma” translates as “mouth – of – ‘Grandma’/ wh is-a / big?” in Xapi.

Currently, Bölöni must translate all material for Xapagy to learn by hand, a major bottleneck in giving it a big enough memory to be able to tell rich, interesting stories. Once it can build up a large enough back catalogue of stories, Bölöni expects Xapagy will be able to think up entirely new stories on its own.

AI researcher Andrew Nuxoll at the University of Portland in Oregon says Xapagy is “entirely unique”.

Most AI systems form rigid logical rules based on their observations of the world. This can be limiting, as it prevents robots and computers from tackling unfamiliar tasks. “If Bölöni is successful, it would result in a much more flexible way of learning,” Nuxoll says.

Bölöni’s work is a step towards human-like AI, Nuxoll adds. “I am confident that when we do create such a brain it will have a capacity to remember, learn and re-learn from its past.”