ҹ1000

Automatic authors: Making machines that tell tales

It's one of the toughest challenges in artificial intelligence: teaching a computer to understand us so well that it can write a story we'll want to hear
Automatic authors: Making machines that tell tales

“Teaching machines to tell stories is one of the toughest challenges in AI” (Image: Tom Gauld)

It’s one of the toughest challenges in artificial intelligence: teaching a computer to understand us so well that it can write a story we’ll want to hear

WHAT if there was a monkey who was afraid of bananas? What if there was a man who woke up as a dog but could still use his phone? What if there was a house without a door? The has an active imagination.

Much like us: we love to make things up. We tell stories to entertain, to share experiences and to make sense of things. As the author Philip Pullman put it, “After nourishment, shelter and companionship, stories are the thing we need most in the world.”

Soon, though, we won’t be the only ones doing it. Systems like the What-If Machine, developed by Teresa Llano and her colleagues, are being trained in the art of make-believe. The result could be machines that exhibit some of the most human-like AI yet seen. “We are not in the business of making artificial humans, but of making computers that can better understand and interact with humans,” says at University College Dublin, Ireland, who is also involved in the What-If Machine project. “We love stories, so we need our computers to adapt to this need.”

To do so, computers will need to see the world as we do – a giant leap for machine intelligence. No wonder many consider it to be one of the toughest challenges in AI. But we’re getting there. The pay-off could not only be new ways of enjoying stories, but new ways of making sense of the world.

“Teaching machines to tell stories is considered one of the toughest challenges in AI”

Telling tales isn’t easy. You have to pretend things are other than they are. There are characters and motivations to untangle. Then there’s a narrative to bind it all together. And, crucially, a good story needs to sit somewhere between dull and utterly implausible. “Story generation pushes against some of the greatest problems in computer science,” says , who like Llano is at Goldsmiths, University of London. “There’s everything from choosing the best character to give the optimum viewpoint for the story, down to the nuts and bolts of generating individual sentences and natural-sounding language.”

Early work on AI story generation in the 1970s focused on the problem of cause and effect in stringing together a narrative (see interactive timeline). One early, influential program was at the University of California, Irvine. The software generated stories involving animals, in the vein of Aesop’s fables. A human user gave each character a goal and a library of plans through which to achieve it. If the user chose the correct mix of goals and plans, the characters behaved in such a way that a narrative emerged.

These systems were hit-and-miss, though. A key advance came with the introduction of overriding authorial goals that guided the characters’ actions to a desired conclusion. Instead of acting independently, the characters could now be made to coordinate their actions to ensure they all ended up living happily ever after – or not, as the case may be. But too much coordination produces unsatisfying and unrealistic stories. “The characters appear to be working together to bring about an author’s goal,” says , whose work on storytelling AI is supported by organisations as diverse as Disney and the US defence agency, DARPA. In his systems, such as one called , Riedl models motivations for each character to avoid the appearance of collusion in their behaviour.

Another problem with early systems was their reliance on hand-coded knowledge, which restricted the scope of their ostensible imagination. That’s where the new wave of storytellers is rapidly advancing. For example, Riedl’s latest system, Scheherazade, learns by asking questions. “When the AI recognises that it doesn’t know how to do something – such as how to make two characters meet at a restaurant – it posts a question to the internet,” says Riedl. Humans on crowd-sourcing platforms like Amazon’s Mechanical Turk provide written examples of things that can happen in different scenarios, such as a first date or a bank robbery. The system learns about new situations from these examples, which it then weaves into stories (see “Sheherazade writes …“).

Rise of the fiction factories

Asking the right questions is key. There’s more to a good story than just a blow-by-blow account of events, or course. Enjoyment often comes from an unexpected spin on the mundane. “How do we teach an AI that a kettle can be used as a weapon, even though it’s almost never used that way?” asks Cook. “Understanding what properties objects have or what cultural meaning they might possess is crucial. It enables a storyteller to be inventive, creative and surprising.”

“How do we teach an AI that a kettle can be used as a weapon?”

Even if an AI were able to display a competent grasp of the myriad different systems and meanings that exist, there is still the challenge of how to make something up. One trick used by the What-If Machine, for example, is to invert things it knows about the world. Monkeys like bananas. What if they were afraid of them instead? Houses have doors. What if they didn’t?

To judge whether an invention is new, though, an AI needs to compared it to what already exists. “Let’s say you’ve come up with the idea of a bear that is also a piece of furniture and you want to know if this revolutionary bear-chair hybrid is a novel idea,” says Cook. So you look at all the types of bear and furniture you know of and see if there’s any overlap. But an AI’s judgment of novelty is only as good as the database of information from which it draws. “An AI might think up an exciting new animal,” says Cook: “A bird that can’t fly!” If all the examples of birds it knows about can fly, this should rank highly on its novelty scale. “But when we add penguins to the database the idea isn’t as novel any more,” he says.

Again, learning from humans can help. But there’s more to make-believe than bear chairs and flightless birds. For Riedl, much of what makes a story interesting is whether or not the related events are unexpected. A story about a bank robbery in which everything happens as we might expect is unlikely to wow anyone. “Narrative psychologists often say that a story is only worth telling when there is a breach of convention,” says Riedl.

But breaking convention goes against much work in the field. Most AI systems are designed not to violate the rules of the world, says Riedl. And for good reason. “We don’t want a driverless car making up new rules.”

Nor is it a matter of breaking just any old rule. Some breaches of convention are trivial, others nonsensical. Machines do not necessarily know when breaking a rule will be beneficial or harmful, says Riedl. “An AI has to master the typical before it can start to reason about what is atypical.”

One way to release computers from this trap is to teach them about metaphor. “Metaphor is a cognitive lever that allows humans to project and magnify their knowledge of one domain into another,” says Veale. For example, saying “life is a game” expands our concept of “life”. To give computers similar leverage, Veale has created Metaphor Magnet, a program that learns from common metaphors in Google-cached texts. Using a thesaurus, it then unpacks the concepts in the metaphor to find new ones.

Teacher to drug dealer

By analysing opposing concepts as well as related ones, Metaphor Magnet can also help deliver character arcs in a story. Take the Breaking Bad TV series, in which the main character evolves from a father and teacher into a drug dealer and criminal kingpin. The contrast between the character’s roles at the start of the story and those at the end leads to a compelling narrative.

To generate similar arcs, Metaphor Magnet first identifies a pair of opposing concepts such as “cute” and “dreaded”. It then looks for roles that these concepts can be applied to – “cute clowns” and “dreaded wizards”, say. Using a little knowledge of the world, these are then strung together into a plausible transition, providing the seed for a story: what leads cute clowns to retire from circuses, to study necromancy and to become dreaded wizards?

“A story about a CEO who becomes chairman of a company is filled with plausible similarity, as CEOs are very similar to chairpersons,” says Veale. “But where is the tension? A story about an arrogant CEO who loses everything and becomes a bum? Now that’s interesting.”

Working out what makes a good character arc is partly a matter of understanding suspense. Riedl’s team has built a model that correlates suspense with the likelihood that a plan to get a character out of trouble will be successful. This lets Riedl’s system evaluate the level of suspense in a plot. His team is building it into their story generator.

“There is no ideal algorithm,” says Riedl. But the pieces of the puzzle are coming together. So what will we do with these systems? One practical use could be to generate stories that are too large for humans to maintain. Soon after Facebook acquired the virtual reality firm Oculus Rift, for example, it stated that it wants to build the first billion-user online role-playing game. “Virtual worlds must be populated with interesting characters doing interesting things,” says Riedl. “If a world becomes big enough, it is no longer feasible for human game designers to hand-author characters, storylines and quests.”

Future story-generating systems promise to be more than just fiction factories, though. Machines that tell stories will also understand how our world works, says Veale. “Our computers may surprise us, entertain us, provoke debate, reveal the possibilities of change, highlight contradictions and ironies, and generally prompt us to engage more on an intellectual level.”

Riedl also believes that an AI that can master the basics of storytelling would be useful for factual analysis. “AI investigative journalism can theoretically benefit from fictional-story generation by creating hypotheses for things that happened in the real world and then seeking additional facts to confirm or refute those hypotheses,” he says. “For example, hypothetical stories about what might have happened to a missing aircraft could guide the investigative process.”

What might we lose by handing over something so human? For Cook, a future in which an AI is able to tell a story won’t rob us of anything. Quite the opposite, in fact. “AI has a major role to play in democratising creativity and lowering barriers of entry for people,” he says. “If an AI can write a story, it can co-write or critique a story, and that means it can act as an assistant to people who want to write themselves but don’t know where to start, or who struggle with some aspect of it.” Cook points to spell and grammar checkers as examples of where computers could offer better help. “Right now, that’s a lousy level of involvement,” he says. “We want to build software that can be a mentor, a muse and an audience all at once.”

“An AI can assist people who want to write themselves but don’t know where to start”

Sheherazade writes…

Mark Riedl at the Georgia Institute of Technology and his colleagues have created Sheherazade, a storytelling AI that learns about social scenarios via the internet. Here is an excerpt from a …

With sweaty palms and heart racing, John drove to Sally’s house for their first date. Sally, her pretty white dress flowing in the wind, carefully entered John’s car. John and Sally drove to the movie theatre. John and Sally parked the car in the parking lot. Wanting to feel prepared, John had already bought tickets to the movie in advance. A pale-faced usher stood before the door; John showed the tickets and the couple entered. Sally was thirsty so John hurried to buy drinks before the movie started. John and Sally found two good seats near the back. John sat down and raised the arm rest so that he and Sally could snuggle. John paid more attention to Sally while the movie rolled and nervously sipped his drink. Finally working up the courage to do so, John extended his arm to embrace Sally. He was relieved and ecstatic to feel her move closer to him in response. Sally stood up to use the restroom during the movie, smiling coyly at John before that exit.

Breaking news: bots get the scoop

At 6. 28 am on 17 March 2014 the Los Angeles Times published a story about an earthquake that had shaken California only 3 minutes earlier. The prose was informative but plain: “A shallow magnitude 4.7 earthquake was reported Monday morning five miles from Westwood, California, according to the US Geological Survey. The tremblor occurred at 6.25 am Pacific time at a depth of 5.0 miles.” The report appeared with the byline of Ken Schwencke, a journalist and programmer for the paper. But the credit ought have gone to Schwencke’s computer, which wrote the story without human input.

Not that readers would necessarily have noticed. Earlier that month, asked 46 of his students to read one of two reports on an NFL American Football game and assess the quality and credibility of the article they read. Unknown to the students, one of the reports had been produced by a Los Angeles Times journalist, the other by a piece of software. Of the 27 people that read the computer-generated recap, nearly half believed it had been written by a human.

Quick-fire, fact-based computer-generated journalistic reports are already here and will probably become increasingly prevalent because news stories, with their bald presentation of the facts lend themselves to automatic generation.

Creative writing is another matter. Whole stories can be told using the human connotations of everyday objects. Take Hemingway’s six-word tragedy: “Baby shoes for sale, never worn”. This goes far beyond news reports, demanding an intimate knowledge of the world (see main story).

Topics: Artificial intelligence / Books and art / Brains / Psychology