Upgrade to Pro — share decks privately, control downloads, hide ads and more …

[SNLP2024] Tuning Language Models by Proxy

Shun Kiyono
August 07, 2024
250

[SNLP2024] Tuning Language Models by Proxy

Shun Kiyono

August 07, 2024
Tweet

Transcript

  1. 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をし たい 大変なので サボりたい
  2. LLMのFinetuningは大変 • ハードウェアの問題 • GPUが大量に必要 • 実装の問題 • 事前学習用のフレームワークではFinetuningはできない •

    Megatron-LMではどうにもならない • アルゴリズムの関係で実装が複雑になりがち • RLHF (PPO):4つのモデルコピーが必要、途中で生成が発生、etc… • DPO:2つのモデルコピーが必要 • 小さなモデルで動く実装は大きなモデルで動かないがち • どうやって1TモデルのFinetuningをすればいい? • 重みにアクセスできない問題 • 商用LLMの重みは公開されてないので、そもそもFinetuning不可 第16回最先端NLP勉強会
  3. この図を理解すれば大丈夫 第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と同 じ効果を 期待
  4. 式で書くと… 第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 を サボりたい
  5. 実験設定 • 小規模LLM:7B Llama2(-Chat) • Proxyの計算に使う • 大規模LLM:{13B, 70B} Llama2(-Chat)

    • Proxyを適用する先 • データセット:一般的に使われているやつ • AlpacaFarm • 指示追従性能の評価 • GSM • 計算問題 • ToxiGen • モデルが有害な文を生成するか? • TruthfulQA • ハルシネーションの評価 • コード生成の実験もあるが割愛 第16回最先端NLP勉強会 モデルの学習は一切 行っていない 既存のモデルの 足し引きだけ
  6. 実験結果 • タスクによってはFinetuningする場合 (directly tuned)と遜色ない性能 • ただし13Bのdirectly tuned == 70Bの

    proxy tuned • 13BをFinetuningできるならそれが一番良さそう... 第16回最先端NLP勉強会
  7. 分析:どこが影響を受けるか? • 生成中の系列のどこが影響を 受けるか調査 • 系列の先頭はほとんど 書き換えられる • 後半になるほど書き換えの 確率は下がる

    • 後半は補正なしで良いのでは? • 途中で補正をサボると生成が 破綻する • 繰り返しが止まらなくなる 第16回最先端NLP勉強会
  8. 補正のデメリット:推論時間の増加 • ロジットの補正は毎時刻必要 • 大モデルのforward計算 • 補正前小モデルのforward計算 • 補正後小モデルのforward計算 •

    普通に大モデルで推論する場合 と比較しても遅い • 対策:実装の工夫 • 投機的サンプリングと組み合わ せれば隠蔽できそう? 第16回最先端NLP勉強会 小モデルと大モデルで 推論を 速くする手法
  9. まとめ(再掲) 第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と同 じ効果を 期待