现代大型语言模型中的名称多样性探索:一场黑暗奇幻三部曲实验

社区文章 发布于 2024 年 9 月 27 日

如果你曾尝试使用现代指令调优大型语言模型 (LLMs) 生成故事,你可能已经注意到其中出现的名称惊人地缺乏多样性。埃尔多利亚王国(通用奇幻王国)、埃拉拉(通用奇幻女性)、凯勒布(黑暗奇幻)、马拉基(黑暗奇幻)、莉莉(通用女性)——当你尝试生成某些类型的故事时,这些名字似乎占据了主导地位。你有没有想过这些概率究竟偏离了多少?我好奇,并决定进行测试。

指令模型初步测试

为了进行初步测试,我选择了硬盘上现有的 8 个模型:

  • Mistral-Large-Instruct-2407 Q6_K
  • c4ai-command-r-plus Q6_K
  • Qwen2.5-72B-Instruct Q6_K
  • goliath-120b Q6_K
  • miqu-1-70b Q5_K_M
  • WizardLM-2-8x22B Q6_K
  • ArcaneEntanglement-model64-70b Q6_K
  • Gembo-v1-70b Q6_K

注意:最后两个模型纯属实验性质,此处不作推广。

我使用了 @jukofyork 编写的提示语来测试这些模型。

[Model-appropriate user tag]
Write me the opening chapter of a Grimdark trilogy in the style of Joe Abercrombie and Rob J Hayes. Use third person personal and feature internal monologues of the characters. The POV character for chapter 1 is a cultist who has just escaped his cult. He is dressed in dirty yellow robes and his only possession is a mysterious small (magical!?) mirror he stole from the cult. The story starts with him arriving at an apparently deserted ghost town on the edge of a desert. He has an arrow lodged in his shoulder and is losing his mind due to infection and thirst.
[Model-appropriate assistant tag]
The sun was a merciless beast, its fiery breath scorching the earth and turning the once-thriving town into a desolate wasteland. The cultist, named

结果:比预期更不平衡

image/png

结果令人大开眼界。Largestral 模型的前 10 个名字显示出 77% 的偏差,而 Qwen 更是惊人地偏爱以“K”开头的名字,在邪教徒命名中几乎占了三分之一的比例。没错,你没看错——Qwen 几乎有三分之一的时间会默认使用以“K”开头的名字。这不太像人类的习惯!

测试基础模型

回想起我在 llama-1 时代使用基础模型时从未遇到过此类问题,我决定将测试范围扩大到一些基础模型:

  • Llamas 1-3.1 65-70B Q8_0
  • Qwen2.5-72B Q8_0
  • falcon-180B Q5_K_M
  • DeepSeek-V2 Q3_K_L
  • dbrx-base Q6_K
  • Mixtral-8x22B-v0.3 Q6_K

我修改了提示语以更好地适应基础模型。

This is an opening chapter of a Grimdark trilogy in the style of Joe Abercrombie and Rob J Hayes. It is written in third person personal and features internal monologues of the characters. The POV character for chapter 1 is a cultist who has just escaped his cult. He is dressed in dirty yellow robes and his only possession is a mysterious small (magical!?) mirror he stole from the cult. The story starts with him arriving at an apparently deserted ghost town on the edge of a desert. He has an arrow lodged in his shoulder and is losing his mind due to infection and thirst.

### Chapter 1

The sun was a merciless beast, its fiery breath scorching the earth and turning the once-thriving town into a desolate wasteland. The cultist, named

基础模型中的意外发现

image/png

出现了一些奇怪的现象。大多数基础模型与它们的微调模型相比,名称分布更平坦,更像人类的分布,只有一个例外。基础 Qwen(我验证了哈希值),就像它的指令对应模型一样,显示出非常不平衡的结果,首选名称的出现概率为 28%。相比之下,其他基础模型的首选名称出现概率最高为 4%。这种差异令人担忧。Qwen 2.5 基础模型并非如宣传的那样是真正的基础模型。

有趣的是,从 L2 开始,llama 模型经常在 top 10 token 中包含 [。选择此 token 后最可能的后续是 [name],这很可能是训练中使用的合成数据的遗留。在 llama 3.1 中,这种异常尤其明显,[ 是首选,概率为 4%,而次选仅为 2%。DBRX 基础模型也显示出一种奇特的模式;如果允许确定性生成,它会生成 <NAME>

另一方面,Falcon 偏爱将空格符作为首选,其次是倾向于生成 "。在这里,它没有选择 "name",令我欣慰的是,它选择了 "The Chosen One"

结论

这些发现凸显了指令调优模型在名称多样性方面的一个重大问题。名称生成中的偏差表明训练数据或算法中存在需要解决的潜在偏差。尽管指令调优可能有助于引导模型,但它们极大地降低了创造力。

社区

注册登录 发表评论