用小模型检测多语言文本和代码生成,速度快精度高。
DuoLens: A Framework for Robust Detection of Machine-Generated Multilingual Text and Code
- 用RoBERTA和CodeBERTa等小模型微调,专注检测生成内容。
- 准确率高达AUROC 0.97~0.99,比大模型快8-12倍、显存少3-5倍。
- 对改写、重命名等对抗攻击仍保持92%以上性能,适合实际部署。
大型语言模型生成多语言文本和源代码的现象日益普遍,亟需高效且精准的内容检测工具。现有检测器多采用零样本方法(如Fast DetectGPT或GPTZero),普遍存在计算开销高或准确率不足的权衡问题。为此,我们提出对仅使用编码器的小型语言模型(SLMs)进行微调,利用专用于源代码和自然语言的训练数据,证明在二分类任务中,SLMs相较大模型表现显著更优,且仅需极少算力。在512词元输入下,模型实现AUROC 0.97~0.99,宏平均F1达0.89~0.94,延迟降低8-12倍,峰值显存减少3-5倍。在跨生成器迁移及对抗变换(如改写、反向翻译、代码格式化/重命名)下,性能仍保持清洁情况的≥92% AUROC。论文发布完整训练与评估脚本、种子与配置文件,并附可复现性清单。
原文摘要 · Abstract (English)
The prevalence of Large Language Models (LLMs) for generating multilingual text and source code has only increased the imperative for machine-generated content detectors to be accurate and efficient across domains. Current detectors, predominantly utilizing zero-shot methods, such as Fast DetectGPT or GPTZero, either incur high computational cost or lack sufficient accuracy, often with a trade-off between the two, leaving room for further improvement. To address these gaps, we propose the fine-tuning of encoder-only Small Language Models (SLMs), in particular, the pre-trained models of RoBERTA and CodeBERTa using specialized datasets on source code and other natural language to prove that for the task of binary classification, SLMs outperform LLMs by a huge margin whilst using a fraction of compute. Our encoders achieve AUROC $= 0.97$ to $0.99$ and macro-F1 $0.89$ to $0.94$ while reducing latency by $8$-$12\times$ and peak VRAM by $3$-$5\times$ at $512$-token inputs. Under cross-generator shifts and adversarial transformations (paraphrase, back-translation; code formatting/renaming), performance retains $\geq 92%$ of clean AUROC. We release training and evaluation scripts with seeds and configs; a reproducibility checklist is also included.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。