Slide 1

Slide 1 text

Tuning Language Models by Proxy 読む人:清野 舜 (SB Intuitions) (図は元論文からの引用)

Slide 2

Slide 2 text

LLMをFinetuningしたい 第16回最先端NLP勉強会 Preprint Figure 1: Proxy-tuning “ tunes” a large pretrained model without accessing its internal weights, by steering it using an “ expert” (a small tuned model) and its corresponding “ anti-expert” (the small model, untuned). The difference between the predicted logits of the expert and the anti-expert is applied as an offset on the original logits from the base LLMの Finetuningをし たい 大変なので サボりたい

Slide 3

Slide 3 text

LLMのFinetuningは大変 • ハードウェアの問題 • GPUが大量に必要 • 実装の問題 • 事前学習用のフレームワークではFinetuningはできない • Megatron-LMではどうにもならない • アルゴリズムの関係で実装が複雑になりがち • RLHF (PPO):4つのモデルコピーが必要、途中で生成が発生、etc… • DPO:2つのモデルコピーが必要 • 小さなモデルで動く実装は大きなモデルで動かないがち • どうやって1TモデルのFinetuningをすればいい? • 重みにアクセスできない問題 • 商用LLMの重みは公開されてないので、そもそもFinetuning不可 第16回最先端NLP勉強会

Slide 4

Slide 4 text

提案手法:Proxy-Tuning • 大きなモデルの代理 (proxy) として小さいモデルをFinetuningする • 推論時は1トークンごとに補正をおこなう 第16回最先端NLP勉強会 Preprint

Slide 5

Slide 5 text

この図を理解すれば大丈夫 第16回最先端NLP勉強会 Preprint Figure 1: Proxy-tuning “ tunes” a large pretrained model without accessing its internal weights, by steering it using an “ expert” (a small tuned model) and its corresponding “ anti-expert” (the small model, untuned). The difference between the predicted logits of the expert and the anti-expert is applied as an offset on the original logits from the base LLMの Finetuningをし たい 大変なので サボりたい まず小さいLM をFinetuning 元モデルとの 差分を記録 LLMのlogitを 補正 Finetuningと同 じ効果を 期待

Slide 6

Slide 6 text

式で書くと… 第16回最先端NLP勉強会 Figure 1: Proxy-tuning weights, by steering it “ anti-expert” (the sma the expert and the ant model, to guide it in the scale. The logits show LLA M A 2-7B (from top Figure 1: Proxy-tuning “ tunes” a large weights, by steering it using an “ expert “ anti-expert” (the small model, untuned the expert and the anti-expert is applied Figure 1: Proxy-tuning “ tunes” a large pretrained model without ac weights, by steering it using an “ expert” (a small tuned model) and ポイント① 補正は毎時刻 必要 ポイント② 語彙の一致を 仮定 これのfinetuning を サボりたい

Slide 7

Slide 7 text

実験設定 • 小規模LLM:7B Llama2(-Chat) • Proxyの計算に使う • 大規模LLM:{13B, 70B} Llama2(-Chat) • Proxyを適用する先 • データセット:一般的に使われているやつ • AlpacaFarm • 指示追従性能の評価 • GSM • 計算問題 • ToxiGen • モデルが有害な文を生成するか? • TruthfulQA • ハルシネーションの評価 • コード生成の実験もあるが割愛 第16回最先端NLP勉強会 モデルの学習は一切 行っていない 既存のモデルの 足し引きだけ

Slide 8

Slide 8 text

実験結果 • タスクによってはFinetuningする場合 (directly tuned)と遜色ない性能 • ただし13Bのdirectly tuned == 70Bの proxy tuned • 13BをFinetuningできるならそれが一番良さそう... 第16回最先端NLP勉強会

Slide 9

Slide 9 text

分析:どのトークンが影響を受けるか? • 補正前後の確率分布を比べてみる • 主として議論を組み立てたり、回答のスタイルを制御するものが多い 第16回最先端NLP勉強会

Slide 10

Slide 10 text

分析:どこが影響を受けるか? • 生成中の系列のどこが影響を 受けるか調査 • 系列の先頭はほとんど 書き換えられる • 後半になるほど書き換えの 確率は下がる • 後半は補正なしで良いのでは? • 途中で補正をサボると生成が 破綻する • 繰り返しが止まらなくなる 第16回最先端NLP勉強会

Slide 11

Slide 11 text

補正のデメリット:推論時間の増加 • ロジットの補正は毎時刻必要 • 大モデルのforward計算 • 補正前小モデルのforward計算 • 補正後小モデルのforward計算 • 普通に大モデルで推論する場合 と比較しても遅い • 対策:実装の工夫 • 投機的サンプリングと組み合わ せれば隠蔽できそう? 第16回最先端NLP勉強会 小モデルと大モデルで 推論を 速くする手法

Slide 12

Slide 12 text

手法をどう解釈するべきか? • 著者いわく、広義のアンサンブル • 既存の方法論を今の問題設定に使ってみた? • 推論時のモデルマージ 第16回最先端NLP勉強会 入力文を使って確率を補正 [See+2017] 訓練データを使って確率を補正 [Khandelwal+2020]

Slide 13

Slide 13 text

手法をどう解釈するべきか? • 著者いわく、広義のアンサンブル • 既存の方法論を今の問題設定に使ってみた? • 推論時のモデルマージ 第16回最先端NLP勉強会 Task Vector [Ilharco+2023]

Slide 14

Slide 14 text

まとめ(再掲) 第16回最先端NLP勉強会 Preprint Figure 1: Proxy-tuning “ tunes” a large pretrained model without accessing its internal weights, by steering it using an “ expert” (a small tuned model) and its corresponding “ anti-expert” (the small model, untuned). The difference between the predicted logits of the expert and the anti-expert is applied as an offset on the original logits from the base LLMの Finetuningをし たい 大変なので サボりたい まず小さいLM をFinetuning 元モデルとの 差分を記録 LLMのlogitを 補正 Finetuningと同 じ効果を 期待

Slide 15

Slide 15 text

感想 • 既存の方法論を今の問題設定にうまく使っている • ただし性能的には微妙 • モデルの大規模化による性能向上が、提案手法の性能低下で 打ち消されてしまっている • 様々な事情で大きなLLMを作らないといけないケースはあり、 そのFinetuningに使えるかも • 例:様々な企業が1TパラメータLLMの開発に挑戦中 第16回最先端NLP勉強会