The “chatbots” Alice and Bob modified English to make it easier for them to communicate — creating sentences that were gibberish to watching scientists.
A robot expert said the revelation that Facebook machines had spoken in their own language was exciting — but also incredibly scary.
UK Robotics Professor Kevin Warwick said: “This is an incredibly important milestone, but anyone who thinks this is not dangerous has got their head in the sand.
“We do not know what these bots are saying. Once you have a bot that has the ability to do something physically, particularly military bots, this could be lethal.
“If one says, ‘Why not do this,’ and the other says ‘Yes’ and it’s a military bot, you have a serious situation.
“This is the first recorded communication but there will have been many more unrecorded.
“Smart devices right now have the ability to communicate and although we think we can monitor them, we have no way of knowing.
“Stephen Hawking and I have been warning against the dangers of deferring to Artificial Intelligence.”
The Facebook incident has echoes of the storyline to movie The Terminator, in which an AI system which has developed self-awareness wages a devastating war against humans.
Facebook researchers in New York set up “chatbots” Alice and Bob in a bid to develop automated trouble-shooters for social media networks.
They were to speak in English as they worked out how to negotiate and trade hats, books and balls — each of which were given a value.
But the robots rapidly modified the English using code words and repetitions to make conversation easier for themselves — creating a gibberish language that only they understood. One exchange went:
Bob: i can i i everything else . . .
Alice: balls have zero to me to me to me to me to me to me to me to me to.
Bob: you i everything else . . . .
Alice: balls have a ball to me to me to me to me to me to me to me.
Researchers pulled the plug when they realised what was happening.
British future technology expert Kate Adamson said: “It does feel a bit like The Terminator.
“This is happening everywhere. If you look at things like high frequency trading in stock markets now, there are algorithms that are doing the same thing.
“They have gained new knowledge and are not technically under control on a minute-by-minute basis.
“The level of complication AI is capable of is way beyond what you and I would understand.”
Facebook said the experiment was halted because it was “not what they set out to investigate”.
It said similar results had been seen by other tech firms
Scientists at Google Translate last year discovered the service had invented its own language.
Musk, 46, said it poses a “fundamental risk to human civilisation”.