FinGPT-HPC: Efficient Pretraining and Finetuning Large Language Models for Financial Applications with High-Performance Computing
作者: Xiao-Yang Liu, Jie Zhang, Guoxuan Wang, Weiqing Tong, Anwar Walid
分类: cs.LG, cs.AI, cs.CL, cs.DC
发布日期: 2024-02-21
💡 一句话要点
提出FinGPT-HPC以高效预训练和微调金融领域的大型语言模型
🎯 匹配领域: 支柱九:具身大模型 (Embodied Foundation Models)
关键词: 大型语言模型 金融应用 高性能计算 参数量化 低秩结构 模型压缩 分布式训练
📋 核心要点
- 现有方法在大型语言模型的预训练和微调中面临计算冗余和内存占用过高的挑战。
- 本文提出通过替换线性层和参数量化来高效预训练和微调大型语言模型,显著降低内存消耗。
- 实验结果显示,预训练加速1.3倍,模型压缩比2.64倍,微调准确度提升6.3%和24.0%。
📝 摘要(中文)
大型语言模型(LLMs)计算密集,计算负载和内存占用随维度(层宽)呈平方增长。大多数LLMs的参数来自变换器结构的线性层,且高度冗余。这些线性层占据了80%以上的计算负载和99%的模型大小。为高效预训练和微调LLMs,需解决三个主要挑战:1)减少线性层的冗余;2)降低GPU内存占用;3)提高分布式训练时的GPU利用率。本文提出基于高性能GPU的方法,利用低秩结构进行金融应用的LLMs预训练和微调。通过将传统线性层替换为两个更窄的线性层,显著减少参数数量。通过将参数量化为低精度(8位和4位),进一步降低内存消耗。与现有LLMs相比,我们的方法在预训练中实现了1.3倍的加速和2.64倍的模型压缩比,且没有准确度下降。在微调中,我们的方法在一般任务和金融任务中分别提高了6.3%和24.0%的准确度,GPU内存消耗比为6.3倍。我们的模型大小小于0.59 GB,支持在智能手机上进行推理。
🔬 方法详解
问题定义:本文旨在解决大型语言模型在预训练和微调过程中计算冗余和内存占用过高的问题。现有方法如LoRA和QLoRA虽然通过低秩矩阵和量化技术减少了可训练参数和模型大小,但仍然消耗大量GPU内存。
核心思路:论文的核心思路是通过将传统的线性层替换为两个更窄的线性层,显著减少模型参数数量,并通过将参数量化为低精度(8位和4位)进一步降低内存消耗。这样的设计旨在提高计算效率和内存利用率。
技术框架:整体架构包括三个主要模块:1)低秩线性层替换模块;2)参数量化模块;3)分布式训练优化模块。通过这些模块的协同工作,实现高效的预训练和微调。
关键创新:最重要的技术创新在于将传统线性层替换为两个窄线性层的设计,这一方法在减少参数数量的同时,保持了模型的性能。与现有方法相比,这种设计显著降低了内存占用和计算负载。
关键设计:在参数设置上,采用低精度量化(8位和4位)以减少内存消耗;损失函数和网络结构设计上,保持与传统变换器结构的兼容性,以确保模型性能不下降。
🖼️ 关键图片
📊 实验亮点
实验结果表明,本文提出的方法在预训练阶段实现了1.3倍的速度提升和2.64倍的模型压缩比,且没有准确度下降。在微调阶段,针对一般任务和金融任务,准确度分别提高了6.3%和24.0%,同时GPU内存消耗比降低至6.3倍。
🎯 应用场景
该研究的潜在应用领域包括金融分析、智能投资顾问和市场预测等。通过高效的模型设计,能够在资源受限的设备上实现实时推理,提升金融应用的智能化水平,具有重要的实际价值和广泛的市场前景。
📄 摘要(原文)
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.