Language identification is a crucial first step in multilingual systems such as chatbots and virtual assistants, enabling linguistically and culturally accurate user experiences. Errors at this stage can cascade into downstream failures, setting a high bar for accuracy. Yet, existing language identification tools struggle with key cases -- such as music requests where the song title and user language differ. Open-source tools like LangDetect, FastText are fast but less accurate, while large language models, though effective, are often too costly for low-latency or low-resource settings. We introduce PolyLingua, a lightweight Transformer-based model for in-domain language detection and fine-grained language classification. It employs a two-level contrastive learning framework combining instance-level separation and class-level alignment with adaptive margins, yielding compact and well-separated embeddings even for closely related languages. Evaluated on two challenging datasets -- Amazon Massive (multilingual digital assistant utterances) and a Song dataset (music requests with frequent code-switching) -- PolyLingua achieves 99.25% F1 and 98.15% F1, respectively, surpassing Sonnet 3.5 while using 10x fewer parameters, making it ideal for compute- and latency-constrained environments.


翻译:语言识别是多语言系统(如聊天机器人和虚拟助手)中的关键初始步骤,能够实现语言和文化上准确的用户体验。此阶段的错误可能级联导致下游故障,因此对准确性设定了高标准。然而,现有语言识别工具在处理关键案例时存在困难——例如音乐请求中歌曲标题与用户语言不同的情况。开源工具如LangDetect、FastText速度较快但准确性较低,而大型语言模型虽有效,但在低延迟或低资源环境中通常成本过高。我们提出了PolyLingua,一种基于Transformer的轻量级模型,用于域内语言检测和细粒度语言分类。它采用两级对比学习框架,结合实例级分离和类级对齐与自适应边界,即使对于密切相关的语言也能生成紧凑且分离良好的嵌入。在两个具有挑战性的数据集——Amazon Massive(多语言数字助理话语)和Song数据集(频繁语码转换的音乐请求)——上进行评估,PolyLingua分别达到99.25%和98.15%的F1分数,超越了Sonnet 3.5,同时使用参数减少10倍,使其非常适合计算和延迟受限的环境。

0
下载
关闭预览

相关内容

【KDD2024】HiGPT:异构图语言模型
专知会员服务
19+阅读 · 2024年7月9日
如何使用自然语言工具包(NLTK)在Python3中执行情感分析
Python程序员
21+阅读 · 2019年10月28日
国家自然科学基金
18+阅读 · 2017年12月31日
国家自然科学基金
3+阅读 · 2015年12月31日
国家自然科学基金
4+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
1+阅读 · 2014年12月31日
VIP会员
相关基金
国家自然科学基金
18+阅读 · 2017年12月31日
国家自然科学基金
3+阅读 · 2015年12月31日
国家自然科学基金
4+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
1+阅读 · 2014年12月31日
Top
微信扫码咨询专知VIP会员