AT THE start of this year, two straws in the wind caught the attention of those who follow the development of artificial intelligence (AI) globally. First, Qi Lu, one of the bosses of Microsoft, said in January that he would not return to the world’s largest software firm after recovering from a cycling accident, but instead would become chief operating officer at Baidu, China’s leading search engine. Later that month, the Association for the Advancement of Artificial Intelligence postponed its annual meeting. The planned date for the event in January conflicted with the Chinese new year.

These were the latest signals that China could be a close second to America—and perhaps even ahead of it—in some areas of AI, widely considered vital to everything from digital assistants to self-driving cars. China is simply the place to be, explains Mr Lu, and Baidu the country’s most important player. “We have an opportunity to lead in the future of AI,” he says.

Other evidence supports the claim. In October 2016 the White House noted in a report that China had overtaken America in the number of published journal articles on deep learning, a branch of AI. PwC, a consultancy, predicts that AI-related growth will boost global GDP by $16trn by 2030; nearly half of that bonanza will accrue to China, it reckons. The number of AI-related patent submissions by Chinese researchers has increased by nearly 200% in recent years, although America is still ahead in absolute numbers (see chart).

To understand why China is so well placed, consider the inputs needed for AI. Of the two most basic, computing power and capital, it has an abundance. Chinese firms, from giants such as Alibaba and Tencent to startups such as CIB FinTech and UCloud, are building data centres as fast as they can. The market for cloud computing has been growing by more than 30% in recent years and will continue to do so, according to Gartner, a consultancy. In 2012-16 Chinese AI firms received $2.6bn in funding, according to the Wuzhen Institute, a think-tank. That is less than the $17.9bn that poured into their American peers, but the total is growing quickly.

Yet it is two other resources that truly make China a promised land for AI. One is research talent. As well as strong skills in maths, the country has a tradition in language and translation research, says Harry Shum, who leads Microsoft’s AI efforts. Finding top-notch AI experts is harder in China than in America, says Wanli Min, who oversees 150 data scientists at Alibaba. But this will change over the next couple of years, he predicts, because most big universities have launched AI programmes. According to some estimates, China has more than two-fifths of the world’s trained AI scientists.

The second advantage for China is data, AI’s most important ingredient. In the past, software and digital products mostly obeyed rules laid down in code, giving an edge to those countries with the best coders. With the advent of deep-learning algorithms, such rules are increasingly based on patterns extracted from reams of data. The more data are available, the more algorithms can learn and the smarter AI offerings will be.

China’s sheer size and diversity provide powerful fuel for this cycle. Just by going about their daily lives, the country’s nearly 1.4bn people generate more data than almost all other nations combined. Even in the case of a rare disease, there are enough examples to teach an algorithm how to recognise it. Because typing Chinese characters is more laborious than Western ones, people also tend to use voice-recognition services more often than in the West, so firms have more voice snippets with which to improve speech offerings.

The Saudi Arabia of data

What really sets China apart is that it has more internet users than any other country: about 730m. Almost all go online from smartphones, which generate far more valuable data than desktop computers, chiefly because they contain sensors and are carried around. In the big coastal cities, for instance, cash has all but disappeared for small purchases: people settle with their devices using services such as Alipay and WeChat Pay.

Chinese do not seem to be terribly concerned about privacy, which makes collecting data easier. The country’s bike-sharing services, which have taken big cities by storm, for example, not only provide cheap transport but are what is known as a “data play”. When riders hire a bicycle, some firms keep track of renters’ movements using a GPS device attached to the bike.

Young Chinese appear particularly keen on AI-powered services and relaxed about use of their data. Xiaoice, an upbeat chatbot operated by Microsoft, now has more than 100m Chinese users. Most talk to it between 11pm and 3am, often about the problems they had during the day. It is learning from interactions and becoming cleverer. Xiaoice no longer just provides encouragement and tells jokes, but has created the first collection of poems written with AI, “Sunshine Lost Its Window”, which caused a heated debate in Chinese literary circles over whether there can be such a thing as artificial poetry.

Another important source of support for AI in China is the government. The technology figures prominently in the country’s current five-year plan. Technology firms are working closely with government agencies: Baidu, for example, has been asked to lead a national laboratory for deep learning. It is unlikely that the government will burden AI firms with over-strict regulation. The country has more than 40 laws containing rules about the protection of personal data, but these are rarely enforced.

Entrepreneurs are taking advantage of China’s talent and data strengths. Many AI firms got going only a year or two ago, but plenty have been progressing more rapidly than their Western counterparts. “Chinese AI startups often iterate and execute more quickly,” explains Kai-Fu Lee, who ran Google’s subsidiary in China in the 2000s and now leads Sinovation Ventures, a venture-capital fund.

As a result, China already has a herd of AI unicorns, meaning startups valued at more than $1bn. Toutiao, a news aggregator based in Beijing, employs machine learning to recommend articles using information such as a reader’s interests and location; it also uses AI to filter out fake information (which in China mainly means dubious health-care announcements). Another AI startup, iFlytek, has developed a voice assistant that translates Mandarin into several languages, including English and German, even if the speaker uses slang and talks over background noise. And Megvii Technology’s face-recognition software, Face++, identifies people almost instantaneously.

Skynet lives

At Megvii’s headquarters, visitors are treated to a demonstration. A video camera in the lobby does away with the need for showing ID: employees just walk in without showing their badges. Similar devices are positioned all over the office and their feeds are shown on a video wall. When a face pops up on the wall, it is immediately surrounded by a white rectangle and some text giving information about that person. In the upper right-hand corner of the screen big letters spell “Skynet”, the name of the AI system in the Terminator films that seeks to exterminate the human race. The firm already enables Alipay and Didi, a ride-hailing firm, to check the identity of new customers (their faces are compared with pictures held by the government).

Reacting to the success of such startups, China’s tech giants, too, have begun to invest heavily in AI. Baidu, Alibaba and Tencent, collectively called BAT, are working on many of the same services, including speech- and face-recognition. But they are also trying to become dominant in specific areas of AI, based on their existing strengths.

Tencent has so far kept the lowest profile; it established its AI labs only in recent months. But it is bound to develop a big presence in AI: it has more data than the other two. Its WeChat messenger service has nearly 1bn accounts and is also the platform for thousands of services, from payments and news to city guides and legal help. Tencent is also a world-beater in games with blockbusters such as League of Legends and Clash of Clans, which have more than 100m players each globally.

Alibaba is already a behemoth in e-commerce and is investing billions to become number one in cloud computing. At a conference in June in Shanghai it showed off an AI service called “ET City Brain” that uses video recognition to optimise traffic in real time. It uses footage from roadside cameras to predict the behaviour of cars and can adjust traffic lights on the spot. In its home town of Hangzhou, Alibaba claims, the system has already increased the average speed of traffic by 11%. Alibaba is also planning to beef up what it calls “ET Medical Brain”, which will offer AI-powered services to discover drugs and diagnose medical images. It has signed up a dozen hospitals to get the data it needs.

But it is Baidu whose fate is most tied to AI, in part because the technology may be its main chance to catch up with Alibaba and Tencent. It is putting most of its resources into autonomous driving: it wants to get a self-driving car onto the market by 2018 and to provide technology for fully autonomous vehicles by 2020. On July 5th the firm announced a first version of its self-driving-car software, called Apollo, at a developer conference in Beijing.

Getting Apollo right will not only involve cars safely navigating the streets, but managing a project that is open to outsiders. Rivals such as Waymo, Google’s subsidiary, and Tesla, an electric-car firm, jealously guard their software and the data they collect. Baidu is planning not only to publish the recipe for its programs (making them “open-source”, in the jargon), but to share data. The idea is that carmakers that use Baidu’s technology will do the same, creating an open platform for data from self-driving cars—the “Android for autonomous vehicles”, in the words of Mr Lu.

Drive like a Beijinger

It remains to be seen how successful Chinese firms will be in exporting their AI products—for now, only a tiny handful are used abroad. In theory they should travel well: a self-driving car trained on China’s chaotic streets ought to have no problem navigating the more civilised traffic in Europe (in contrast, a vehicle trained in Germany may not get far beyond the first intersection in Beijing). But consumers in the West may hesitate to use self-driving cars that have been trained in a laxer safety environment that is more tolerant of accidents. Chinese municipalities are said to be falling over themselves to be testing grounds for autonomous vehicles.

There is another risk. Data are the most valuable input for AI at the moment, but their importance may yet diminish. AI firms have started to use simulated data, including those from video games. New types of algorithms may be capable of getting smart with fewer examples. “The danger is that we stop innovating in algorithms because of our advantage in data,” warns Gansha Wu, chief executive of UISEE, a Beijing startup which is developing self-driving technology. For now, though, China looks anything but complacent. In the race for pre-eminence in AI, it will run America close.