Google parent company Alphabet reported first quarter earnings for 2018 today, beating Wall Street estimates on sales and profit thanks in large part to its mammoth search advertising machine that continues to grow year after year. But one interesting highlight from the earnings announcement was just how much money the company’s smart home company Nest earns in revenue and reports in losses.

Because Nest was rolled back into Google proper earlier this year, Alphabet recast its quarterly earnings figures for 2017 to account for the fact that Nest revenues and losses would be moved from the “Other Bets” section of Alphabet’s business to the standard Google revenue line item. Comparing the differences in quarterly revenues and operating income, we can see that Nest made about $726 million in revenue, yet it ultimately contributed a $621 million loss to the “Other Bets” section throughout the year. In other words, Google spent more than half a billion dollars last year to establish Nest in sectors like security cameras, alarm systems, and video doorbells.

Nest made $726 million in revenue last year, but recorded $621 million in losses

As pointed out by Variety’s Janko Roettgers, it’s likely Google is similarly spending hundreds of millions of dollars, if not billions, on its other hardware efforts like Google Home and Pixel phones, earbuds, and laptops. With each one of those product categories, Google is competing with a different tech industry juggernaut. With phones, Google is taking on Apple and the iPhone. With the Pixelbook and other Chrome-powered laptops, Google is taking on Microsoft. But perhaps most importantly, with Google Home and Nest, the company is taking on Amazon, the clear market leader in the smart home thanks to its Echo line and the pervasiveness of its Alexa digital assistant.

Google has shown that it’s more than willing to spend the money necessary to establish itself in saturated markets like laptops and smartphones. But nobody expects the Pixel line of phones to ever outsell the iPhone, least of all Google leadership. Yet where the company does have a clear advantage and an opportunity to catch up to Amazon is in artificial intelligence-powered devices, like smart speakers.

That’s precisely why Nest was folded back into Google, so that its smart home devices could make better use of the AI features being built exclusively for Google hardware and software products like the Pixel 2 and Google Assistant. “All of Google’s investments in machine learning and AI, they can very clearly benefit Nest products. It just makes sense to be developing them together,” Rick Osterloh, the head of Google’s hardware division, told CNET in an interview at the time of the Nest announcement. “It’s the natural thing to evolve to.”

Of course, Google has the money to spend. Alphabet generated around $31.15 billion in sales during the first quarter, compared to $24.75 billion from the same time a year ago. In terms of profit, Alphabet earned $9.4 billion, compared to just $5.43 billion last year. So the core business is still doing astonishingly well, giving Google enough capital to make these kinds of long-term hardware investments that bank on an increasingly symbiotic relationship between the smart home and AI. But as we can see from these new numbers — a rare insight into one of Google’s more ancillary businesses — it’s clear the battle against a company as big and formidable as Amazon costs quite a lot. And it’s not going to end any time soon.