Two humans, one robot and a lot of ethical questions
A new film from the author of The Beach puts two humans on a collision course with a seductive "fembot". It's clearly a fantasy, but is the reality far away?
Eminent scientists, Professor Stephen Hawking among them, have warned that artificial intelligence (AI) could spell the end of the human race.
Now the possibility of making an AI to rival ours is explored in Ex Machina, the directorial debut from British author and screenwriter Alex Garland.
Recently Professor Hawking told BBC News he feared the consequences of creating something that could surpass human intelligence, predicting that humans "would be superseded".
Garland, though, disagrees with the renowned theoretical physicist. "I don't feel that sense of concern about a sentient AI," he shrugs.
"Every single one of us is the result of two people creating a new consciousness; there's nothing in that idea I find particularly problematic.
"People are paranoid about AI and computers in general," he continues. "I approach it from a slightly different angle because I don't feel paranoid about it.
"In this film, I'd say, my sympathies lie with the robot."
After making his name with his 1996 backpacking novel The Beach - later adapted into a film starring Leonardo DiCaprio - Garland turned his attention to screenwriting, creating British horror 28 Days Later... and sci-fi thriller Sunshine for director Danny Boyle.
He also penned film adaptations of Kazuo Ishiguro's cloning novel Never Let Me Go and Dredd, based on the popular Judge Dredd comic strip.
He has also written a script for a film adaptation of the Halo video game that has yet to be made. The game, though, sparked an interest in creating his own story about artificial intelligence.
"It throws up so many ethical questions of who we are and fundamentally, what our future will be," he tells the BBC News website.
"I'm not particularly interested in the AIs that already exist in smartphones and computers, but sentient, self-aware AIs. Artificial intelligence is about consciousness.
"So a film about it is also a film about us, because we are also our minds. It's a rich area for a thriller."
In Ex Machina, Domhnall Gleeson plays Caleb, a brilliant young coder in a big tech company who is invited to spend a week with his reclusive CEO Nathan, played by Oscar Isaac.
Caleb is there to take "The Turing Test" - named after Alan Turing, the subject of The Imitation Game - in which a human interacts with a computer without knowing whether it is a human or an artificial intelligence.
"The Turing Test was set decades ago in the birth of computing, when Alan Turing understood that at some point the machines they were working on could become thinking machines, as opposed to just calculating machines," explains Garland.
"He saw that it would be difficult to know whether something was really thinking, or just pretending to be thinking."
In June 2014, it was suggested that a "chatbot" called Eugene Goostman had passed the test by fooling judges at the University of Reading.
But the results were disputed by many artificial intelligence experts who claimed the program had relied upon the persona of a teenage Eastern European boy, allowing judges to make concessions for mistakes in language.
The "bot" in Ex Machina is Ava, played by Swedish actress Alicia Vikander - a beautiful synthetic human whose visible workings and metal skeleton show she is quite clearly a machine.
"Nathan is so convinced of his robot Ava's abilities that he allows Caleb to meet her without concealing the fact that she's obviously a machine," says Garland.
"If he can be taken in by her, even though she is clearly not human, then she might really be thinking, not calculating."
Vikander, recently seen in World War One drama Testament of Youth, says that audiences "instantly objectify Ava because she has a woman's face and shape, but she is also a machine".
"However, I think it's important to feature sexuality in the film. There is no consciousness in nature that doesn't involve sexuality in some way, so it should be explored within artificial intelligence."
How soon will an artificial intelligence in the shape of a thinking robot become reality? Garland thinks it's "around the corner in the same way that a cure for cancer is around the corner".
"The complexities of the problem only become more manifest as we go deeper into it," he goes on. "I'm pretty sure it will happen, but probably during my children's lifetime, not next year."
'Not a threat'
While acknowledging that film history is rich in stories of how humanity is destroyed by malevolent machines, Garland argues that he sees them as "benevolent, and not a threat".
"OK, there may be a type of AI that can control a drone and make a kill decision over a human, that arguably we're very close to," the writer-director concedes.
"But if you are talking about a consciousness, I suspect they will be benign. It's about as benign as two people having a child - it could grow up to be Marie Curie, or grow up to be Idi Amin. You just don't know.
"Personally I think they're in more danger from us. We humans have a history of making catastrophic mistakes, so I think a new consciousness might be better at that than we are.
"I find myself weirdly sympathetic to machines," he concludes. "I think they have a better shot at the future than we do."
Ex Machina is out now in the UK and Ireland.