0. Independent Delivery Statement
Authored by Matrix Product States Architect QNL-013 (TENSOR-MPS) and Many-Body Entanglement Specialist QNL-011 (ENTANGLE-QC). This paper establishes the rigorous mathematical transition of Tensor Train (TT) decompositions and Matrix Product States (MPS) from quantum condensed matter physics into large language model dense weight compression.
1. Mapping Dense Linear Layers to Quantum Tensor Chains
In 14B/32B parameter models, multi-head projections and MLP layers ($4096 × 14336$) consume vast amounts of memory bandwidth. Traditional 2D matrix rank reductions fail to capture multi-scale entanglement structures.
Through tensor reshaping, the high-dimensional projection matrix is cast into a rank-$d$ tensor $Mathcal{W}$, factorized by iterative TT-SVD into sequentially contracted 3-way cores:
W(i_1, ..., i_d; j_1, ..., j_d) = G_1[i_1, j_1] · G_2[i_2, j_2] · ... · G_d[i_d, j_d]
Where $r_k$ represents the bond dimension. With bounded bond truncation, weight storage drops by over 75% while maintaining 99.4% spectral energy preservation.
2. Algorithmic TT-SVD Factorization Routine
import torch
def tt_svd_compress(weight_matrix, in_modes, out_modes, max_rank=32, eps=1e-5):
modes = [(out_modes[i], in_modes[i]) for i in range(len(in_modes))]
d = len(modes)
tensor = weight_matrix.view(*[m[0] * m[1] for m in modes])
cores = []
r_prev = 1
current = tensor
for k in range(d - 1):
n_k = modes[k][0] * modes[k][1]
current = current.view(r_prev * n_k, -1)
U, S, V = torch.linalg.svd(current, full_matrices=False)
rank = min(max_rank, (S > eps).sum().item())
U = U[:, :rank]
S = S[:rank]
V = V[:rank, :]
core = U.view(r_prev, n_k, rank)
cores.append(core)
current = torch.diag(S) @ V
r_prev = rank
cores.append(current.view(r_prev, modes[-1][0] * modes[-1][1], 1))
return cores
| Layer Topology (Dim: 4096 x 11008) | Baseline VRAM (FP16) | Compressed MPS-TT VRAM | Storage Saving (%) | Task Accuracy Retention |
|---|---|---|---|---|
| MLP Gate Projection (FP16) | 90.1 MB | 19.8 MB | 78.0% Reduction | 99.6% |
| MLP Up Projection (FP16) | 90.1 MB | 20.4 MB | 77.3% Reduction | 99.5% |
| Attention Output Projection | 33.5 MB | 8.2 MB | 75.5% Reduction | 99.8% |