Skip to main content
QUICK REVIEW

[Paper 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 Science3 citations
TL;DR

This paper proposes FinGPT-HPC, a high-performance computing framework that uses low-rank decomposition and mixed-precision quantization to drastically reduce memory and training time for pretraining and fine-tuning large language models (LLMs) in financial applications. By replacing standard linear layers with narrow low-rank matrices and quantizing to 4-bit or 8-bit, the method achieves up to 2.64× model compression and 1.3× speedup in pretraining, while enabling 6.3× memory reduction and 24% accuracy gain in financial fine-tuning tasks.

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.

Motivation & Objective

  • To address the high computational and memory costs of pretraining and fine-tuning large language models (LLMs) in financial applications.
  • To reduce redundancy in transformer linear layers, which account for over 80% of computation and 99% of model size.
  • To minimize GPU memory footprint and improve GPU utilization during distributed training.
  • To enable efficient fine-tuning of LLMs on financial datasets with minimal accuracy drop and reduced memory consumption.
  • To make large financial LLMs deployable on edge devices by achieving model sizes under 0.59 GB.

Proposed method

  • Replace standard linear layers in the transformer architecture with two narrow low-rank linear layers (A and B), reducing parameter count by orders of magnitude.
  • Apply low-rank decomposition to pretrained weights to initialize a compressed, low-rank LLM for efficient pretraining.
  • Use mixed-precision quantization (4-bit and 8-bit) to further compress model size and reduce GPU memory usage.
  • Employ recomputation techniques to reduce peak intermediate activation memory during training.
  • Implement pipeline model-parallel training to improve GPU utilization across multiple GPUs.
  • For fine-tuning, freeze pretrained weights and add a low-rank adapter in a parallel path, training only the low-rank parameters.

Experimental results

Research questions

  • RQ1Can low-rank decomposition of linear layers significantly reduce the number of trainable parameters in LLMs without sacrificing performance?
  • RQ2To what extent can 4-bit and 8-bit quantization reduce GPU memory footprint during pretraining and fine-tuning of financial LLMs?
  • RQ3Can the proposed method achieve faster training and inference times while maintaining or improving accuracy on financial and general NLP tasks?
  • RQ4How effective is the combination of low-rank adaptation and quantization in enabling fine-tuning of large LLMs with reduced memory consumption?
  • RQ5Can the resulting models be compressed to sizes suitable for deployment on mobile or edge devices?

Key findings

  • For pretraining GPT2-1.5B, the method achieved a 1.3× speedup and 2.64× model compression ratio with no accuracy drop.
  • For fine-tuning Llama2-13B, the method achieved a 24.0% average accuracy increase on financial tasks and a 6.3× reduction in GPU memory footprint.
  • The method reduced model size to under 0.59 GB, enabling on-device inference on smartphones.
  • On general NLP tasks, fine-tuned Llama2-13B models with low-rank adaptation achieved a 15.5% average accuracy increase with 8-bit quantization.
  • The 4-bit quantized Llama2-13B-r8 model reduced memory usage from 26.2 GB to 9.8 GB, achieving a 11.8× compression ratio.
  • Inference speed improved by 1.9× for GPT2-1.5B and 1.2× for GPT2-127M due to reduced model size and efficient computation.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.