参数有效的微调
大语言模型的模型很大,除了在预训练好的模型上 Fine Tuning 模型的参数,我们还可以再简化一点:保持预训练好的模型不变,只是在模型的外层,再训练一个“适配器”,这就是所谓的“参数有效的微调”(PEFT:Parameter Efficient Fine-Tuning)。
PEFT 有很多方法,如 Prompt Tunning、Prefix Tunning、Adapters、LoRA、T-Few(IA3)。详见 Yandex PEFT PPT。
练习
-
Yandex 2023 PEFT ipynb 练习
-
本地数据微调 LLM 教程 :使用 LoRA 微调 Llama-2,将其导出到 ggml,并在 CPU 上运行。
-
Efficient Large Language Model training with LoRA and Hugging Face
-
Efficiently fine-tune Llama 3 with PyTorch FSDP and Q-Lora,4/22/2024, 英伟达(NVIDIA)H100 和英伟达(NVIDIA)A10G GPU 上创建和验证。配置文件和代码针对 4xA10G GPU 进行了优化,每个 GPU 均配备 24GB 内存,英文原文,中文翻译
课程材料
-
斯坦福 CS324 2022 年 Adaptation
-
约翰霍普金斯 UA 2024 Lec 12 Adaptation via tuning
- head-tuning
- prompt-tuning
- adaptors
- LoRA
软件
-
软件 HF PEFT:Parameter Efficient Fine-Tuning,有两种精调的方法,包括:LoRA、Prefix Tuning
-
Axolotl (Wing Lian): framework for fine-tuning LLMs,
- Works with single GPU or multiple GPUs via FSDP or Deepspeed
- Train various Huggingface models such as llama, pythia, falcon, mpt
- Supports fullfinetune, lora, qlora, relora, and gptq
论文
约翰霍普金斯推荐论文
Suggested Reading:
- The Power of Scale for Parameter-Efficient Prompt Tuning
Additional Reading:
- Prefix-Tuning: Optimizing Continuous Prompts for Generation
- Prompt Waywardness: The Curious Case of Discretized Interpretation of Continuous Prompts
- SPoT: Better Frozen Model Adaptation through Soft Prompt Transfer
普林斯顿大学课程论文
- Prompting as parameter-efficient fine-tuning
- Refer
Yandex PPT 提到的论文
- Adapter
- Parameter-Efficient Transfer Learning for NLP
- Adapting BigScience Multilingual Model to Unseen Languages,发现 Adapters can do language adaptation
- Prompt Tuning (2022)
- Guiding Frozen Language Models with Learned Soft Prompts
- The Power of Scale for Parameter-Efficient Prompt Tuning,论文,代码,代码基于 JAX T5X,很容易看懂,跑起来,用 20 K 参数可以指导 11B 参数的模型的行为
- T-Few (IA3)
- AdaLoRA
- MultiTask Prompt Tuning
Index | Previous | Next |