Artificial intelligence (AI) is all the rage these days and has been dominating the headlines, while every tech company worth its salt is getting into the game. With all the hype, investors may be asking themselves: What's the best way to invest in this growing trend?

Let's look at three companies with solid artificial-intelligence programs: e-commerce titan Amazon.com, Inc. (AMZN 3.43%), Google search parent Alphabet Inc. (GOOGL 10.22%) (GOOG 9.96%), and cognitive-computing leader International Business Machines Corporation (IBM -1.05%).

Echo smart-home speaker sitting on bookshelf

Amazon's Echo smart-home speaker, powered by AI-based Alexa. Image source: Amazon, Inc.

Amazon.com

Amazon CEO Jeff Bezos believes that AI could be the fourth pillar of the company's business, behind its e-commerce, its cloud hosting unit Amazon Web Services (AWS), and its Prime membership program. Alexa, the company's virtual assistant and AI poster child, hosts a variety of products that leverage her AI foundation, including the Echo smart-home speaker, the smaller Dot, and the portable Tap, as well as the Fire tablet and Fire TV Stick. Using natural-language processing and cloud computing, these products respond to voice commands, and AI allows Alexa to learn continuously the more the products are used. Developers have created more than 10,000 "skills" that provide a variety of functionality, from ordering pizza to scheduling a ride-share.

Amazon has also been leveraging its deep-learning innovations by deploying them across AWS as managed services available to its customers. Lex, similar to Alexa, can build sophisticated chatbots; Rekognition provides image-recognition capabilities; and Polly reads and recites text. Amazon grew its revenue to $46 billion in its most recent quarter, so its AI contribution is currently microscopic, but that could change. RBC Capital Markets predicts that Alexa could contribute an additional $10 billion annually by 2020.

Google Home in a variety of colors

Google Home smart speaker system. Image source: Google.

Google

Google has been investing heavily for years in a sub-discipline of AI called deep learning, and the result of that research is an artificial neural network, christened the Google Brain. By combining massive amounts of data with complicated algorithms, the system recognizes patterns and learns in a way similar to the human brain. The company has infused the knowledge gained into a vast array of its businesses, using AI to improve the reliability of its ubiquitous search, decrease the energy consumption of its servers, and catalog images from its Street View mapping cars.

Its AI-powered Google Assistant, the company's entry in the growing list of virtual personal assistants, is available in many of the company's branded devices and is the foundation for its Google Home smart speaker system. Google Assistant interacts with the company's Photos, Maps, Keep, Calendar, and other services, provides the ability to stream music and movies to Android mobile devices, and controls home-automation products. Google is also a well-known pioneer in the area of AI-based autonomous driving.

With $26 billion in revenue for the most recent quarter, Alphabet will notice little effect from Home just yet; this is a new product, so we don't have data for how popular it is, but the potential market is huge. Activate.com estimates that smart speakers will be in 21 million homes by 2020.

Woman viewing lighted panel of X-ray images

Watson employs advanced analytics to "see" medical images. Image source: IBM.

IBM

IBM's Watson might be best remembered for its winning stint on the popular TV game show Jeopardy!, but Watson hasn't been resting on its laurels. You won't see consumer-facing products coming from Big Blue, but the company has developed a wide variety of business partnerships using the abilities of its cognitive AI supercomputer. Watson's earliest foray was into the field of healthcare, where it has been tasked with cancer research, immunotherapy, diabetes management, and genomic sequencing. Most notably, Watson was recently able to correctly diagnose cancer patients, agreeing with oncologists in 99% of cases. The cognitive computer also successfully diagnosed a rare form of leukemia in a case that had baffled doctors -- all within 10 minutes after being fed the data.

Watson has partnered in other fields, improving the accuracy of tax returns, providing cybersecurity, and improving regulatory compliance for financial institutions. Watson is a bet on AI-based cognitive computing, data analytics, and cloud computing, as the company moves away from its legacy hardware and IT services business. IBM has yet to disclose Watson's contribution, but "strategic imperatives," where Watson's revenue is reported, grew 13% in 2016 to account for 41% of total revenue.

Foolish final thoughts

These companies are at the forefront of the AI revolution, but AI innovations represent only a portion of their total business. Investors should avoid investing in any of these companies based solely on the advantages represented by AI.

That said, if you like any of these companies and are interested in adding AI to your portfolio, each offers that opportunity. While it may be difficult to quantify many of the benefits, we do know that AI can help increase revenue and efficiency, provide a compelling and productive ecosystem to consumers, and provide new opportunities for business.