At least one sci-fi novel iirc had an AI spam filter achieve sentience, because the task basically amounted to contrastive-learning a model of humanity.
That’s one of Peter Watt’s Rifters trilogy, I think maybe the second one? Been a few years since I read them. I think it’s a biological neural net, not an Ai per se. Lots of big ideas in those books, but not a lot of optimism and some rough stuff.