After a tough summer and early autumn, the stock market is rumbling again as 2023 draws to a close. Artificial intelligence (AI) stocks, and especially beaten-down small- and mid-cap stocks, are starting to heat up. Anything to do with AI is of particular interest to investors right now.

But not all AI stocks are an automatic buy. Indeed, after rallying, some AI stocks tout high valuations again, and they will need to prove they can grow into those valuations in the coming years. Here are three rallying AI stocks, and info on whether they're a buy for 2024 and beyond.

1. Symbotic: Is it a mega-AI robotics provider in the making?

Symbotic (SYM 1.62%) is a supply chain infrastructure company. It sells robotics and AI software for warehouses, especially for large retailers and wholesalers, most notably for one of its big shareholders Walmart. The company is the real deal. After its mid-2022 initial public offering -- not ideal timing given the bear market last year -- revenue has risen at a fast-and-steady pace.

In the third quarter of 2023, revenue increased 61% year over year to $392 million. Suffice it to say it's been an epic run, and Symbotic stock has bucked the trend and keeps reapproaching all-time highs.

SYM Chart

Data by YCharts.

Therein lies an issue. Symbotic's preferred profitability metric, adjusted EBITDA (earnings before interest, tax, depreciation, and amortization), did show the company flipped from red to black ink in Q3. It reported adjusted EBITDA of $13.3 million, versus a loss of $20.5 million last year. Free cash flow (which excludes $32.5 million in employee stock-based compensation, or SBC) was positive $43.6 million.

But value investors would likely pass, as generally accepted accounting principles (GAAP) net losses were still sizable at $45.4 million. More work needs to be done.

For the right investor, a smaller company like Symbotic working toward turning the corner on profitability might be investable -- especially when there's measurable progress. A clean balance sheet with no debt and $546 million in cash and short-term investments also helps.

However, I still have serious doubts about valuation. When factoring for Symbotic's class A and class V stock -- the latter of which gives founder and CEO Rick Cohen control over the business -- Symbotic is valued at a market cap of $28 billion as of this writing.

Japanese investment holdings company SoftBank Group is also a big shareholder, but Symbotic competes with some point solutions from Berkshire Grey, another supply chain robotics company that SoftBank acquired earlier in 2023. However, SoftBank and Symbotic formed a joint venture together called GreenBox over the summer of 2023, which SoftBank owns the majority of.

At over 25 times trailing-12-month revenue, it seems like a steep premium for a company that's still not turning a profit by most metrics and is being controlled by just a few shareholders. I believe this AI company should be passed up for now.

2. MongoDB: Big data software is back on the rise

Though still some 35% down from its 2021 highs, MongoDB (MDB 4.83%) stock rallied grandly in 2023. The stock price has more than doubled, underpinned by the Q3 fiscal 2024 earnings update (for the three-month period ended in October 2023).

MongoDB reported 30% year-over-year revenue growth in Q3 to $433 million, blowing out management's anticipated revenue of just $404 million provided a few months prior. Adjusted operating income of $78.5 million also blew away the outlook for as much as $44 million.

Free cash flow was $36 million, a sizable improvement from negative free cash flow of $7 million in Q3 a year ago -- although investors in search of a long-term value will still want to steer clear as this profit metric excludes the $116 million in employee SBC. That brings the SBC so far this year up to $333 million, although that's just 1.2% of the current market cap of $28 billion.

Nevertheless, much like the other AI stocks on this list, MongoDB still has some work to do in preventing shareholder dilution. As long as the market cap valuation remains elevated, the company's SBC will likely be overlooked. At some point, perhaps a stock repurchase plan can be used to offset this dilution. After all, the balance sheet was in good shape with over $1.9 billion in cash and short-term investments, offset by debt of $1.1 billion.

MongoDB's big data management platform has established itself as a key part of managing new generative AI workflows, as well as managing cloud software overall. New products keep rolling out with the aim of making life easier for software developers. Innovation will be important as software development in the generative AI age won't get any easier. So far, MongoDB keeps delivering the goods.

However, I called the stock a hold in early September, and shares have dipped and recovered back to early September levels since then. I'm reiterating my feelings on this stock for the time being. It boils down to valuation as the share price has gotten hot again. The company is valued at nearly 18 times trailing-12-month sales, once again a high premium as MongoDB still needs to make progress on profitability. That said, the company's knockout Q3 is promising. Keep this AI software infrastructure stock on your radar in 2024.

3. GitLab: The new building blocks of software

GitLab (GTLB -0.98%) is another software stock that's been off to the races as of late. The stock's story is much the same as MongoDB's, as it has been for many other software businesses. GitLab got rumbled by the bear market in 2022, but the generative AI craze is fueling a change. After a November and December rally, GitLab stock is sporting a 35% rally in 2023.

This was once again driven by Q3 financial numbers (the three months ended in October 2023). Revenue of $150 million represented a 32% year-over-year increase. And with bigger sales numbers comes improving profit margins. GAAP operating losses narrowed to $40 million (compared to a loss of $57 million). And on an adjusted basis, GitLab flipped to operating income of $4.7 million (compared to an adjusted operating loss of $22 million last year).

One big shareholder, Alphabet, is probably especially happy. It began buying more stock in GitLab earlier this year, perhaps as a way to further align its Google Cloud segment with GitLab's DevSecOps platform. Microsoft acquired similar (but not entirely the same) DevSecOps offering GitHub back in 2018.

DevSecOps (development, security, and operations) platforms like GitLab are a popular place for IT teams of all sorts to share and work on software code, and GitLab is keeping the pedal to the metal by billing itself as a full-on platform for managing software projects. And in a new era of generative AI, finding new ways to get more efficient in building applications is more important than ever. Using pre-made but customizable software building blocks and AI algorithms is one way to do it.

Additionally, GitLab has been rolling out new features using generative AI -- like its Duo Chat natural-language AI chatbot -- as a way to automate parts of the development process. But like MongoDB, GitLab stock is back into premium-price territory at nearly 18 times trailing-12-month sales. That holds me back from dropping some coin on this company just yet.

Nevertheless, GitLab seems to have weathered the worst of the bear market and is still growing. Further improvement in profitability is promising, and keeping my personal interest piqued. As I often caution, AI businesses with lots of future potential sporting high-growth but high-premium valuations should be purchased in batches over time, perhaps using a dollar-cost averaging plan.

Stock buying suggestions for 2024

For most investors, dollar-cost averaging makes sense headed into 2024, if MongoDB and GitLab meet your needs as a growth investor. Symbotic, though, looks like a safe pass for now given some questions about the business and shareholder structure.