Depending on who you listen to, the bear market may already be over.

All three major indexes are now more than 20% above their bottoms, signaling a new bull market (according to some definitions), and several media outlets have declared that a new bull market was underway when the S&P 500 recently rose more than 20% from its nadir last fall. Other analysts are waiting for the S&P 500 to also hit a new all-time high before saying a bull is underway.

There's no single explanation for the market's latest comeback. Inflation has eased while the economy remains stable, and unemployment is still low. The Federal Reserve paused interest rate hikes in its last meeting, a sign that interest rates are unlikely to go much higher, which is also encouraging investors to bet on a recovery. Overall, the economy seems to be in a better position than it was six months ago.

But there's another reason that stocks are suddenly flying higher.

Following the launch of OpenAI's ChatGPT late last year, investors became smitten with the potential of artificial intelligence (AI), pumping up almost any stock that has some kind of exposure to AI. Arguably, the AI trend played an even bigger role in the market's recovery this year than the macroeconomic data.

A digitally generated face.

Image source: Getty Images.

How AI slayed the bear

There's no question which sector is driving the market recovery. As you can see from the chart below, tech stocks easily outpaced the broad market this year, and big tech stocks, as represented by the Nasdaq-100, did even better.

^SPX Chart

Data by YCharts.

Over the course of the year, momentum built for AI stocks as investors bet that the technology could unlock a multitrillion-dollar market.

Since the beginning of the year, Microsoft (MSFT -0.64%) launched a new AI-powered version of Bing; Alphabet (GOOG -3.68%) (GOOGL -3.89%) followed suit with Bard AI, impressing investors at its I/O conference in May; Elon Musk again promised full self-driving by the end of the year at Tesla (TSLA -0.09%), and Nvidia (NVDA -1.14%) wowed the market with guidance that was well ahead of expectations at the end of May. 

That news from Nvidia, more than any other AI data point, seemed to propel stocks higher into a new bull market, according to the conventional definition of a recovery of at least 20%.

^SPX Chart

Data by YCharts.

As you can see from the chart above, Nvidia's report was strong enough to lift the Nasdaq Composite up nearly 5% in a single session. The company, known for making chips for artificial intelligence applications, said that it was seeing strong demand for AI chips, causing it to forecast much stronger growth than expected in the second quarter. The company called for revenue of $11 billion in revenue in the second quarter, which compared to analyst estimates of $7.2 billion.

That forecast seemed to persuade investors that a new gold rush was on for artificial intelligence, both for chip stocks like Nvidia and those buying the chips to take advantage of the new technology.

Investment in new AI applications could boost profits for tech stocks while also creating new efficiencies for companies and consumers, adding value to the stock market. More recently, the market responded favorably to an update from Oracle, which said that growth in its cloud computing division was due to accelerating demand for AI computing power.

At times, a new technology or another market event can help turn a bear market around, giving investors hope for a new growth opportunity. 

What it means for investors

There's no doubt that AI stocks skyrocketed this year as names like Nvidia, C3.ai, Upstart, and Tesla all saw stock prices more than double this year, but those gains largely came from expectations surging rather than from results significantly improving. As a result, valuations look stretched in the sector, and we could be witnessing the start of a bubble. 

Nvidia, for example, trades at a price-to-earnings ratio above 200 and now has a market cap above $1 trillion. Essentially, the company would have to grow its profits by 10 times to come within range of the average price-to-earnings ratio on the S&P 500.

Given those elevated valuations, investors should tread carefully with AI stocks, even though there's no shortage of enthusiasm in the stock market for the emerging technology at this point.