Why LLMs Are Unreliable Language Detectors

LLMs can translate, explain grammar, and write fluently in dozens of languages — so it seems obvious they should be great at simply identifying what language a text is written in. And for long, clean text in common languages, they usually are. But things fall apart at the edges that show up constantly in real-world use: short snippets, closely related languages, rare languages, mixed-language…