Structured Multidimensional Representation Learning for Large Language Models
Organizations: Universit´e du Littoral Cote d’Opale, LMPA, 50 rue F. Buisson, 62228 Calais-Cedex, France. · FGSES, University Mohammed VI Polytechnic, Rabat, Morocco · LISIC, 50 rue F. Buisson, Universit´e du Littoral Cote d’Opale, 62228 Calais-Cedex, France.
Abstract
Transformer architectures achieve state-of-the-art performance across a wide range of pattern recognition and natural language processing tasks, but their scaling is accompanied by substantial parameter growth and redundancy in the embedding dimension. In this work, we introduce a structured spectral factorization of the embedding space based on the L-product for third-order tensors. By reshaping token representations into spectral tensor slices and performing attention and feed-forward operations in the transform domain, we obtain a Tensor Transformer architecture that decomposes the encoder into p independent spectral sub-transformers while preserving standard Transformer semantics. We prove that the proposed L-Transformer is spectrally equivalent to p parallel Transformers operating on reduceddimensional embeddings, which yields approximately 1/p reduction (up to lower-order terms such as biases and normalization parameters) in encoder parameters under fixed total embedding size. When instantiated with a real-valued Discrete Cosine Transform (DCT), the method remains fully differentiable and compatible with existing training pipelines. Beyond compression, the spectral decomposition introduces an inductive bias over embedding frequencies, enabling slice-dependent frequency scaling that improves generalization. Experiments on IMDB and AGNews show that the proposed model can substantially reduce encoder parameters (up to 75% for p=4) while maintaining competitive accuracy. On IMDB, the tensorized encoder matches or improves upon the standard baseline under compression, whereas on AGNews at moderate width we observe a small accuracy decrease in exchange for a 4 times encoder reduction; at BERT-base width (d=768), performance returns to parity.
Figures & tables
| Method family | What is structured | When applied | Exact vs. approximate | Primary gain / typical limitation |
|---|---|---|---|---|
| Low-rank PEFT (LoRA) [ 7 ] | Weight updates | Fine-tune | Approx. to full fine-tuning | Few trainable parameters; base encoder parameter count unchanged. |
| Post-training rank reduction [ 27 ] | Weights | Post hoc | Approx. modified model | No retraining; accuracy depends on layer selection and rank choice. |
| Tensorized weight compression (TRAWL; CP/Tucker/TT) [ 19 , 13 , 23 , 32 , 6 ] | Weights as tensor factors | Train or post hoc | Approx. factorization | Storage/parameters reduced; may affect optimization and accuracy. |
| Spectral mixing (FNet-like) [ 15 ] | Token mixing operator | Train | Exact transform (different layer type) | Global mixing at low parameter cost; not targeted at exact encoder scaling. |
| This work ( -product tensorization) [ 9 ] | Representations and tensor operators | Train-time reparameterization | Exact slice-wise equivalence (transform domain) | Encoder parameters scale as ; attention-map storage and the attention term remain unchanged; wall-clock gains require batched slice execution. |
| Operation | Standard | Tensor ( -product) |
|---|---|---|
| projections | ||
| Attention scores ( ) | (unchanged) | |
| Attention | (unchanged) | |
| Output projection | ||
| FFN (two layers) | ||
| -transform (DCT/IDCT) | — |
| Component | Value |
|---|---|
| Encoder depth | |
| Tokenizer / vocabulary | BPE, 30,000 types |
| Max sequence length | (identical truncation/padding) |
| Setting | |||
|---|---|---|---|
| IMDB | 128 | 4 | 512 |
| AG News (moderate) | 256 | 4 | 1024 |
| AG News (BERT-width) | 768 | 8 | 3072 |
| Component | Value |
|---|---|
| Optimizer | AdamW (lr , weight decay ) |
| Scheduler | OneCycleLR (10% linear warmup, cosine annealing to ) [ 29 , 28 ] |
| Gradient clipping | |
| Precision | Mixed precision (PyTorch 2.1, torch.cuda.amp ) [ 21 ] |
| Hardware | NVIDIA Tesla T4 (16 GB), CUDA 12.1 |
| Reproducibility | torch.manual_seed , numpy.random.seed , random.seed ; cudnn.deterministic=True |
| Setting | Epochs | Batch size |
|---|---|---|
| IMDB ( ) | 20 | 128 |
| AG News ( ) | 5 | 128 |
| AG News ( ) | 5 | 64 |
| Fixed across all models | Varies (encoder only) |
|---|---|
| Embedding layer (vocabulary ) | Encoder type (Std vs. -product) |
| Classifier head (mean-pool + linear) | Decomposition factor |
| Training recipe (optimizer, scheduler, hyperparameters) | Spectral weighting strategy ( pe ) |
| Data protocol (sequence length , tokenizer, padding/truncation, seeds) | Encoder parameter count (and resulting compression ratio) |
| Dataset | Model | Acc. (%) | Enc. params | Ratio |
|---|---|---|---|---|
| IMDB ( ) | Std (4L, ) | 991 K | ||
| Std-1L (1L, ) | 248 K | |||
| T4-linear (4L, ) | 254 K | |||
| AG News ( ) | Std (4L, ) | 3 949 K | ||
| Std-1L (1L, ) | 987 K | |||
| T4-linear (4L, ) | 1 000 K |
| Model | Acc. (%) | Encoder | Enc. Ratio | |
|---|---|---|---|---|
| Std | — | 991 K | ||
| T4-standard | 4 | 254 K | ||
| T4-learnable | 4 | 270 K | ||
| T4-linear | 4 | 254 K | ||
| T4-exponential | 4 | 254 K | ||
| T4-harmonic | 4 | 254 K |
| Model | Acc. (%) | Encoder | Enc. Ratio | |
|---|---|---|---|---|
| Std | — | 3.95 M | ||
| T4-linear | 4 | 1.00 M | ||
| T4-harmonic | 4 | 1.00 M |
| Model | Acc. (%) | Encoder | Ratio | Mem |
|---|---|---|---|---|
| Std | 28.4 M | 1.95 GB | ||
| T4-linear | 7.1 M | 1.66 GB |
| Component | Std | T4-linear |
|---|---|---|
| Embedding | 23.0 M (45%) | 23.0 M (76%) |
| Encoder | 28.4 M (55%) | 7.1 M (24%) |
| Total | 51.4 M | 30.2 M ( ) |
| Config | Model | Enc. params | Ratio | Train tok/s | Epoch (s) | Peak mem | Batch |
|---|---|---|---|---|---|---|---|
| IMDB | Std | 991 K | 123 K | 26 s | 0.50 GB | 128 / 256 | |
| T4-linear | 254 K | 94 K | 34 s | 0.51 GB | 128 / 256 | ||
| AG News | Std | 3 949 K | 177 K | 87 s | 0.99 GB | 128 / 256 | |
| T4-linear | 1 000 K | 132 K | 116 s | 0.96 GB | 128 / 256 | ||
| AG News | Std | 28 352 K | 60 K | 257 s | 1.95 GB | 64 / 128 | |
| T4-linear | 7 118 K | 64 K | 241 s | 1.66 GB | 64 / 128 |
| Configuration | Std | Best T4 | Enc. Saving | |
|---|---|---|---|---|
| IMDB | (std) | 991 K 254 K | ||
| AG News | (lin) | 3.95 M 1.00 M | ||
| AG News | (lin) | 28.4 M 7.1 M |
Appendix figures & tables5 assets
Supplementary material from the paper’s appendix.
Appendix
| PE strategy | IMDB | AG News |
|---|---|---|
| T4-standard ( ) | — | |
| T4-linear ( ) | ||
| T4-exponential ( ) | — | |
| T4-harmonic ( ) | ||
| T4-learnable | — | |
| Std (baseline) |
| Config | Model | Enc. | Train (s/ep) | Mem (GB) | Infer (s) |
|---|---|---|---|---|---|
| IMDB ( ) | Std | 991 K | 26 | 0.50 | 11.8 |
| T4-standard | 254 K | 34 | 0.51 | 12.7 | |
| T4-linear | 254 K | 34 | 0.51 | 12.6 | |
| T4-harmonic | 254 K | 34 | 0.51 | 12.8 | |
| T4-learnable | 270 K | 34 | 0.51 | 12.8 | |
| T2-linear | 500 K | 29 | 0.49 | 11.9 |
Transformer
Transformers are neural architectures that use attention to model relationships among sequence elements in language, vision, and scientific data.
See all 540 papers