Nvidia (NVDA 2.74%) became a Wall Street darling last year when its graphics processing units (GPUs) became the gold standard for artificial intelligence (AI) developers worldwide. A boom in AI saw countless tech firms pivot their businesses to developing the industry, meaning skyrocketing demand for GPUs -- the chips necessary to train and run AI models.

NVDA Revenue (Quarterly) Chart

Data by YCharts

With its dominating role in GPUs, Nvidia was well equipped to supply its hardware to the entire market. As a result, the company's shares rose 239% in 2023 while earnings soared (as seen in the chart).

Nvidia's meteoric rise last year will likely be challenging to replicate in 2024. However, AI remains lucrative, with the market projected to expand at a compound annual growth rate of 37% until at least 2030. As a result, it's not too late to invest in the budding sector and profit from its long-term growth.

So do you feel like you missed out on Nvidia? Here are two AI stocks to buy before they soar in 2024.

1. Alphabet

While chip stocks have become a favorite on Wall Street for investing in AI, software companies like Alphabet (GOOG 4.84%) (GOOGL 4.85%) shouldn't be overlooked.

Alphabet products like Google, YouTube, and Android attract billions of users, giving the company almost endless ways to monetize its AI technology. Alphabet's Google Cloud platform on its own has a powerful role in the industry, providing clients access to high computing power and advanced large language models.

In fact, last December, Alphabet unveiled its highly anticipated AI model, Gemini. The tech giant has said it will have three versions of the model, with the most powerful one designed to run data centers and the smallest able to power smartphones.

Gemini could open the door to countless growth opportunities in AI for Alphabet, with the ability to create a Google Search experience closer to OpenAI's ChatGPT, add new AI tools to Google Cloud and Android, offer more efficient advertising, and better track viewing trends on YouTube.

In its fourth quarter of 2023, Alphabet posted revenue growth of 13.5% year over year, beating Wall Street estimates by more than $1 billion. The company's ad revenue fell shy of forecasts, but its cloud division beat expectations. Google Cloud revenue rose 25% in the quarter, strengthening the company's outlook in AI.

Meanwhile, the $77 billion in free cash flow it achieved last year suggests it has the funds to continue investing heavily in AI and overcome potential headwinds.

NVDA PE Ratio (Forward) Chart

Data by YCharts

Moreover, these charts show that Alphabet's stock offers far more value than Nvidia's. The Google company's forward price-to-earnings ratio, price-to-free cash flow, and price-to-sales ratio (P/S) are all significantly lower than Nvidia's, indicating its stock is trading at a lower price.

These are three key valuation metrics, and for each, the lower the figure, the better the value. Alongside a promising outlook in AI, Alphabet is a no-brainer buy in 2024.

2. Amazon

Amazon (AMZN 2.31%) is another cloud company worth considering over Nvidia this year. The tech firm pulled off an impressive recovery in 2023, which has seen its free cash flow soar 427% over the last 12 months. Meanwhile, quarterly revenue and operating income have risen 12% and 134%.

The company has benefited from various cost-cutting measures and considerable investment in artificial intelligence. As the world's biggest cloud company with Amazon Web Services (AWS), the tech giant has the potential to leverage its massive cloud data centers and steer the generative AI market in its favor.

Over the last year, AWS has responded to increased demand for AI services by expanding its offerings. For instance, Bedrock offers a range of models for customers to build generative AI applications, CodeWhisperer generates code for developers, and HealthScribe is capable of transcribing patient-to-physician conversations.

AWS is already Amazon's most profitable business. In the third quarter of 2023, the platform was responsible for more than 60% of the company's operating income, despite earning the lowest portion of revenue between its three segments. As it continues to expand its AI services, Amazon could be in for consistent earnings boosts over the long term.

NVDA PS Ratio Chart

Data by YCharts

This table compares the P/S ratios of some of the most prominent names in AI, with Amazon's the lowest on the list. P/S is calculated by dividing a company's market cap by its trailing-12-month revenue, making it a useful metric for determining a stock's value as it accounts for a business' financial health.

As one of the biggest bargains in AI, Amazon is a screaming buy for anyone looking to invest in the high-growth arena in 2024.