📝

Wizard Vicunaについて調べたメモ

2023/07/07に公開

huggingfaceのllm leaderboardを眺めていて、やっぱりWizard-Vicunaは13Bだけど強い
そもそもwizard周りの手法を詳しく知らなかったので調べたメモ。

https://github.com/melodysdreamj/WizardVicunaLM

Vicuna

ShareGPTのデータを用いてllamaを調整したもの。

特徴は、multi-turn conversationsの考慮していること
https://lmsys.org/blog/2023-03-30-vicuna/#training

WizardLM

evol-instructという手法を使う。evol-instructとは、instruction-input-responseの形式のデータセットのうち、instruct部分をLLMを用いて複雑化や具体化する手法。

evol-instructで新たに作成したデータセットを使い学習する
https://github.com/nlpxucan/WizardLM

WizardVicuna

https://github.com/melodysdreamj/WizardVicunaLM

WizardLMが作成したデータセットを拡張する。この拡張はinstruct/input/output形式ではなく、Vicunaのmulti-turn conversationsとする。multi-turn conversationsへの適応は、ある会話のスタートからchatGPTを用いて様々な会話に派生させたそう。

会話の拡張はGPT3.5を用いた。
https://sharegpt.com/c/6cmxqq0

作成したデータセットを使いfastChatでtraining
https://github.com/lm-sys/FastChat/blob/main/scripts/train_vicuna_13b.sh

WizardVicunaのデータセット

https://huggingface.co/datasets/junelee/wizard_vicuna_70k

データセットの中の1データ。このデータでは更に数ターン会話が続いている。1つの返答がだいぶ長い
gpt返答は文字数1459。tokenizeすると短くなりそう100くらい?

{ "from": "human", "value": "Provide a list of at least four professions that necessitate the utilization of specific software and hardware systems to accomplish their tasks. Ensure that each occupation is distinctive from the others and requires different types of tools for effective job performance." },

{ "from": "gpt", "value": "Sure, here are four professions that require the use of specific software and hardware systems for effective job performance:\n1. Graphic Designer - Graphic designers require specialized software such as Adobe Photoshop, Adobe Illustrator, and Adobe InDesign to create and edit visual content. They also require high-end hardware such as high-resolution monitors, graphics tablets, and powerful workstations to handle complex design projects.\n2. Video Editor - Video editors require specialized software such as Adobe Premiere Pro, Final Cut Pro, and Avid Media Composer to edit and produce high-quality video content. They also require high-end hardware such as powerful workstations, high-resolution monitors, and fast storage devices to handle large video files.\n3. Software Developer - Software developers require specialized software such as Integrated Development Environments (IDEs) like Visual Studio, Eclipse, and Xcode to write, test, and debug code. They also require high-end hardware such as powerful workstations, high-speed processors, and large amounts of RAM to handle complex software projects.\n4. Civil Engineer - Civil engineers require specialized software such as AutoCAD, Civil 3D, and Revit to design and analyze infrastructure projects such as roads, bridges, and buildings. They also require high-end hardware such as powerful workstations, high-resolution monitors, and graphics cards to handle large and complex design projects." },

{ "from": "human", "value": ... }

evol-instruct

evol-instructの手法が面白かったので少し調べた
https://arxiv.org/abs/2304.12244

LLLにinstructionとresponseを再生成させる手法を提案。

進化は以下の3stepからなる。

  1. instruction evolving: LLMを使いin-depth evolivingとin-breadth evolvingの手法を使いinstructionを進化させる
  2. response generation: LLMに進化させたinstructionを与え、responseを生成する
  3. elimination evolving: instructionとresponseを見て、情報量が増えたか、reposne生成可能かという評価から生成されたinstructをフィルターする

In-depth Evolving

指示を複雑、具体化する。
次の5種類の方法を用いる
「制約の追加」、「深化 1 」、「具体化」、「推論ステップの増加」、「複雑化」
(promptはappendix参照)

「1+1=?」というinstructionに対して、以下のような例が挙げられている。
制約の追加: 「How to prove 1 + 1 = 2 in the Goldbach Conjecture?」
深化: 「In what situation does 1+1 not equal to 2?」
具体化: 「If you have one apple and someone gives you another banana, how many fruits do you have?」

In-breadth Evolving

指示の多様性を増やす。突然変異のようなもの。instructionが大きく変わったりする。
その代わり進化に失敗することもあるので、進化したinstructionに対しフィルターを行う。

「1+1=?」が突然変異すると以下のようになる
「What is the speed of light in a vacuum?」
ここから更にIn-depth Evolvingを行う。

elimination evolving

進化の失敗として以下の基準を用いた

  1. chatGPTを使い進化前のinstructionと進化後のinstructionを比較する。情報量が増えてない場合 2
  2. 進化したinstructionから生成したresponseが“sorry”を含み80文字以下の場合
  3. 句読点とストップワードのみの場合
  4. 進化したinstructionが進化させるために用いたプロンプトから単語をコピーしている場合。例えば、"given prompt"、"rewritten prompt"、"#Rewritten Prompt#"など

所感

wizard-vicunaのデータセット初めて見たけど結構長い。複数ターンの会話も割りと良さそう。

LLMでデータセット作れるようになるだろうなと思ってたけど性能もあげるのすごい。
evol-instructを日本でもやってみたいけど、そこまでの性能の日本語喋れるLLMがなぁ...
vicunaっぽいmulti-turn conversationsのデータでloraしたら少しは性能上がるのか試してみたい。

その他

深化に用いたプロンプト

I want you act as a Prompt Rewriter.
Your objective is to rewrite a given prompt into a more complex version to make those famous AI systems
(e.g., ChatGPT and GPT4) a bit harder to handle.
But the rewritten prompt must be reasonable and must be understood and responded by humans.
Your rewriting cannot omit the non-text parts such as the table and code in #Given Prompt#:. Also, please
do not omit the input in #Given Prompt#.
You SHOULD complicate the given prompt using the following method:
If #Given Prompt# contains inquiries about certain issues, the depth and breadth of the inquiry can be
increased. or
You should try your best not to make the #Rewritten Prompt# become verbose, #Rewritten Prompt# can only
add 10 to 20 words into #Given Prompt#.
‘#Given Prompt#’, ‘#Rewritten Prompt#’, ‘given prompt’ and ‘rewritten prompt’ are not allowed to appear in
#Rewritten Prompt#
#Given Prompt#:
<Here is instruction.>
#Rewritten Prompt#:

chatGPTを使った情報量の比較

以下のプロンプトで2つの文章を比較する

Here are two Instructions to ChatGPT AI, do you think they are equal to each other, which meet the
following requirements:
15
1. They have same constraints and requirments.
2. They have same depth and breadth of the inquiry.
The First Prompt: <Here is first instruction.>
The Second Prompt: <Here is second instruction.>
Your Judgement (Just answer: Equal or Not Equal. No need to explain the reason.):

Discussion