Amid a nasty down cycle for the semiconductor industry, Nvidia (NVDA 6.18%) has rallied some 90% off lows from mid-October 2022. That's confounding, given that fellow semiconductor design peers have said that chip market growth may not make a comeback until this summer, and geopolitical tensions are heating up, with the U.S. banning exports of advanced chip technology (an Nvidia specialty) to China.

As of this writing, Nvidia stock trades for over 94 times trailing-12-month earnings and 44 times one-year forward expected earnings. Whether it's still a bear market or a new bull market has already begun (led by the semiconductor space), that kind of valuation is tough to stomach. But even more interesting is why the market suddenly has an appetite for risk again. What's going on with Nvidia, and is it really a good buy right now?

This story sounds familiar

Before discussing the reason Nvidia has rocked the market's early 2023 rally, let's go back in time just a few years to 2018, another rough year for the semiconductor market. There were the U.S. Federal Reserve's rate hikes (albeit nowhere close to as aggressive as those of 2022) and a downturn in chip demand, exacerbated by the U.S.-China trade war. The market overall didn't do particularly well. Nvidia stock got hit hard, but then started 2019 off hot.

Investors then realized they had gotten ahead of themselves in the first half of 2019, and Nvidia came crashing down again midway through the year -- before ultimately starting its meteoric rise headed into the pandemic. All the while, revenue was falling, and Nvidia stock traded for a high premium (though not as high as now).

NVDA Chart

Data by YCharts. TTM = trailing 12 months. PE = price-to-earnings.

I cite this chart not because I think the company is headed for a repeat of 2019. However, Nvidia has already forecast a decline in revenue (expected to be down about 21% year over year) for its fourth quarter of fiscal 2023 (the three-month period that ended in January). The present situation might wind up rhyming with 2019, though.

If Nvidia follows a similar path as other chip designers, it will forecast more weakness in revenue in the next couple of quarters, as consumer electronics spending is way down compared to last year. Some enterprise spending has also been weakening as data center computing system manufacturers work through a bit of excess inventory.

In other words, the market may have gotten ahead of itself again, running up Nvidia's stock in recent months. I fully expect a bumpy path forward, at best, in 2023.

Why Nvidia stock is up anyway, and why it could be much higher in five years

So, why is Nvidia stock soaring? I suspect it has a lot to do with the viral success of ChatGPT, Microsoft's ensuing investment in ChatGPT creator OpenAI, and other big tech companies' responses unveiling their own consumer-facing generative artificial intelligence (AI) services.

For years, Nvidia CEO Jensen Huang has been talking about the coming explosion in AI inference. Inference is basically when you request AI to compute a task and it comes back with an answer, like when you ask ChatGPT a question and it provides a conversational response. AI inference requires massive computational power. AI isn't new, but until this point, tasks were (mostly) pretty simple -- like autocorrect, autofill suggestions, or recommender systems that suggest videos for you to watch.

In a succession of earnings calls back in 2020, Huang explained that the majority of simple AI inference work like this was done by legacy CPUs (historically, the ones Intel makes, but Advanced Micro Devices has been rapidly chipping away at that market). But as AI models have grown in complexity, something more than a CPU has become necessary. Enter Nvidia's graphics processing unit (GPU) chips.

ChatGPT thus embodies the coming tidal wave of business Nvidia could receive in the coming years as data centers need further revamping to accommodate new AI services. Interestingly, Intel CEO Pat Gelsinger said on the company's Q4 2022 earnings call that "95-plus percent of [cloud customers'] installed base is Intel." That was in reference to data center CPUs (again, a market AMD has been stealing), but it underscores the massive opportunity Nvidia still has ahead of it as these cloud and AI data center computing units need their architectures updated for a new era.

Is Nvidia stock a buy?

Make no mistake, Nvidia has incredible potential as it sells the hardware and software needed to build AI systems like ChatGPT. If you're looking for a trade that will be profitable in the next six to 12 months, Nvidia's recent run-up and steep valuation could be highly problematic. But if you're looking for a top stock to bet on the rise of generative AI services over the next five to 10 years, now could still be a good time to buy. Just remember to tread lightly because the stock price could get turbulent -- especially in the first half of 2023.