What happened

The stock market as a whole had a pretty quiet month in May 2023. The S&P 500 market index traded sideways with a monthly gain of 0.3%, and the Dow Jones Industrial Average index fell by 3.5%.

But many companies with a tight connection to artificial intelligence (AI) broke that quiet trend. For example, these three AI-adjacent stocks posted massive gains last month, according to data from S&P Global Market Intelligence:

Stock

AI Business

Share Price Change In May 2023

Cloudflare (NET -3.87%)

Cloud-based AI needs network security, where Cloudflare is a leader.

47%

Advanced Micro Devices (AMD -5.94%)

Some chips are for AI training, others for end-users' AI devices.

32.3%

MongoDB (MDB -2.51%)

Next-gen databases support AI systems and rapid app development.

22.4%

Price data from S&P Global Market Intelligence.

Before we dive into what moved this trio of AI stocks higher in May, it should be noted that Cloudflare started from an unusually low level. The company reported solid first-quarter revenues and stellar sales in the last week of April, but the stock fell more than 21% the next day due to modest full-year sales guidance.

So moving the start of this measurement period to Thursday, April 27, instead of the last market day on Friday, April 28, makes a big difference for this stock. Cloudflare still delivered a respectable 16.1% gain over the slightly lengthened period but as the lowest performer among these AI triplets instead of the clear leader.

So what

These stocks used to be high-flying market darlings before the inflation-inspired market pain of 2022. Eighteen months ago, they traded at price-to-sales ratios ranging from 12 (AMD) to 108 (Cloudflare), and most of their profit lines were printed in red ink. This made them sensitive to the risk-averse market tenor of recent quarters. The rebound started near the end of 2022, but AMD still entered with shares priced 39% below the peak of November 2021. MongoDB took a deeper cut of 57%, and Cloudflare plunged 77% lower over the same period.

On the upside, the volatile tendency that brought their stock prices down also made them more likely to show a soaring response to any positive news. In this case, none of the good tidings rested on superior business results. AMD's roughly in-line earnings in early May didn't do much to support its stock prices; I already showed you how Cloudflare's results factored into its recent stock chart, and MongoDB posted stellar results -- but not until June 1.

So the upward price moves were powered by two megatrends working in tandem. First, investors see the light at the end of the inflationary tunnel and are starting to reconsider their flight from high-growth stocks with slim or negative profits. Also, everybody is talking about artificial intelligence this year, and that's the nitro booster that really drove this high-tech trio higher last month.

For example, Cloudflare bumped its stock price higher with a couple of strategic press releases last month -- simply reminding everyone that the company sells storage services and security tools to many of the leading generative AI systems. MongoDB achieved similar effects by making senior executives available for AI discussions with high-profile media outlets like SecurityMetrics and InformationWeek. AMD took that strategy one step further, notching an 11% single-day jump after an inspiring conference presentation centered around the company's AI business.

Now what

Artificial intelligence is not a brand-new trend, and these companies have developed their AI strategies over many years or even decades. Still, the sudden surge in AI discussions that was sparked by OpenAI unveiling its ChatGPT tool shook the whole sector up. AI systems can suddenly do things that seemed impossible only last year, and everyone wants to make the most of this unique inflection point in computing history.

Looking ahead, MongoDB, Cloudflare, and AMD seem well positioned to capitalize on the growing importance of AI in various sectors. These companies -- and many of their peers -- have demonstrated that strategic investments in AI systems and services can move the needle for both the business and its stock chart. Investors may want to consider the role of AI in their portfolios, particularly given the recent influence of AI trends on stocks like these.

However, I'm not saying that every AI company is guaranteed to keep winning in the long run. Some of them still seem to bring more market risk than potential rewards. Given their volatility and the rapid pace of change in the tech sector, the soaring opportunity of these stocks often comes with higher risk, too. Thorough due diligence is recommended before making any investment decisions in this surging but unpredictable corner of the information technology sector.