Skip to main content
QUICK REVIEW

[论文解读] FinGPT-HPC: Efficient Pretraining and Finetuning Large Language Models for Financial Applications with High-Performance Computing

Xiaoyang Liu, Jie Zhang|arXiv (Cornell University)|Feb 21, 2024
Mathematics, Computing, and Information ProcessingComputer Science被引用 3
一句话总结

该论文提出FinGPT-HPC,一种高性能计算框架,通过低秩分解和混合精度量化技术,显著降低金融应用中大规模语言模型(LLMs)预训练和微调的内存占用与训练时间。通过将标准线性层替换为窄的低秩矩阵,并量化至4位或8位,该方法在预训练中实现高达2.64倍的模型压缩和1.3倍的速度提升,同时在金融微调任务中实现6.3倍的内存减少和24%的准确率增益。

ABSTRACT

Large language models (LLMs) are computationally intensive. The computation workload and the memory footprint grow quadratically with the dimension (layer width). Most of LLMs' parameters come from the linear layers of the transformer structure and are highly redundant. These linear layers contribute more than 80% of the computation workload and 99% of the model size. To pretrain and finetune LLMs efficiently, there are three major challenges to address: 1) reducing redundancy of the linear layers; 2) reducing GPU memory footprint; 3) improving GPU utilization when using distributed training. Prior methods, such as LoRA and QLoRA, utilized low-rank matrices and quantization to reduce the number of trainable parameters and model size, respectively. However, the resulting model still consumes a large amount of GPU memory. In this paper, we present high-performance GPU-based methods that exploit low-rank structures to pretrain and finetune LLMs for financial applications. We replace one conventional linear layer of the transformer structure with two narrower linear layers, which allows us to reduce the number of parameters by several orders of magnitude. By quantizing the parameters into low precision (8-bit and 4-bit), the memory consumption of the resulting model is further reduced. Compared with existing LLMs, our methods achieve a speedup of 1.3X and a model compression ratio of 2.64X for pretaining without accuracy drop. For finetuning, our methods achieve an average accuracy increase of 6.3% and 24.0% in general tasks and financial tasks, respectively, and GPU memory consumption ratio of 6.3X. The sizes of our models are smaller than 0.59 GB, allowing inference on a smartphone.

研究动机与目标

  • 解决金融应用中大规模语言模型(LLMs)预训练和微调带来的高计算与内存开销问题。
  • 减少Transformer线性层中的冗余,这些层占计算量的80%以上,模型参数量的99%以上。
  • 最小化分布式训练过程中的GPU内存占用并提升GPU利用率。
  • 实现在金融数据集上高效微调大规模语言模型,同时保持极低的准确率下降和内存消耗。
  • 通过将模型尺寸压缩至0.59 GB以下,使大型金融LLM可在边缘设备上部署。

提出的方法

  • 将Transformer架构中的标准线性层替换为两个窄的低秩线性层(A和B),将参数量减少数个数量级。
  • 对预训练权重应用低秩分解,以初始化一个压缩后的低秩LLM,实现高效预训练。
  • 采用混合精度量化(4位和8位)进一步压缩模型尺寸并减少GPU内存使用。
  • 使用梯度检查点技术减少训练过程中峰值中间激活内存占用。
  • 实施流水线模型并行训练,以提升多GPU环境下的GPU利用率。
  • 在微调阶段,冻结预训练权重,并在并行路径中添加低秩适配器,仅训练低秩参数。

实验结果

研究问题

  • RQ1对线性层进行低秩分解是否能显著减少大规模语言模型中的可训练参数数量,同时不损失性能?
  • RQ24位和8位量化在金融LLM的预训练和微调过程中,能在多大程度上减少GPU内存占用?
  • RQ3所提出的方法是否能在保持或提升金融任务和通用NLP任务准确率的同时,实现更快的训练和推理速度?
  • RQ4低秩微调与量化结合在实现大规模LLM高效微调并减少内存消耗方面效果如何?
  • RQ5所生成的模型是否可压缩至适合在移动设备或边缘设备上部署的尺寸?

主要发现

  • 在GPT2-1.5B的预训练中,该方法实现了1.3倍的速度提升和2.64倍的模型压缩比,且准确率无下降。
  • 在Llama2-13B的微调中,该方法在金融任务上实现了24.0%的平均准确率提升,GPU内存占用减少6.3倍。
  • 该方法将模型尺寸压缩至0.59 GB以下,实现了在智能手机上的本地推理。
  • 在通用NLP任务上,采用低秩微调的Llama2-13B模型在8位量化下实现了15.5%的平均准确率提升。
  • 4位量化的Llama2-13B-r8模型将内存使用从26.2 GB减少至9.8 GB,实现11.8倍的压缩比。
  • 由于模型尺寸减小和计算效率提升,GPT2-1.5B的推理速度提升1.9倍,GPT2-127M的推理速度提升1.2倍。

阅读本论文

在 Nubint 阅读器中打开原文,边读边就任意段落提问。

在 Nubint 中阅读本论文

本解读由 AI 根据论文原文生成,引用前请核对原文。