Abstract
Language models have recently been shown capable of performing regression wherein numeric predictions are represented as decoded strings. In this work, we provide theoretical grounds for this capability and furthermore investigate the utility of causal sequence decoding models as numeric regression heads given any feature representation. We find that, despite being trained in the usual way - for next-token prediction via cross-entropy loss - decoder-based heads are as performant as standard pointwise heads when benchmarked over standard regression tasks, while being flexible enough to capture smooth numeric distributions, such as in the task of density estimation.
Introduction
Traditional regression in machine learning typically relies on pointwise estimation (e.g., minimizing Mean Squared Error) or parametric distribution modeling (e.g., Gaussian Mixture Models). Pointwise models lack uncertainty quantification, while parametric models often fail to capture the complexity of real-world, non-Gaussian distributions. Histogram-based (Riemann) heads offer flexibility but suffer from the "curse of dimensionality"; achieving high precision requires a large number of bins, which leads to data sparsity and noise sensitivity in low-data regimes.
This paper explores an alternative: Decoding-based Regression Heads. By treating numeric regression as a sequence-generation task—decoding numbers digit-by-digit—we can leverage the autoregressive power of Transformers to represent complex distributions with high precision and data efficiency.
Methodology
The proposed architecture replaces the standard linear regression head with a small Transformer decoder attached to a feature encoder $\phi(x)$.
Tokenization and Training
Numbers are represented using two primary schemes: Normalized (base-$B$ expansion for values in $[0, 1]$) and Unnormalized (scientific-notation style). The model is trained using standard cross-entropy loss for next-token prediction. During inference, the model autoregressively decodes tokens. The final prediction can be the mode (via beam search) or the mean/median of multiple samples. Theoretical analysis shows that this process acts as an iterative refinement of a histogram, where each additional token exponentially increases the resolution.
Key Insights and Results
A critical advantage of decoding-based heads is their efficiency in representing high-resolution distributions. Decoding $K$ tokens in base $B$ allows for $B^K$ distinct values, far outperforming standard classification heads which would require $B^K$ separate output neurons.
Implicit Regularization and Data Efficiency
In low-data regimes, traditional histogram (Riemann) heads often overfit to noise because few samples fall into each bin. In contrast, the shared parameters of the decoder across the sequence structure provide implicit regularization. The model tends to produce smoother, more generalized distributions rather than fitting local noise.
Benchmarking
The authors evaluated the approach across synthetic curve fitting, real-world tabular regression, and density estimation tasks. Key findings include:
- Competitive Performance: Decoding heads matched or exceeded the performance of MSE-based pointwise heads on standard tabular benchmarks like AMLB and OpenML.
- Robust Density Estimation: Unlike Mixture Density Networks (MDNs), which can be unstable, decoding heads consistently provided reliable Negative Log-Likelihood (NLL) scores across various tasks.
- Handling Discontinuities: The models excelled at fitting functions with abrupt changes or step patterns, likely due to the lack of reliance on global $y$-normalization.
Discussion
While decoding-based regression offers significant advantages in flexibility and precision, it introduces sampling overhead due to its autoregressive nature. Future work may address this through parallel decoding techniques or by exploring the integration of these heads into larger multimodal models where numeric reasoning and natural language are interleaved.
Summary updated