Полная версия
The Creativity Code: How AI is learning to write, paint and think
The emergence of the Romantic movement in music is in many ways a catalogue of rule breaking. Instead of moving between close key signatures as Classical composers had done, new upstarts like Schubert chose to shift key in ways that deliberately broke expectations. Schumann left chords unresolved that Haydn or Mozart would have felt the need to complete. Chopin in turn composed dense moments of chromatic runs and challenged rhythmic expectations with his unusual accented passages and bending of tempos. The move from one musical movement to another: from Medieval to Baroque to Classical to Romantic to Impressionist to Expressionist and beyond is a story of breaking the rules. Each movement is dependent on the one before to appreciate its creativity. It almost goes without saying that historical context plays an important role in allowing us to define something as new. Creativity is not an absolute but a relative activity. We are creative within our culture and frame of reference.
Can a computer initiate this kind of phase change and move us into a new musical or mathematical state? That seems a challenge. Algorithms learn how to act based on the data they interact with. Won’t this mean that they will always be condemned to producing more of the same?
As Picasso once said: ‘The chief enemy of creativity is good sense.’ That sounds on the face of it very much against the spirit of the machine. And yet you can program a system to behave irrationally. You can create a meta-rule that will instruct it to change course. As we shall see, this is in fact something machine learning is quite good at.
Can creativity be taught?
Many artists like to fuel their own creation myth, appealing to external forces as responsible for their creativity. In Ancient Greece poets were said to be possessed by the muses, who breathed inspiration into the minds of men, sometimes sending them insane in the process. For Plato ‘a poet is holy, and never able to compose until he has become inspired, and is beside himself and reason is no longer in him … for no art does he utter but by power divine’. Ramanujan, the great Indian mathematician, likewise attributed his great insights to ideas he received in his dreams from his family goddess Namagiri. Is creativity a form of madness or a gift of the divine?
One of my mathematical heroes, Carl Friedrich Gauss, was one of the worst at covering his creative tracks. Gauss is credited with creating modern number theory with the publication in 1798 of one of the great mathematical works of all time: Disquisitiones arithmeticae. When people tried to read the book to uncover where he got his ideas, they were mystified. The work has been described as a book of seven seals. Gauss seems to pull ideas like rabbits out of a hat, without ever really giving us an inkling of how he achieved this magic. Later, when challenged, he retorted that an architect does not leave up the scaffolding after the house is complete. Gauss, like Ramanujan, attributed one revelation to ‘the Grace of God’, saying he was ‘unable to name the nature of the thread which connected what I previously knew with that which made my success possible’.
Yet the fact that an artist may be unable to articulate where their ideas came from does not mean that they followed no rules. Art is a conscious expression of the myriad of logical gates that make up our unconscious thought processes. There was of course a thread of logic that connected Gauss’s thoughts: it was just hard for him to articulate what he was up to – or perhaps he wanted to preserve the mystery, to fuel his image as a creative genius. Coleridge’s claim that the drug-induced vision of Kubla Khan came to him in its entirety belies all the preparatory material that shows the poet working on the ideas before that fateful day when he was interrupted by the person from Porlock. Of course, this makes for a good story. Even my own account of creation will focus on the flash of inspiration rather than the years of preparatory work I put in.
We have an awful habit of romanticising creative genius. The solitary artist working in isolation is frankly a myth. In most instances what looks like a step change is actually a continuous growth. Brian Eno talks about the idea of ‘scenius’, not genius, to acknowledge the community out of which creative intelligence often emerges. The American writer Joyce Carol Oates agrees: ‘Creative work, like scientific work, should be greeted as a communal effort – an attempt by an individual to give voice to many voices, an attempt to synthesize and explore and analyze.’
What does it take to stimulate creativity? Might it be possible to program it into a machine? Are there rules we can follow to become creative? Can creativity, in other words, be a learned skill? Some would say that to teach or program is to show people how to imitate what has gone before, and that imitation and rule following are both incompatible with creativity. And yet we have examples of creative individuals all around us who have studied and learned and improved their skills. If we study what they do, could we imitate them and ultimately become creative ourselves?
These are questions I find myself asking every new semester. To receive their PhDs, doctoral candidates in mathematics have to create a new mathematical construct. They have to come up with something that has never been done before. I am tasked with teaching them how to do that. Of course, at some level they have been training to do this to a certain extent already. Solving problems involves personal creativity even if the answer is already known.
That training is an absolute prerequisite for the jump into the unknown. By rehearsing how others have come to their breakthroughs you hope to provide the environment to foster your own creativity. And yet that jump is far from guaranteed. I can’t take anyone off the street and teach them to be a creative mathematician. Maybe with ten years of training we could get there, but not every brain seems to be able to achieve mathematical creativity. Some people appear to be able to achieve creativity in one field but not another, yet it is difficult to understand what makes one brain a chess champion and another a Nobel Prize-winning novelist.
Margaret Boden recognises that creativity isn’t just about being Shakespeare or Einstein. She distinguishes between what she calls ‘psychological creativity’ and ‘historical creativity’. Many of us achieve acts of personal creativity that may be novel to us but historically old news. These are what Boden calls moments of psychological creativity. It is by repeated acts of personal creativity that ultimately one hopes to produce something that is recognised by others as new and of value. While historical creativity is rare, it emerges from encouraging psychological creativity.
My recipe for eliciting creativity in students follows the three modes of creativity Boden identified. Exploration is perhaps the most obvious path. First understand how we’ve come to the place we are now and then try to push the boundaries just a little bit further. This involves deep immersion in what we have created to date. Out of that deep understanding might emerge something never seen before. It is often important to impress on students that there isn’t very often some big bang that resounds with the act of creation. It is gradual. As Van Gogh wrote: ‘Great things are not done by impulse but by small things brought together.’
Boden’s second strategy, combinational creativity, is a powerful weapon, I find, in stimulating new ideas. I often encourage students to attend seminars and read papers in subjects that don’t appear to connect with the problem they are tackling. A line of thought from a disparate bit of the mathematical universe might resonate with the problem at hand and stimulate a new idea. Some of the most creative bits of science are happening today at the junctions between the disciplines. The more we can come out of our silos and share our ideas and problems, the more creative we are likely to be. This is where a lot of the low-hanging fruit is to be found.
At first sight transformational creativity seems hard to harness as a strategy. But again the goal is to test the status quo by dropping some of the constraints that have been put in place. Try seeing what happens if we change one of the basic rules we have accepted as part of the fabric of our subject. These are dangerous moments because you can collapse the system, but this brings me to one of the most important ingredients needed to foster creativity – and that is embracing failure.
Unless you are prepared to fail, you will not take the risks that will allow you to break out and create something new. This is why our education system and our business environment, both realms that abhor failure, are often terrible environments for fostering creativity. It is important to celebrate the failures as much as the successes in my students. Sure, the failures won’t make it into the PhD thesis, but we learn so much from failure. When I meet with my students I repeat again and again Beckett’s call to ‘Fail, fail again, fail better.’
Are these strategies that can be written into code? In the past the top-down approach to coding meant there was little prospect of creativity in the output of the code. Coders were never too surprised by what their algorithms produced. There was no room for experimentation or failure. But this all changed recently: because an algorithm, built on code that learns from its failures, did something that was new, shocked its creators, and had incredible value. This algorithm won a game that many believed was beyond the abilities of a machine to master. It was a game that required creativity to play.
It was news of this breakthrough that triggered my recent existential crisis as a mathematician.
3
READY, STEADY, GO
We construct and construct, but intuition is still a good thing.
Paul Klee
People often compare mathematics to playing chess. There certainly are connections, but when Deep Blue beat the best chessmaster the human race could offer in 1997, it did not lead to the closure of mathematics departments. Although chess is a good analogy for the formal quality of constructing a proof, there is another game that mathematicians have regarded as much closer to the creative and intuitive side of being a mathematician, and that is the Chinese game of Go.
I first discovered Go when I visited the mathematics department at Cambridge as an undergraduate to explore whether to do my PhD with the amazing group that had helped complete the classification of finite simple groups, a sort of Periodic Table of Symmetry. As I sat talking to John Conway and Simon Norton, two of the architects of this great project, about the future of mathematics, I kept being distracted by students at the next table furiously slamming black and white stones onto a large 19×19 grid carved into a wooden board.
Eventually I asked Conway what they were doing. ‘That’s Go. It’s the oldest game that is still being played to this day.’ In contrast to the war-like quality of chess, he explained, Go was a game of territory. Players take it in turn to place white and black pieces or stones onto the 19×19 grid. If you manage to surround a collection of your opponent’s stones with your own, you capture your opponent’s stones. The winner is the player who has captured the most stones by the end of the game. It sounded rather simple. The subtlety of the game, Conway explained, is that as you try to surround your opponent, you must avoid having your own stones captured.
‘It’s a bit like mathematics: simple rules that give rise to beautiful complexity.’ It was while watching the game evolve between two experts as they drank coffee in the common room that Conway discovered that the endgame was behaving like a new sort of number that he christened ‘surreal numbers’.
I’ve always been fascinated by games. Whenever I travel abroad I like to learn and bring back the game locals like to play. So when I got back from the wild outreaches of Cambridge to the safety of my home in Oxford I decided to buy Go from the local toy shop to see what it was that was obsessing these students. As I began to explore the game with one of my fellow students in Oxford, I realised how subtle it was. It was hard to identify a clear strategy that would help me win. And as more stones were laid down on the board, the game seemed to get more complicated, unlike chess, where as pieces are gradually removed the game starts to simplify.
The American Go Association estimates that it would take a number with 300 digits to count the number of games of Go that are legally possible. In chess the computer scientist Claude Shannon estimated that a number with 120 digits (now called the Shannon number) would suffice. These are not small numbers in either case, but they give you a sense of the wide range of possible permutations.
I had played a lot of chess as a kid. I enjoyed working through the logical consequences of a proposed move. It appealed to the mathematician that was growing inside me. The tree of possibilities in chess branches in a controlled manner, making it manageable for a computer and even a human to analyse the implications of going down different branches. In contrast Go just doesn’t seem like a game that would allow you to work out the logical implications of a future move. Navigating the tree of possibilities quickly becomes impossible. That’s not to say that a Go player doesn’t follow through the logical consequences of their next move, but this seems to be combined with a more intuitive feel for the pattern of play.
The human brain is acutely attuned to finding structure and pattern if there is one in a visual image. A Go player can look at the lie of the stones and tap into the brain’s ability to pick out these patterns and exploit them in planning the next move. Computers have traditionally always struggled with vision. It is one of the big hurdles that engineers have wrestled with for decades.
The human brain’s highly developed sense of visual structure has been honed over millions of years and has been key to our survival. Any animal’s ability to survive depends in part on its ability to pick out structure in the visual mess that Nature confronts us with. A pattern in the chaos of the jungle is likely to be evidence of the presence of another animal – and you’d better take notice cos that animal might eat you (or maybe you could eat it). The human code is extremely good at reading patterns, interpreting how they might develop, and responding appropriately. It is one of our key assets, and it plays into our appreciation for the patterns in music and art.
It turns out that pattern recognition is precisely what I do as a mathematician when I venture into the unexplored reaches of the mathematical jungle. I can’t rely on a simple step-by-step logical analysis of the local environment. That won’t get me very far. It has to be combined with an intuitive feel for what might be out there. That intuition is built up by time spent exploring the known space. But it is often hard to articulate logically why you might believe that there is interesting territory out there to explore. A conjecture in mathematics is by its nature not yet proved, but the mathematician who has made the conjecture has built up a feeling that the mathematical statement they have made may have some truth to it. Observation and intuition go hand in hand as we navigate the thickets and seek to carve out a new path.
A mathematician who can make a good conjecture will often garner more respect than one who joins up the logical dots to reveal the truth of the conjecture. In the game of Go the final winning position is in some respects the conjecture and the plays are the logical moves on your way to proving that conjecture. But it is devilishly hard to spot the patterns along the way.
And so, although chess has been useful to help explain some aspects of mathematics, the game of Go has always been held up as far closer in spirit to the way mathematicians actually go about their business. That’s why mathematicians weren’t too worried when Deep Blue beat the best humans could offer at chess. The real challenge was the game of Go. For decades people have been claiming that the game of Go can never be played by a computer. Like all good absolutes, it invited creative coders to test that proposition. But even a junior player appeared to be able to outplay even the most complex algorithms. And so mathematicians happily hid behind the cover that Go was providing them. If a computer couldn’t play Go then there was no chance it could play the even subtler and more ancient game of mathematics.
But just as the Great Wall of China was eventually breached, my defensive wall has just crumbled in spectacular fashion.
Game Boy extraordinaire
At the beginning of 2016 it was announced that a program had been created to play Go that its developers were confident could hold its own against the best humans had to offer. Go players around the world were extremely sceptical, given the failure of past efforts. So the company that developed the program offered a challenge. It set up a public contest with a huge prize and invited one of the world’s leading Go players to take up the challenge. An international champion, Lee Sedol from Korea, stepped forward. The competition would be played over five games with the winner taking home a prize of one million dollars. The name of Sedol’s challenger: AlphaGo.
AlphaGo is the brainchild of Demis Hassabis. Hassabis was born in London in 1976 to a Greek Cypriot father and a mother from Singapore. Both parents are teachers and what Hassabis describes as bohemian technophobes. His sister and brother went the creative route, one becoming a composer, the other choosing creative writing. So Hassabis isn’t quite sure where his geeky scientific side came from. But as a kid Hassabis was someone who quickly marked himself out as gifted and talented, especially when it came to playing games. His abilities at chess were such that at eleven he was the second-highest-ranked child of his age in the world.
But then at an international match in Liechtenstein that year Hassabis had an epiphany: what on earth were they all doing? The hall was full of so many great minds exploring the logical intricacies of this great game. And yet Hassabis suddenly recognised the total futility of such a project. In a radio interview on the BBC he admitted thinking at the time: ‘We were wasting our minds. What if we used that brain power for something more useful like solving cancer?’
His parents were pretty shocked when after the tournament (which he narrowly lost after battling for ten hours with the adult Dutch world champion) he announced that he was giving up chess competitions. Everyone had thought this was going to be his life. But those years playing chess weren’t wasted. A few years earlier he’d used the £200 prize money he’d won for beating a US opponent, Alex Chang, to buy his first computer: a ZX Spectrum. That computer sparked his obsession with getting machines to do the thinking for him.
Hassabis soon graduated on to a Commodore Amiga, which could be programmed to play the games he enjoyed. Chess was still too complicated, but he managed to program the Commodore to play Othello, a game that looks rather similar to Go with black and white stones that get flipped when they are trapped between stones of the opposite colour. It’s not a game that merits grandmasters, so he tried his program out on his younger brother. It beat him every time.
This was classic ‘if …, then …’ programming: he needed to code in by hand the response to each of his opponent’s moves. It was: ‘If your opponent plays that move, then reply with this move.’ The creativity all came from Hassabis and his ability to see what the right responses were to win the game. It still felt a bit like magic though. Code up the right spell and then, rather like the Sorcerer’s Apprentice, the Commodore would go through the work of winning the game.
Hassabis raced through school, culminating with an offer from Cambridge to study computer science at the age of sixteen. He’d set his heart on Cambridge after seeing Jeff Goldblum in the film The Race for the Double Helix. ‘I thought, is this what goes on at Cambridge? You go there and you invent DNA in the pub? Wow.’
Cambridge wouldn’t let him start his degree at the age of sixteen, so he had to defer for a year. To fill his time he won a place working for a game developer after having come second in a competition run by Amiga Power magazine. While he was there, he created his own game, Theme Park, where players had to build and run their own theme park. The game was hugely successful, selling several million copies and winning a Golden Joystick award. With enough funds to finance his time at university, Hassabis set off for Cambridge.
His course introduced him to the greats of the AI revolution: Alan Turing and his test for intelligence, Arthur Samuel and his program to play draughts, John McCarthy, who coined the term artificial intelligence, Frank Rosenblatt and his first experiments with neural networks. These were the shoulders on which Hassabis aspired to stand. It was while sitting in his lectures at Cambridge that he heard his professor repeating the mantra that a computer could never play Go because of the game’s creative and intuitive characteristics. This was like a red rag to the young Hassabis. He left Cambridge determined to prove his professor wrong.
His idea was that rather than trying to write a program himself that could play Go, he would write a meta-program that would be responsible for writing the program that would play Go. It sounded a crazy idea, but the point was that the meta-program would be created so that as the Go-playing program played more and more games it would learn from its mistakes.
Hassabis had learned about a similar idea implemented by the artificial-intelligence researcher Donald Michie in the 1960s. Michie had written an algorithm called ‘MENACE’ that learned from scratch the best strategy to play noughts and crosses. (MENACE stood for Machine Educable Noughts And Crosses Engine.) To demonstrate the algorithm, Michie had rigged up 304 matchboxes representing all the possible layouts of noughts and crosses encountered while playing. Each matchbox was filled with different-coloured balls to represent possible moves. Balls were removed or added to the boxes to punish losses or reward wins. As the algorithm played more and more games, the reassignment of the balls eventually led to an almost perfect strategy for playing. It was this idea of learning from your mistakes that Hassabis wanted to use to train an algorithm to play Go.
Hassabis had a good model to base his strategy on. A newborn baby does not have a brain that is pre-programmed to cope with making its way through life. It is programmed instead to learn as it interacts with its environment.
If Hassabis was going to tap into the way the brain learned to solve problems, then knowing how the brain works was clearly going to help in his dream of creating a program to play Go. So he decided to do a PhD in neuroscience at University College London. It was during coffee breaks from lab work that Hassabis started discussing with a neuroscientist, Shane Legg, his plans to create a company to try out his ideas. It shows the low status of AI even a decade ago that they never admitted to their professors their dream to dedicate their lives to AI. But they felt they were on to something big, so in September 2010 the two scientists decided to create a company with Mustafa Suleyman, a friend of Hassabis from childhood. DeepMind was incorporated.
The company needed money but initially Hassabis just couldn’t raise any capital. Pitching on a platform that they were going to play games and solve intelligence did not sound serious to most investors. A few, however, did see the vision. Among those who put money in right at the outset were Elon Musk and Peter Thiel. Thiel had never invested outside Silicon Valley and tried to persuade Hassabis to relocate to the West Coast. A born-and-bred Londoner, Hassabis held his ground, insisting that there was more untapped talent in London that could be exploited. Hassabis remembers a crazy conversation he had with Thiel’s lawyer. ‘Does London have law on IP?’ she asked innocently. ‘I think they thought we were coming from Timbuctoo!’ The founders had to give up a huge amount of stock to the investors, but they had their money to start trying to crack AI.