Patterns tend to repeat themselves in the stock market. And according to an analysis of the Nasdaq Composite going back to 1971, the tech-heavy index has risen by an average of 19% every year following a recovery year like 2023.

To be fair, past performance is not a guarantee of future results. But new innovations in artificial intelligence (AI) could help the market maintain its momentum. And for investors who want to bet on the bullish trend continuing in 2024 and beyond, buying shares of Amazon (AMZN 2.29%) and Meta Platforms (META 2.10%) could be great ways to do so.

1. Amazon

Amazon stock rose by 60% over the last 12 months, which was almost enough for it to fully recover from the sharp dip it experienced in 2022. Shares now trade at a forward price-to-earnings (P/E) multiple of 44, a premium over the market average of 22. However, investors should still be optimistic because of the company's potential in AI and other opportunities.

Amazon is diversified across e-commerce and cloud computing, which gives it many different ways to use generative AI to better serve its customers and drive sustainable growth.

In its online marketplace, the company has focused on improving the user experience with efforts including AI-powered customer review summaries and virtual shopping assistants designed to improve conversion rates. That said, its cloud computing platform, Amazon Web Services (AWS), may generate the most impact from a new feature called Bedrock, designed to help enterprise clients build and train customized generative AI applications within the AWS ecosystem.

Amazon's growth efforts aren't limited to AI. The company is also rapidly climbing the ladder in digital advertising -- an industry it is poised to dominate because it operates right at the point of sale.

In the third quarter, its advertising services revenue jumped 26% year over year to $12.06 billion. And investors can expect continued growth as the company uses AI to improve ad efficiency and rolls out ads on its Prime Video streaming service.

2. Meta Platforms

With shares up 168% over the last 12 months and up a few percent past their autumn 2021 peak, Meta Platforms is another tech company riding high, thanks in part to the generative AI wave. While the social media giant struggled with its cash-burning efforts to develop its version of the metaverse for much of 2022, its AI efforts seem to be a potentially more profitable focus.

Meta's core social media businesses -- Facebook, Messenger, Instagram, and WhatsApp -- remain the cornerstone of its operations. But with 3.96 billion people using at least one of these apps at least once a month, the company has already reached almost half of the world's population (roughly 8.1 billion). Now, its focus will likely be on better monetizing its existing users and pioneering new growth drivers. Generative AI could go a long way toward helping this process.

Man on a computer investing in artificial intelligence

Image source: Getty Images.

For starters, all of Meta's users generate data, which can help with training large language models (the algorithms that underlay chatbots like ChatGPT). Meta also has a hardware advantage. Management expects to have 600,000 Nvidia H100 AI training chips in its servers by the end of the year, which may be more than any other company.

Founder Mark Zuckerburg is aiming high -- seeking to have his company pioneer the subset of AI technology called artificial general intelligence (AGI), a hypothetical technology that can think and reason like a human, learning and solving unfamiliar challenges. While success could be years away, the profit potential looks substantial because AGI could disrupt fields ranging from self-driving cars to robotics.

AI's honeymoon period will end

Many tech companies are starting 2024 with high valuations and significant hype surrounding their AI endeavors. Amazon and Meta are no exceptions. As the initial excitement fades, investors should pay attention to how the technology actually impacts their operational performance. The good news is that with their vast amounts of user data and business synergies, both companies have what it takes to succeed.