自制空间光调制器:为葡萄牙语构建的本土自回归与掩码扩散语言模型
Homebrewed SLMs: Autoregressive and Masked Diffusion Language Models Built at Home for Portuguese
AI总结:
本研究在单块消费级GPU上自制了巴西葡萄牙语的自回归与掩码扩散语言模型,通过实验对比了两种模型的性能,验证了其在部分法律任务上优于6元语法下限及部分公共大模型的能力。
摘要:
构建自己的语言模型不再需要数据中心。本教程在一块消费级GPU上从头训练了一个包含分词器的模型,并展示了如何判断其是否适用于专业领域任务。本研究未提出新方法,发布了经过测试的Python包和两个巴西葡萄牙语笔记本,其中包含在单个网络上的自回归与掩码扩散生成、预先注册的比较协议、仅基于文本构建的法律任务(带有Kneser-Ney平滑下限)、公共基准、1100万至1200万参数模型的参考编号,以及仅通过测量发现的缺陷目录。在巴西散文和联邦法律上,每次运行耗时数分钟,自回归模式在相同文本上训练64个epoch后达到峰值,随后开始记忆该文本,而掩码扩散模式则持续改进至256个epoch。在测试的最佳点,扩散模型的似然度比自回归模型高0.06比特每字节,处于预先注册的最小效应范围内。在保留的法律和训练后发布的法案上,该模型在相同窗口的似然度上与6元语法下限相当,在这些法案的续写任务中输给了该下限;在检测篡改文本任务中优于该下限,在填充交叉引用任务中比该下限以及1.6亿和6.3亿参数的公共模型更频繁,仅在训练中缺失的法令类型中,这些评分器保持接近或低于随机水平,且仅当每组权重相同时才在填空任务中表现更好,因为按单个项目计算,其与6.3亿参数模型相当。在法律任务中,使用约5×10²至10⁵倍计算资源训练的公共模型在篡改文本检测和续写任务中领先。盲读人类评估已预先注册,未包含在本版本中。
英文摘要:
Building a language model of one's own no longer requires a data centre. This tutorial trains one from scratch, tokenizer included, on one consumer GPU, and shows how to tell whether it is good for the tasks of a specialist domain. It proposes no new method. It releases a tested Python package and two notebooks in Brazilian Portuguese with autoregressive and masked diffusion generation on one network, a preregistered comparison protocol, legal tasks built from text alone with a Kneser-Ney floor and public yardsticks, reference numbers for models of 11 to 12M parameters, and a catalogue of defects that only measurement revealed. On Brazilian prose and federal laws, at minutes per run, the autoregressive mode peaks at 64 epochs over the same text and then memorises it, while masked diffusion improves up to 256. At their best points on test, the diffusion bound exceeds the autoregressive likelihood by 0.06 bits per byte, within the preregistered minimum effect. On held-out laws and on acts published after training, the model ties a 6-gram floor in likelihood on the same windows, and it loses to the floor at continuing those acts. It beats the floor at detecting tampered text, and fills cross-references more often than the floor and public models of 160M and 630M parameters, only in decrees, a genre absent from training, where those scorers stay near or below chance, and in filling the blank only when each group weighs the same, since per item it ties the 630M model. On laws, the public models, trained with about 5x10^2 to 10^5 times its compute, lead in tampered text and continuation. The blind human reading is preregistered and not part of this version.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。