English

Training Transformers in Cosine Coefficient Space

Performance 2026-04-10 v2 Artificial Intelligence

Abstract

Linear layers hold most of a transformer's parameters. We replace each linear layer with one that stores KK out of mnmn two-dimensional DCT coefficients per weight matrix and reconstructs the full matrix through an inverse DCT at every forward pass; the KK coefficients are the trainable parameters. A 4-layer, 128-dim transformer trained from scratch on character-level Shakespeare reaches validation loss 1.6041.604 at K=mn/2K = mn/2, against 1.5801.580 for a standard dense baseline -- a gap of +0.024+0.024 at half the trainable parameter count, within the terminal-epoch variation of the dense run. A rank-48 LoRA factorization at the same trainable parameter count reaches only 1.8011.801 (+0.221+0.221). The structural advantage of sparse-coefficient over low-rank parameterizations at matched KK is qualitative. We identify rank flexibility as the mechanism. A random orthonormal basis matches the DCT within noise at K=mn/2K = mn/2, and a compression sweep through K=mn/10K = mn/10 and K=mn/20K = mn/20 shows that subspaces that can host high-rank matrices keep the loss low, while subspaces that flatten into a low-rank block (zigzag-selection variants) converge onto the observed stable rank \emph{and} the loss line of the rank-48 LoRA reference in lock-step. Among these orthonormal bases, the DCT is preferred because its separable fast transform admits a fused reconstruction kernel: the materialized weight matrix never leaves on-chip memory, so the parameter saving translates into a bandwidth saving as well.

Keywords

Cite

@article{arxiv.2604.04440,
  title  = {Training Transformers in Cosine Coefficient Space},
  author = {Mohamed Amine Bergach},
  journal= {arXiv preprint arXiv:2604.04440},
  year   = {2026}
}
R2 v1 2026-07-01T11:54:57.938Z