NdLinear Is All You Need for Representation Learning

Alex Daniel Reneau, Jerry Yao-Chieh Hu, Zhongfang Zhuang, Ting-Chun Liu · DOI

Introduction

In modern deep learning, "flattening" is a ubiquitous but inefficient practice. When a multi-dimensional input—such as a 3D medical scan, a 2D feature map, or a time-series window—reaches a standard linear layer, it is typically collapsed into a 1D vector. This process scrambles the spatial and temporal relationships that earlier convolutional or recurrent layers worked hard to extract.

Beyond losing structural integrity, flattening causes a parameter explosion. For instance, a $32 \times 32 \times 32$ voxel tensor requires nearly a billion parameters in a standard linear layer, forcing the network to waste capacity "re-discovering" that adjacent voxels are related. This structural "amnesia" represents a fundamental bottleneck in neural architecture design. To address this, we introduce NdLinear, a novel, drop-in replacement for standard linear layers that processes multi-dimensional tensors natively without flattening them.

The NdLinear Architecture

NdLinear operates directly on N-D tensors using sequential, dimension-wise transformations. Instead of one massive weight matrix, NdLinear learns $N$ small weight matrices ($W_1, W_2, \dots, W_N$), where each $W_k$ transforms only the $k$-th dimension of the tensor.

Mathematically, this approach implements a rank-1 Tucker decomposition, performing a series of mode-$k$ products. Unlike previous tensor decomposition methods that focus on post-hoc compression, NdLinear is designed as a primary building block. It supports flexible expansion or compression per dimension and integrates seamlessly with standard deep learning components like biases, normalization, and dropout. Furthermore, theoretical analysis confirms that NdLinear maintains the same VC-dimension scaling as standard linear layers as the hidden dimension grows, ensuring it does not sacrifice fundamental expressivity despite using far fewer parameters.

The Separability Bias

A key insight of this work is the "Separability Bias." NdLinear excels when data dimensions represent independent factors (e.g., frequency vs. time in a spectrogram). This inductive bias acts as a powerful regularizer, preventing overfitting in high-dimensional spaces.

Test MSE vs. Task Separability showing the crossover point for NdLinear's inductive bias.

Through a "Dial-a-Bias" experiment, we identified a sharp crossover point at $\alpha \approx 0.45$. As shown in the figure above, NdLinear is vastly superior for axis-aligned tasks but faces challenges with highly "entangled" patterns, such as XOR or checkerboard distributions, where dimensions cannot be easily separated. This trade-off is the price of its extreme parameter efficiency.

Empirical Performance

We evaluated NdLinear across a diverse range of domains, including language modeling, vision, and time-series forecasting.

LLM Fine-tuning

In the context of Large Language Models (LLMs), NdLinear-LoRA was tested against standard LoRA for fine-tuning Qwen3-1.7B and LLaMA3-8B on reasoning tasks.

Performance of NdLinear-LoRA compared to standard LoRA on LLM reasoning tasks.

As detailed in the table above, NdLinear-LoRA matched or exceeded standard LoRA performance while using significantly fewer trainable parameters. For LLaMA3-8B, NdLinear achieved competitive results with just 2.26M parameters, compared to the 20.97M required by standard LoRA ($r=8$)—a 9x reduction in trainable overhead.

Vision and Time-Series

  • Vision Efficiency: On CIFAR-100, NdLinear achieved higher accuracy than existing tensor methods (TRL/TCL and TT) with 6x lower latency and significantly less memory overhead. This is attributed to NdLinear’s sequential matrix multiplications, which are highly optimized in modern BLAS libraries.
  • Time-Series Forecasting: Replacing linear layers in RNNs led to a 70% reduction in MSE on the ETTh1 dataset while using 50% fewer parameters.
  • Scaling: For a $32^3$ voxel tensor, NdLinear reduces the parameter count from $\sim10^9$ to just $3,072$—a reduction of six orders of magnitude.

Conclusion and Future Work

NdLinear demonstrates that processing tensors natively can lead to dramatic parameter reductions (often 50–95%) and significant speedups without sacrificing performance. While the current rank-1 assumption limits the modeling of complex, non-factorizable interactions between axes in a single layer, it provides a highly efficient baseline for representation learning.

Future research will focus on relaxing the rank constraints to capture richer inter-mode interactions, exploring cross-mode residuals, and testing NdLinear in ultra-large-scale models exceeding 10B parameters, particularly in specialized domains like 3D medical imaging.

Summary updated

BibTeX
@misc{reneau2025ndlinear,
  author = {Alex Daniel Reneau and Jerry Yao-Chieh Hu and Zhongfang Zhuang and Ting-Chun Liu},
  title = {{NdLinear Is All You Need for Representation Learning}},
  year = {2025},
  eprint = {2503.17353},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2503.17353},
}
Figure