Over the past couple of years, Nvidia (NVDA 2.82%) and Palantir (PLTR +6.85%) have been among the hottest stocks on the market. Nvidia has grown to become the world's most valuable public company, and Palantir's market cap has jumped by more than 835%.
Although both are some of the more popular artificial intelligence (AI) stocks, their roles in that space are entirely different. It's not an apples-to-apples comparison, but if I had to pick one to invest in, the choice is clear.
Image source: Getty Images.
What does Nvidia do?
Nvidia provides crucial hardware that makes training and running AI possible. Without products like its GPUs and other networking equipment, the AI sector wouldn't be anywhere near the scale it is today.
That's why its valuation has flown higher during the AI boom. Its leadership position has also allowed it to increase its prices because demand for AI accelerators is far outpacing supply. Last quarter, Nvidia's data center revenue rose 66% year over year to $51.2 billion. Three years ago, its data center revenue was only $3.83 billion.

NASDAQ: NVDA
Key Data Points
What does Palantir do?
Palantir is an AI software company specializing in data analytics. It has been around since 2003, but its recent surge in popularity on Wall Street has a lot to do with how its business has been expanding. For much of its existence, Palantir's focus was largely on government contracts. Its largest clients include the Defense Department, the CIA, the FBI, and ICE.
Today, the U.S. government is still its top client, but its U.S. commercial business has emerged as a legitimate growth area, and its demonstration that it can be more than just a government contractor has sparked a lot of investor interest.

NASDAQ: PLTR
Key Data Points
Which is the better AI stock?
If I had to choose between Nvidia and Palantir for an AI investment, I would go with Nvidia. Its offerings are crucial to AI infrastructure, while Palantir's is software based and will rely more on adoption.
There's also a wide valuation difference between them that shouldn't be ignored. As of the start of February, Nvidia was trading at around 40.7 times its projected earnings over the next 12 months, while Palantir was trading at around 144.7 times its projected earnings. Nvidia's stock is expensive. Palantir's stock is unreasonably expensive.
NVDA PE Ratio (Forward) data by YCharts.
There's still uncertainty about what the AI boom will lead to and how the landscape will look years from now. That's why I'd rather invest in a company that focuses on infrastructure and can sell its products into markets beyond AI, versus one that's solely reliant on its AI software business.






