Meta Platforms Inc. and Microsoft Corp. have both taken drastic actions to trim their workforces in an effort to streamline their operations and offset heavy spending on artificial intelligence.