LoRA

> An important paradigm of natural language processing consists of large-scale pre-training on general domain data and adaptation to particular tasks or domains. As we pre-train larger models, full fine-tuning, which retrains all model parameters, becomes less feasible. Using GPT-3 175B as an example -- deploying independent instances of fine-tuned models, each with 175B parameters, is prohibitively expensive. We propose Low-Rank Adaptation, or LoRA, which freezes the pre-trained model weights and injects trainable rank decomposition matrices into each layer of the Transformer architecture, greatly reducing the number of trainable parameters for downstream tasks. Compared to GPT-3 175B fine-tuned with Adam, LoRA can reduce the number of trainable parameters by 10,000 times and the GPU memory requirement by 3 times. LoRA performs on-par or better than fine-tuning in model quality on RoBERTa, DeBERTa, GPT-2, and GPT-3, despite having fewer trainable parameters, a higher training throughput, and, unlike adapters, no additional inference latency. We also provide an empirical investigation into rank-deficiency in language model adaptation, which sheds light on the efficacy of LoRA. We release a package that facilitates the integration of LoRA with PyTorch models and provide our implementations and model checkpoints for RoBERTa, DeBERTa, and GPT-2 at this https URL.

自然言語処理の重要なパラダイムは、一般的なドメインデータに対する大規模な事前学習と、特定のタスクやドメインへの適応からなる。
Probrem
GPT-3 175Bを例にとると、175Bのパラメータを持つ微調整されたモデルの独立したインスタンスを配置することは、法外なコストがかかることがわかる
我々は、Low-Rank Adaptation(LoRA)を提案します。これは、事前に学習したモデルの重みを凍結し、学習可能なランク分解行列をTransformerアーキテクチャの各層に注入し、下流のタスクの学習パラメータ数を大きく削減するものです。
Adamでfine-tuningしたGPT-3 175Bと比較すると、LoRAは学習可能なパラメータ数を1万分の1に、GPUのメモリ使用量を3分の1に削減することができます
LoRAはRoBERTa, DeBERTa, GPT-2, GPT-3において、学習可能なパラメータ数が少ないにもかかわらず、モデルの品質は微調整と同等かそれ以上であり、高い学習スループットと、アダプタと異なり追加の推論レイテンシがないことを示しました
また、言語モデル適応におけるランク不足の実証実験を行い、LoRAの有効性を明らかにする。
LoRAとPyTorchモデルの統合を容易にするパッケージを公開し、RoBERTa, DeBERTa, GPT-2の実装とモデルのチェックポイントをこのhttpsのURLで提供しています。
2023/1/23
Dreamboothを名乗ってはいるがかなり違う技術なのでは

GPT-3のような数十億のパラメーターを持つ微調整をするには莫大な金額がかかる
応用
Dreamboothよりも
少ないVRAMで
これどこに書いてあるんだろ?

2倍以上高速に学習ができる
>Fine-tune Stable diffusion models twice as fast than dreambooth method, by Low-rank Adaptation
最終結果は1-6MBになるので気軽に共有できる
> U-Net の一部のみ fine tune する
>出来上がるもの単体では使用することができず、既存のモデルとマージして使う。
差分のみを保存しているのでサイズが小さい、使うためにはマージが必要
>@kohya_tech: WebUI用のLoRA extensionできた(・∀・) リポジトリを作ってドキュメントを書いたら明日公開します。
>あまり努力したくないのでモデルファイル指定欄は単なるテキストボックスだし、数も五個で固定だけど、いやーやればできるもんだな……。
>
差分を取るということで色んな活用法がある
差分を負の方向に効かせることでネガティブプロンプトのように使う
とても分かりやすい

Stable Diffusionに応用されて使われていることを興味深く見ていた
ユーザーから出た現状の問題点(余計な特徴まで学習するとかLoRAを複数使うと
burn outするとか)に対して、作者と話してみると言っていたので、もしかしたらLoRAで大きな進歩がこれから来るかも(来ないかも)
カオスになってきたので一回まとめたいけれど、そんな技量はない🫠
