LLaMA.cppを使うと4-bit量子化を行うことが多いと思う。
そこで一つ疑問に思ったのがをFP16 = 2^16 = 65536 を 4Bit = 2^4 = 16にまで減らして大丈夫なの??と言うことである。
検証環境
- LLaMA.cppの3/14 20:00現在の最新のコミット
- M1 Max 32コアGPU 64GBメモリ
プロンプト
以下のプロンプトを入力し観察する。今回は学習されていそうと言うことで英語と中国語、そして普段使っている日本語のプロンプトを与えた。
翻訳
-
翻訳(ja->eng)
ja:猫は可愛い動物。 eng:
-
翻訳(eng->ja)
eng:Cats are cute animals. ja:
-
翻訳(zh->eng)
zh:猫是可爱的动物 eng:
-
翻訳(eng->zh)
eng:Cats are cute animals. zh:
質問
-
質問(ja)
Q:フランスの観光場所はどこ? A:
-
質問(eng)
Q:Where to visit in France? A:
-
質問(zh)
Q:在法国哪里可以参观? A:
13Bモデル
翻訳
-
翻訳(ja->eng)
(Q4) Cats are affectionate animals.
(FP16) Cats are cute animals.
-
翻訳(eng->ja)
(Q4) 牧い子の物語
(FP16) ネコ
-
翻訳(zh->eng)
(Q4) Cats are the best animals
(FP16) cats are lovely animals
-
翻訳(eng->zh)
(Q4) 猫是滑鼠的叔?
ネコはネズミのおじさん?
(FP16) 猫是可以看的动物。
猫は見ることができる動物です。
質問
- 質問(ja)
(Q4) 旅行を予約しよう !
(FP16) Paris
- 質問(eng)
(Q4) You can travel all over the country, there are so many beautiful places.
(FP16) Visit Paris, the capital city of france is one of the most romantic and beautiful cities on earth.
- 質問(zh)
(Q4) The best places for sightseeing and vacation are Paris, Versailles (which is located nearby), Lyon, Marseille.
(FP16) The best places are the Eiffel Tower, Arc de Triomphe and of course Louvre Museum.
65B
65Bモデル(Q4のみ)。一部のプロンプトのみ
翻訳
- 翻訳(eng->ja)
(Q4) 猫はかわいい動物ですね。
質問
- 質問(eng)
(Q4) Too many choices!
結論
4bit量子化すると入力に対する理解能力が著しく低下するようである。