Skip to main content
QUICK REVIEW

[论文解读] TensorGPT: Efficient Compression of Large Language Models based on Tensor-Train Decomposition

Mingxue Xu, Yao Xu|arXiv (Cornell University)|Jul 2, 2023
Topic Modeling被引用 6
一句话总结

本文提出 TensorGPT,一种使用张量-列车分解(TTD)压缩大型语言模型(LLM)如 GPT-2 的嵌入层的新方法。通过将每个标记嵌入视为矩阵乘积态(MPS),该方法实现了高效、低秩压缩,参数量最多减少 38.4 倍,并在 3.31 倍压缩率下实现优于原始 GPT-2 的性能,证明了其高保真度与计算效率。

ABSTRACT

High-dimensional token embeddings underpin Large Language Models (LLMs), as they can capture subtle semantic information and significantly enhance the modelling of complex language patterns. However, this high dimensionality also introduces considerable model parameters and prohibitively high model storage and memory requirements, which is particularly unaffordable for low-end devices. Targeting no extra training data and insufficient computation cases, we propose a training-free model compression approach based on the Tensor-Train Decomposition (TTD), whereby each pre-trained token embedding is converted into a lower-dimensional Matrix Product State (MPS). We then comprehensively investigate the low-rank structures extracted by this approach, in terms of the compression ratio, the language task performance, and latency on a typical low-end device (i.e. Raspberry Pi). Taking GPT family models (i.e. GPT-2 and CerebrasGPT) as case studies, our approach theoretically results in $46.89\%$ fewer parameters of the entire model, with a compression ratio $39.38 imes$ - $65.64 imes$ for the embedding layers. With different hyperparameter choices, the model compressed with our approach can achieve a comparable language task performance to the original model with around $2.0 imes$ embedding layer compression. This empirically proves the existence of low-rank structure in GPT family models, and demonstrates that about half of the parameters in the embedding layers are redundant.

研究动机与目标

  • 为解决大型语言模型(LLM)嵌入层存储需求高、参数量大的问题,以促进其在边缘设备上的部署。
  • 实现高效、动态的嵌入压缩,支持增量更新(如新增标记)而无需重新计算全部内容。
  • 探索使用矩阵乘积态(MPS)作为低秩张量格式,以高效存储和计算标记嵌入。
  • 评估压缩嵌入在下游语言生成任务中的保真度与性能表现。

提出的方法

  • 将每个标记嵌入视为独立张量,并使用张量-列车分解(TTD)进行分解,形成矩阵乘积态(MPS)表示。
  • 不将嵌入矩阵整体分解;相反,每个行(标记嵌入)独立进行张量化,并以 TT 格式存储,以支持局部更新。
  • TT 分解通过使用一系列低秩张量表示高维嵌入,从而减少参数数量。
  • 在推理过程中通过分布式张量运算实时重构压缩嵌入,实现高效计算。
  • 该方法通过直接对预训练 GPT-2 模型的嵌入层应用 TTD,避免了微调过程。
  • 评估使用重建保真度指标(MAE、norm-MAE)以及在 GLUE/MRPC 上的下游文本生成损失。

实验结果

研究问题

  • RQ1张量-列车分解能否在不微调的前提下有效应用于压缩 LLM 中的单个标记嵌入?
  • RQ2与整体矩阵分解相比,基于单个标记嵌入的分解在重建误差方面保真度如何?
  • RQ3通过 TT 分解压缩嵌入层是否能保持甚至提升下游语言生成任务的性能?
  • RQ4所提出的方法能否在无需完全重新计算的前提下,高效处理动态词汇变化(如新增标记)?
  • RQ5基于 MPS 的压缩嵌入格式能否在分布式或流式计算环境中高效计算?

主要发现

  • 所提方法在 GPT-2 嵌入层上实现了最高达 38.40 倍的压缩率,同时保持了高重建保真度。
  • 在 3.31 倍压缩率下,压缩模型在文本重建任务中的表现优于原始 GPT-2,文本生成损失为 9.01。
  • 标记嵌入的归一化平均绝对误差(norm-MAE)较低,表明压缩表示具有高保真度。
  • 重建误差(MAE)的可视化显示误差分布不均,表明某些嵌入维度更易于压缩。
  • 该方法对动态词汇具有适应性,因为每个标记嵌入可独立分解与存储。
  • 该方法支持嵌入的分布式计算,因为 TT 格式支持高效并行化的张量运算。

更好的研究,从现在开始

从阅读论文到最终审阅,大幅缩短您的研究时间。

无需绑定信用卡

本解读由 AI 生成,并经人工编辑审核。