BEIJING — Chinese tech company Baidu on Tuesday reported better-than-expected revenue, up by 15% year-on-year in the second quarter and bolstered by growth in advertising.

This was the fastest quarterly year-on-year growth pace in two years, according to Refinitiv data.

Baidu's U.S.-traded shares were up by more than 4% in pre-market trading.

Here's how did in the June quarter versus Refinitiv consensus estimates:

Earnings per American Depositary Share on a non-GAAP basis were 22.55 yuan, versus 15.79 yuan in the year-ago period.

Within Baidu's core businesses, online marketing revenue rose by 15% to 19.6 billion yuan in the second quarter, and non-online marketing revenue added 12% to 6.8 billion yuan.

The company's use of AI to better match ads to Baidu search queries helped boost the quarter's online marketing sales growth from a year ago, Robin Li, co-founder and CEO of Baidu, said during an earnings call.

Baidu operates China's primary internet search engine, as well as commonly used consumer apps for navigation and cloud document storage.

"In the second quarter of 2023, Baidu Core accelerated revenue and profit growth, driven by the solid performance of online marketing business and operating leverage," Li said in a release.

"Generative AI and large language models hold immense transformative power in numerous industries, presenting a significant market opportunity for us," he said.

Baidu has been making progress with a Chinese-language ChatGPT alternative called , which is open to the public and was launched in March. OpenAI's wildly popular rival chatbot isn't easily accessible in the country.

Last week, Baidu announced that five Ernie bot plugins — including ones for quickly converting text to video and for PDF search — would become more widely available to users. Three of the plugins can also be used simultaneously, according to the company.

The company plans to add plugins from third-party developers, Li said on the earnings call.

Baidu has so far prioritized corporate partners for access to its Ernie bot, which opened to wider use via a waitlist earlier this year.

In terms of government regulation, Li said Baidu is "still waiting for the green light for large-scale rollout of Ernie bot for use in consumer facing apps."

But he said the latest version of China's AI rules, that took effect Aug. 15, are "more pro-innovation than regulation." That's compared to an earlier draft released in April.

"We don't have an exact date for everything. But the trend is very promising and we are quite optimistic about the future for a better regulatory environment," Li said.

Baidu last week also revealed an AI-powered assistant that could help with tasks including booking meetings, air tickets and hotels. It was not immediately clear how users could obtain the assistant product.

The company is also looking to expand the reach of AI into the automobile sector. This month, the company announced a strategic agreement with state-owned Changan Automobile to develop autonomous driving capabilities based on the AI model behind Baidu's Ernie bot.

Baidu is not alone in its foray, as other Chinese tech giants are also pushing into AI-related products. Earlier this month, e-commerce giant Alibaba claimed that for training artificial intelligence models on the cloud and the related business opportunity was .

Internet titan Tencent said during its earnings release last week that it its own AI model later this year, for use in products such as gaming and advertising.

Baidu also operates self-driving taxis under the Apollo Go brand in China. In the second quarter, Baidu said it ran roughly 714,000 robotaxi rides, up from 660,000 in the first quarter.

The company was allowed to start in Beijing in November 2021. Passengers can book the rides, which are typically highly subsidized, via an app.

Most of the robotaxis, which are available in parts of many major Chinese cities, still have human staff inside.

In June, the company said it received approval to operate robotaxis without employees in a suburb of Shenzhen. That followed similar approval in August 2022 to remove human staff in some robotaxis in parts of