杏吧原创

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

鈥淭eaching machines to tell stories is one of the toughest challenges in AI鈥 (Image: Tom Gauld)

It鈥檚 one of the toughest challenges in artificial intelligence: teaching a computer to understand us so well that it can write a story we鈥檒l 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, 鈥淎fter nourishment, shelter and companionship, stories are the thing we need most in the world.鈥

Soon, though, we won鈥檛 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. 鈥淲e 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. 鈥淲e 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鈥檙e getting there. The pay-off could not only be new ways of enjoying stories, but new ways of making sense of the world.

鈥淭eaching machines to tell stories is considered one of the toughest challenges in AI鈥

Telling tales isn鈥檛 easy. You have to pretend things are other than they are. There are characters and motivations to untangle. Then there鈥檚 a narrative to bind it all together. And, crucially, a good story needs to sit somewhere between dull and utterly implausible. 鈥淪tory generation pushes against some of the greatest problems in computer science,鈥 says , who like Llano is at Goldsmiths, University of London. 鈥淭here鈥檚 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鈥檚 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. 鈥淭he characters appear to be working together to bring about an author鈥檚 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鈥檚 where the new wave of storytellers is rapidly advancing. For example, Riedl鈥檚 latest system, Scheherazade, learns by asking questions. 鈥淲hen the AI recognises that it doesn鈥檛 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鈥檚 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鈥檚 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. 鈥淗ow do we teach an AI that a kettle can be used as a weapon, even though it鈥檚 almost never used that way?鈥 asks Cook. 鈥淯nderstanding what properties objects have or what cultural meaning they might possess is crucial. It enables a storyteller to be inventive, creative and surprising.鈥

鈥淗ow 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鈥檛?

To judge whether an invention is new, though, an AI needs to compared it to what already exists. 鈥淟et鈥檚 say you鈥檝e 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鈥檚 any overlap. But an AI鈥檚 judgment of novelty is only as good as the database of information from which it draws. 鈥淎n AI might think up an exciting new animal,鈥 says Cook: 鈥淎 bird that can鈥檛 fly!鈥 If all the examples of birds it knows about can fly, this should rank highly on its novelty scale. 鈥淏ut when we add penguins to the database the idea isn鈥檛 as novel any more,鈥 he says.

Again, learning from humans can help. But there鈥檚 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. 鈥淣arrative 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. 鈥淲e don鈥檛 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. 鈥淎n 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. 鈥淢etaphor is a cognitive lever that allows humans to project and magnify their knowledge of one domain into another,鈥 says Veale. For example, saying 鈥渓ife is a game鈥 expands our concept of 鈥渓ife鈥. 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鈥檚 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 鈥渃ute鈥 and 鈥渄readed鈥. It then looks for roles that these concepts can be applied to 鈥 鈥渃ute clowns鈥 and 鈥渄readed 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?

鈥淎 story about a CEO who becomes chairman of a company is filled with plausible similarity, as CEOs are very similar to chairpersons,鈥 says Veale. 鈥淏ut where is the tension? A story about an arrogant CEO who loses everything and becomes a bum? Now that鈥檚 interesting.鈥

Working out what makes a good character arc is partly a matter of understanding suspense. Riedl鈥檚 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鈥檚 system evaluate the level of suspense in a plot. His team is building it into their story generator.

鈥淭here 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. 鈥淰irtual worlds must be populated with interesting characters doing interesting things,鈥 says Riedl. 鈥淚f 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. 鈥淥ur 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. 鈥淎I 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. 鈥淔or 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鈥檛 rob us of anything. Quite the opposite, in fact. 鈥淎I has a major role to play in democratising creativity and lowering barriers of entry for people,鈥 he says. 鈥淚f 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鈥檛 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. 鈥淩ight now, that鈥檚 a lousy level of involvement,鈥 he says. 鈥淲e want to build software that can be a mentor, a muse and an audience all at once.鈥

鈥淎n AI can assist people who want to write themselves but don鈥檛 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鈥檚 house for their first date. Sally, her pretty white dress flowing in the wind, carefully entered John鈥檚 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: 鈥淎 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鈥檚 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鈥檚 six-word tragedy: 鈥淏aby 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