Warren Buffett is famously averse to investing in tech companies, in part because technology advances so quickly that the competitive landscape can shift quickly. Earlier this year, the Oracle of Omaha conceded that he was "too dumb" and missed the boat on Amazon.com, and that it was also a mistake to have never bought shares of Alphabet.

Buffett started dipping his toes into tech way back in 2011, when he first invested Berkshire Hathaway's (BRK.A 0.97%) (BRK.B 1.21%) money in IBM (IBM -0.13%). It would take another five years before the famed investor would initiate a position in Apple (AAPL -1.22%). To date, these are the only two tech stocks that Berkshire owns. However, IBM seems to have fallen out of Buffett's favor in recent years, while Apple appears ascendant.

iPhone X lineup

Image source: Apple.

Rotating from IBM to Apple

Institutional investors are now filing quarterly ownership disclosures, and Berkshire's filing showed that Buffett's holding company added 3.9 million shares of Apple in the third quarter (a sequential increase of 3%), while selling off over 17 million shares of IBM (a sequential decrease of 31.5%). The number of Apple shares that Berkshire bought in the third quarter is fairly modest, particularly compared to the shares added in Q4 2016 and Q1 2017.

If you look at how many shares of each company Berkshire has held over the past two years, it's pretty clear that Berkshire is losing confidence in Big Blue while betting more on the Mac maker.

Chart comparing how many shares of Apple and IBM that Berkshire Hathaway has held over time

Data source: SEC filings. Chart by author.

The numbers of shares held only tell part of the story, though. Berkshire first started buying IBM stock in March 2011, and IBM has performed abysmally relative to the broader market in that time frame. The S&P 500 has nearly doubled, while IBM is down 8% (not including dividends).

IBM Chart

IBM data by YCharts.

In contrast, Apple has outpaced the S&P 500 since the beginning of 2016, and Buffett has already made billions on his position.

^SPX Chart

^SPX data by YCharts.

"I don't value IBM the same way that I did six years ago when I started buying... I've revalued it somewhat downward," Buffett told CNBC in May. Both IBM and Apple sport cheap valuation metrics and strong cash flow relative to other tech companies, which is probably what drew Buffett to the tech giants in the first place.

Hopefully, Berkshire's Apple gains can offset some of its losses on IBM.