Balancing massive AI R&D spending with near-term profitability