All eyes have been on artificial intelligence (AI) stocks in 2023, with the market almost singlehandedly triggering a recovery for the Nasdaq Composite after it plunged more than 30% last year.

Macroeconomic headwinds curbed consumer and commercial spending in 2022, leading to a sell-off. However, the launch of OpenAI's ChatGPT in November 2022 made Wall Street bullish about tech stocks again, with countless companies restructuring their businesses to focus on the technology. As a result, the index has soared 43% since Jan. 1.

According to Grand View Research, the AI market is valued at $137 billion, but is projected to exceed $1 trillion by the end of the decade, expanding at a compound annual growth rate of 37%. The significant growth potential suggests it's not too late to invest in this budding industry and profit from its long-term development.

Here are two no-brainer AI stocks to buy before 2024.

1. Advanced Micro Devices

Shares of Advanced Micro Devices (AMD 0.35%) have soared 115% year to date. Chipmakers enjoyed the most stock growth amid the AI excitement, as their hardware is crucial for training and running AI models. In fact, AMD's biggest competitor, Nvidia, has seen its shares rise more than 200% this year alongside a spike in chip sales.

AMD's financials have yet to reflect its potential in the sector, with its data center revenue actually dipping just under 1% year over year in the third quarter of 2023. However, that could all change in 2024, when the company will begin shipping what it calls its most powerful graphics processing unit (GPU) ever, designed specifically to compete with Nvidia's offerings.

AMD's new AI GPU, the MI300X, comes at a time when the market has grown desperate for alternatives to Nvidia, with companies looking forward to increased competition reducing the cost of chips. As a result, if the chipmaker can deliver better price-to-performance, it could have a real shot at taking a significant chunk out of Nvidia's estimated 90% market share in AI chips.

The MI300X is already off to a promising start, with Microsoft's Azure announcing in November that it would become the first cloud platform to use the GPU to expand its AI capabilities. Meanwhile, AMD has partnered with Meta, Cisco, and Broadcom to build advanced AI systems.

AMD's soaring stock price, alongside earnings that have yet to see a return on its investment in AI, has made its shares expensive, illustrated by the company's forward price-to-earnings ratio (P/E) of about 52. However, EPS estimates suggest the company still has much to offer new investors.

AMD EPS Estimates for 2 Fiscal Years Ahead Chart

Data by YCharts

This chart shows AMD's earnings could hit $5 per share over the next two fiscal years. Multiplying that figure by the chipmaker's forward P/E yields a stock price of $265, projecting growth of 90% over the next two fiscal years.

Consequently, AMD's stock is attractive ahead of 2024, and a no-brainer for anyone looking to invest in AI.

2. Alphabet

While AMD looks likely to shake up the AI chip market next year, Alphabet (GOOG -1.57%) (GOOGL -1.76%) could be poised to see big gains from the software side of the industry.

In early December the company unveiled its highly anticipated large language model, Gemini. According to CEO Sundar Pichai, the new model "represents one of the biggest science and engineering efforts we've undertaken as a company." The new model is expected to be competitive with OpenAI's ChatGPT-4, and capable of crunching various forms of data such as text, video, and audio.

Gemini will likely open the door to countless growth opportunities in AI. The advanced model and in-house brands like Google, Android, and YouTube could prove a powerful combination. Alphabet will have the tech to offer more efficient advertising through Google Search and YouTube, create a Search experience closer to ChatGPT, introduce AI features on its various productivity platforms, expand its range of AI tools on Google Cloud, and more.

AMZN PE Ratio (Forward) Chart

Data by YCharts

These charts display the forward price-to-earnings ratios (P/E) and price-to-free cash flow for some of the most prominent names in AI right now. Alphabet has the lowest figures for both metrics, indicating its stock is currently offering the most value.

Alongside free cash flow that topped $78 billion this year and a newly launched AI model, Alphabet is an exciting way to invest in the burgeoning sector. It has the funds to fuel R&D, and is potentially the biggest bargain in AI. The company's stock is a screaming buy ahead of the new year.