The artificial intelligence (AI) investing world is quite large. There are multiple ways to invest in the trend, from hardware to software to application plays. Each of these segments has advantages and drawbacks. Still, two of the most popular ways to invest in AI from the hardware and software perspective are Nvidia (NVDA 6.18%) and Palantir (PLTR 3.73%), respectively.

But of these two, which is the better buy? Let's find out.

The companies are different types of AI investments

Nvidia's GPUs (graphics processing units) are the building blocks of AI computing. GPUs are great at processing complex computing loads like training an AI model. With Nvidia's GPUs often perceived as best-in-class, it has become the go-to company for GPUs slated for AI use.

Palantir's software was originally designed for the government to take in loads of data and deliver actionable insights. Its software has since expanded to commercial use, although government revenue still makes up most of its business. Palantir's software is highly adaptable and can be tailored to meet a variety of needs, whether it's a hospital, insurance, or manufacturing company.

The two markets these two serve are completely different, as are the rest of their attributes.

Their revenue types are different

Because Nvidia is a hardware company, its revenue stream isn't recurring. It needs to sell additional GPUs to grow its business, and if the demand isn't there, then Nvidia's revenue could suffer.

Palantir's software model requires its customers to renew within a predetermined time frame (often annual or monthly), and clients must pay a fee to continue using Palantir's product.

So, if a recession strikes, Nvidia's revenue streams will likely come under pressure as customers may choose to delay some of its projects. Conversely, if Palantir's software is highly integrated into a client's systems, they likely have no choice but to continue paying Palantir.

Winner: Palantir

Nvidia is growing at a faster pace

When considering outright growth, Nvidia is far superior to Palantir. In the third quarter of fiscal year 2024 (ended Oct. 30), Nvidia's revenue rose 206% year over year compared to Palantir's fourth quarter of fiscal year 2023 (ended Dec. 31) growth of 20%.

While Nvidia's growth far outpaces Palalntir's, Palantir is still growing at a respectable rate for a software company.

Winner: Nvidia

Both companies are profitable

Unlike many growth companies, Palantir knows how to turn a profit. In Q4, it posted a 15% profit margin.

PLTR Profit Margin (Quarterly) Chart

PLTR Profit Margin (Quarterly) data by YCharts.

Palantir's profit margins have steadily risen over the past few years, and it isn't done yet. However, Nvidia's profit margins are far superior to Palantir's since it is a mature business.

NVDA Profit Margin (Quarterly) Chart

NVDA Profit Margin (Quarterly) data by YCharts.

If Nvidia goes through another downturn due to demand depletion, don't be surprised if Nvidia's margins drop below Palantir's. But for right now, Nvidia is far ahead of Palantir in this measure.

Winner: Nvidia

Nvidia and Palantir are difficult to compare from a valuation basis

Because Palantir hasn't reached maximum profitability, using a valuation measure like a price-to-earnings (P/E) ratio is problematic, so a revenue-based measure like the price-to-sales (P/S) ratio is often used. Likewise, a mature company like Nvidia shouldn't be using the P/S ratio; instead, it should use the P/E ratio.

As a result, comparing these two head-to-head is difficult. So, we'll have to compare them to their peers.

At 25 times sales, Palantir is a very expensive stock. But it's not in unprecedented territory. Peers like CrowdStrike, Snowflake, and Cloudflare all trade in this range, but their revenue growth rates are in the 30% year-over-year range instead of 20% for Palantir. As a result, Palantir can be considered as an incredibly expensive stock.

Nvidia's price-to-earnings ratio hasn't improved, as it trades for nearly 100 times earnings. But when forward earnings are utilized (which factor in the next 12 months of growth), Nvidia's stock doesn't look as expensive, as it trades for 35 times forward earnings. With peers like Microsoft and Apple trading at 35 and 28 times forward earnings, Nvidia's price tag doesn't look as bad, especially when its warp-speed growth rate is considered.

With Nvidia being more closely valued by its peers than Palantir, it wins this round.

Winner: Nvidia

The verdict

At a final score of three to one, Nvidia beats out Palantir. But, the one category Palantir did win (revenue type) could cause it to become a better stock in all four areas if Nvidia hits a demand slump.

But as of right now, Nvidia looks like the better buy.