用矩阵乘积算子压缩语言模型,显著减少参数量同时保持高精度。
Compressing Transformer Language Models via Matrix Product Operator Decomposition: A Case Study on PicoGPT
- 将Transformer各层权重分解为低秩链式结构,通过张量网络压缩参数
- 在chi=16时仅用19万参数达基线97.7%准确率,压缩比最高达13倍
- 适合资源受限设备部署,尤其对小规模模型如PicoGPT效果突出
基于Transformer的语言模型在自然语言任务中表现优异,但其隐藏维度的二次参数增长使在资源受限硬件上部署成本高昂。本文研究矩阵乘积算子(MPO)作为变压器的系统性压缩方法。MPO将权重矩阵分解为低秩核心链,近似质量由键维数chi控制。我们将PicoGPT(一个约100万参数的GPT-2风格字符级语言模型)中的所有nn.Linear层替换为参数化为MPO链的MPOLinear模块。核心通过预训练密集权重的TT-SVD或随机初始化,并使用标准PyTorch autograd训练,无需自定义反向传播。针对PicoGPT中五种不同权重形状设计平衡分解方案,在Tiny Shakespeare数据集上评估了chi ∈ {4, 8, 16, 32}。MPO压缩在chi=4时每块最多实现13倍压缩。在chi=16时,模型仅需191,872参数(原1,020,224),仍保持52.8%基线的97.7%(51.6%对比52.8%)。重构误差符合预期趋势,三站点分解在相同chi下误差低于两站点。chi=8模型在参数效率上最优,该指标优于密集基线2.7倍。结果表明,MPO参数化是低秩方法和无结构剪枝之外一种实用且理论扎实的Transformer压缩替代方案。
原文摘要 · Abstract (English)
Transformer-based language models achieve strong performance across NLP tasks, but their quadratic parameter scaling with hidden dimension makes deployment on resource-constrained hardware expensive. We study Matrix Product Operator (MPO) decomposition as a principled compression method for transformers. MPO factorises weight matrices into chains of low-rank cores, with approximation quality controlled by the bond dimension chi. We replace every nn.Linear layer in PicoGPT, a GPT-2-style character-level language model with about 1M parameters, with an MPOLinear module parameterised as an MPO chain. Cores are initialised either by TT-SVD from pretrained dense weights or from random initialisation, and trained using standard PyTorch autograd without a custom backward pass. We derive balanced factorisation schemes for the five distinct weight shapes in PicoGPT and evaluate bond dimensions chi in {4, 8, 16, 32} on Tiny Shakespeare. MPO compression achieves up to 13x compression per transformer block at chi = 4. At chi = 16, the model uses 191,872 parameters instead of 1,020,224 while retaining 97.7% of baseline token accuracy (51.6% vs 52.8%). Reconstruction error follows the expected trend and is lower for three-site than two-site factorisations at the same bond dimension. The chi = 8 model gives the best accuracy per parameter, exceeding the dense baseline by 2.7x on this metric. These results show that MPO parameterisation is a practical and theoretically grounded alternative to low-rank methods and unstructured pruning for transformer compression.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。