The world's largest social network is already spending heavily this year. Last quarter, Facebook's (META -1.41%) research and development expense grew to nearly 30% of revenue, its highest level since the quarter the company went public. Typically, investors like to see R&D as a percentage of revenue decline as revenue increases. Facebook increased revenue 42% year over year in the first quarter of 2015, but R&D expenses rocketed 133%.

FB Research and Development Expense (% of Quarterly Revenues) Chart

As such, Facebook's operating margin declined significantly, and GAAP earnings declined year over year as well. This has a lot of investors freaking out about Facebook's potential future profits, which is the theoretical basis of a stock's price. But the climbing R&D expense shouldn't worry investors; it should encourage them.

Where is Facebook investing?
The most notable investment Facebook has made is in its employees. The company's employee count has increased nearly 50% since the beginning of last year. In the company's annual report, under its R&D expense details, management noted, "In 2015, we plan to continue hiring software engineers and other technical employees to support our research and development initiatives."  So the continued increase in employee count shouldn't be a huge surprise.

FB Total Employees (Annual) Chart

And Facebook is paying those researchers and developers top dollars as it competes with other tech companies for talent.

One researcher Facebook hired is NYU professor Yann LeCun, the recipient of the 2014 IEEE Neural Network Pioneer Award. He was brought on at the end of 2013 to head up Facebook's artificial intelligence research. He has rapidly brought on talent to help develop artificial intelligence systems for Facebook. The company also notably hired 2010 Neural Network Pioneer Award winner Vladimir Vapnik as a consultant last year.

So artificial intelligence and machine learning are clearly at the top of Facebook's agenda for research and development. And talent in that industry doesn't come cheap.

But why does Facebook need superior artificial intelligence?
The kind of artificial intelligence Facebook is investing heavily in isn't the same kind as you'll see from a chess-playing computer. It's significantly more advanced, but easily explained.

Machine learning is a kind of artificial intelligence algorithm that takes into account previous instances of similar events. Just as humans learn how much cream and sugar they like in their coffee by tasting it,  machines can learn things in a similar way -- and they can learn them much better and much faster.

With the amount of data Facebook collects on its users, it needs algorithms to sort that data into something useful. That could determine which posts it shows users on their news feeds, or it could affect which ads it shows to users and where those ads appear. Artificial intelligence is behind all of those things.

That's especially important considering Facebook has a boatload of users that it's yet to fully monetize. Instagram has 300 million active users, Messenger has 600 million, WhatsApp has 800 million, and Facebook Groups has 700 million users. All of these properties require different approaches to fully monetize users without alienating them.

What's more, Facebook's core platform still has opportunities to improve monetization -- most notably, the increase in native video content. Facebook reported that its users watch more than 4 billion videos per day on the social network. In January, Facebook purchased artificial-intelligence start-up, which helps decipher what people are saying in videos. That's data Facebook can feed back into its algorithms.

The opportunity keeps getting bigger
Facebook has shown impressive user growth across all of its major properties. Even its core social network added 50 million net new users last quarter -- a number most social networks would be happy to achieve in a lifetime. Meanwhile, Facebook's satellite properties -- WhatsApp, Instagram, Messenger -- have grown even faster.

Facebook has the money available to spend to take advantage of those opportunities. I would rather see it spend the money now to translate those opportunities into real revenue in the near future than to hold back some spending for fear investors won't like the short-term impact on profits. Management's long-term thinking should encourage Foolish investors that the rapidly growing R&D spending is in the company's best interest.