Share prices of Nvidia (NVDA -3.89%) and Palantir Technologies (PLTR 0.68%) have been in red-hot form on the stock market this year, recording gains of 225% and 177%, respectively. That performance can be attributed, in part, to their artificial intelligence (AI)-related efforts. Both companies stand to gain from different aspects of the rapid adoption of this technology.

Nvidia is clocking astronomical growth thanks to the booming demand for AI hardware, such as data center graphics cards and server processors. Palantir is expected to win big thanks to the increased adoption of AI software.

If you were to choose one of these high-flying AI stocks for your portfolio today, which one should you buy? Let's find out.

The case for Nvidia

As already mentioned, AI supercharged Nvidia's growth, as evidenced by the company's recent quarterly results. Its fiscal 2024 third-quarter revenue (for the three months ended Oct. 29, 2023) was up a whopping 206% year over year to a record $18.1 billion. Much of that growth came from its data center business segment where revenue jumped 279% year over year to $14.5 billion, accounting for 80% of the top line.

The good news for Nvidia investors is that the company guided for even better growth in the current quarter. Its $20 billion revenue forecast points toward a 230% year-over-year increase. Also, it points toward a huge turnaround when compared to the 21% revenue drop the company witnessed in the same period last year when it was struggling to sell its gaming graphics cards owing to weak personal computer (PC) demand.

Demand for the company's data center graphics processing units (GPUs) is so strong that customers are reportedly having to wait for a year to get their hands on Nvidia's AI chips, according to market research firm Omdia. The firm estimates that Nvidia sold almost half a million units of its H100 and A100 data center GPUs in the previous quarter, driven by massive demand from the likes of Meta Platforms, Microsoft, Alphabet's Google, Amazon, Oracle, and others.

Nvidia expects to ship more than half a million units of its data center GPUs once again in the current quarter. This means Nvidia's data center GPU shipments in the final six months of the year could exceed a million units. What's more, Nvidia expects to triple its output of H100 GPUs in 2024 and has also announced a new, more powerful chip that it plans to manufacture in addition to the highly popular H100.

Not surprisingly, analysts forecast Nvidia will deliver yet another year of terrific growth in fiscal 2025, which will begin in February 2024, with an estimated jump of 57% in its top line to $92 billion. All this indicates that Nvidia stock could continue to head higher in 2024 thanks to its robust AI-fueled growth.

The case for Palantir Technologies

While investors consider Nvidia stock to capitalize on the booming demand for AI hardware, Palantir Technologies can help them benefit from the software side of things. Demand for AI software is expected to increase at an annual rate of 31% through 2027 to $251 billion at the end of the forecast period, according to IDC.

Artificial intelligence platforms, which allow organizations to develop AI models and applications, are expected to be the second-largest niche within the AI software market. IDC forecasts that the AI platforms market could grow at almost 36% a year. This bodes well for Palantir as the company was ranked the top vendor of AI platforms in 2021 by IDC in terms of market share and revenue.

The AI platforms market was worth $14 billion in 2021 and recorded 37% growth that year. Assuming it grows at an annual pace of 36% through 2027 as IDC predicts, it could generate annual revenue of $88 billion after four years. Palantir generated $2.1 billion in revenue in the trailing 12 months, which means that the growing demand for AI platform software has the potential to supercharge its growth.

That won't be surprising as Palantir is already witnessing healthy demand for its Artificial Intelligence Platform (AIP). The company claims that the number of customers using AIP tripled in the previous quarter and added that almost 300 organizations had used the product within five months of launch. And now, Palantir is looking to increase the reach of AIP by organizing boot camps wherein it will teach customers to quickly deploy AI use cases for their businesses.

So, Palantir could eventually turn out to be a top AI pick, but the reality is that the company is currently facing a slowdown. Tepid government spending means that Palantir's revenue in 2023 is expected to increase 16% year over year to $2.2 billion, down from the 24% growth it clocked in 2022. Investors, therefore, will have to wait for AI to start moving the needle for Palantir, and this isn't the only reason why it may lose out to Nvidia as the better AI pick.

The verdict

The big surge in these two stocks this year made each quite expensive. Palantir trades at over 19 times sales, while Nvidia is slightly more expensive at 26 times sales. Meanwhile, Palantir's trailing price-to-earnings (P/E) ratio stands at 253, which is way higher than Nvidia's trailing earnings multiple of 62.

Nvidia is the cheaper stock on a forward earnings basis as well, with a multiple of 55 as compared to Palantir's forward P/E ratio of 69. What's more, both companies are almost equally matched as far as the forward price-to-sales ratio is concerned.

NVDA PS Ratio (Forward) Chart

NVDA PS Ratio (Forward) data by YCharts.

All this strongly suggests Nvidia is the less expensive AI stock of the two companies being discussed here and the better pick. The semiconductor giant is already growing at a terrific pace, and its valuation is relatively more attractive. Palantir, on the other hand, has yet to make the most of the huge opportunity in AI software, leaving investors with an easy decision to make about which one of these two companies they should be buying right now.