It's not often that a single market is able to reverse the effects of an overall market downturn. While it didn't work completely alone, the artificial intelligence (AI) industry was one of the leading growth drivers in the stock market's recovery in 2023.

In 2022, macroeconomic headwinds saw the Nasdaq Composite plunge 33%. However, the same index has surged 42% since Jan. 1, almost wholly based on excitement over AI. The launch of OpenAI's ChatGPT in November 2022 reignited interest in the technology and has seen countless tech firms pivot their businesses to the sector.

As a result, the AI market is projected to deliver a compound annual growth rate of 37% through 2030 (per Grand View Research). Despite bull runs for many AI stocks this year, there are still some attractive opportunities to invest in the $137 billion industry.

Alphabet (GOOG 1.25%) (GOOGL 1.20%) and Amazon (AMZN 2.94%) are two compelling options -- both are home to some of the world's most recognizable brands and are heavily investing in the technology. So, let's examine whether Alphabet or Amazon is currently the better AI stock.

Alphabet

Alphabet is no stranger to AI, with CEO Sundar Pichai saying in a blog post earlier this year that the tech giant was seven years into its journey as "an AI-first company." However, like many firms, Alphabet has ramped up its expansion into the market in 2023.

The company started 2023 by unveiling Bard -- an AI chatbot designed to be an alternative to ChatGPT -- in February. The launch was a bit of a fumble, with Bard making mistakes at its debut presentation and leaving investors questioning Alphabet's prospects in AI. However, the company seemingly learned from the miss, pulling back to take the rest of the year to get its next project right.

In 2024, Alphabet will launch Gemini, a new large language model expected to be highly competitive with OpenAI's GPT-4.

Combined with potent brands such as Google, Android, and YouTube, the company has almost endless opportunities to monetize its AI technology. From the ability to offer more efficient advertising to bringing AI upgrades to Google Search and Cloud, Alphabet could play a crucial role in getting AI into the hands of billions of consumers.

Moreover, Alphabet posted more than $77 billion in free cash flow in 2023, more than Microsoft, Amazon, or Meta Platforms. The company has the funds and brand recognition to overcome potential headwinds and flourish in AI over the long term.

Amazon

Amazon has been a favorite on Wall Street in 2023, with its stock up about 80% since Jan. 1. The company has rallied investors with a return to growth in its e-commerce segments and a quickly expanding position in AI.

Businesses worldwide are increasingly seeking ways to integrate AI into their workflows. Meanwhile, cloud platforms like Amazon Web Services (AWS) are well equipped to meet rising demand and profit significantly over the long term.

AWS holds a leading 32% market share in cloud computing, ahead of Microsoft's Azure and Google Cloud. Amazon is using its cloud dominance to get ahead in AI, introducing a diverse range of services to AWS this year. New tools such as Bedrock, CodeWhisperer, and HealthScribe use generative technology to help businesses boost productivity and could attract new customers to AWS in the coming years.

In addition to software, AWS announced a venture into chip development in June. Market leader Nvidia has enjoyed soaring earnings in 2023 thanks to a spike in AI chip sales. Amazon plans to challenge Nvidia's dominance in the near future as it works to strengthen and diversify its role in the budding industry.

Is Alphabet or Amazon the better artificial intelligence (AI) stock?

Alphabet and Amazon attract millions, if not billions, of users daily, making it challenging to go a single day without using at least one of their products. Their penetration in the consumer and commercial markets has given them massive earnings potential in AI over the long term. However, just because a company dominates an industry doesn't mean its stock trades at the right price.

AMZN PE Ratio Chart

Data by YCharts

This chart compares these companies' price-to-earnings ratios and price-to-free cash flows, with Alphabet winning on both fronts. Alphabet's significantly lower figures suggest its stock currently offers more value and is a bargain compared to Amazon's.

Alphabet has been slightly overshadowed in AI by peers like Amazon and Microsoft in 2023. However, that has only kept its shares at an attractive price point, making it a screaming buy ahead of 2024 -- and the better AI stock.