On the interplay between data structure and loss function in classification problems

Stéphane d'Ascoli, Marylou Gabrié, Levent Sagun, Giulio Biroli

Abstract

One of the central puzzles in modern machine learning is the ability of heavily overparametrized models to generalize well. Although the low-dimensional structure of typical datasets is key to this behavior, most theoretical studies of overparametrization focus on isotropic inputs. In this work, we instead consider an analytically tractable model of structured data, where the input covariance is built from independent blocks allowing us to tune the saliency of low-dimensional structures and their alignment with respect to the target function. Using methods from statistical physics, we derive a precise asymptotic expression for the train and test error achieved by random feature models trained to classify such data, which is valid for any convex loss function. We study in detail how the data structure affects the double descent curve, and show that in the over-parametrized regime, its impact is greater for logistic loss than for mean-squared loss: the easier the task, the wider the gap in performance at the advantage of the logistic loss. Our insights are confirmed by numerical experiments on MNIST and CIFAR10.

Introduction

Modern machine learning operates predominantly in the "overparameterized" regime, where the number of model parameters significantly exceeds the number of training samples. Contrary to classical statistical intuition, these models often exhibit excellent generalization properties rather than catastrophic overfitting. A significant portion of theoretical research into this phenomenon has relied on the assumption of isotropic data—where features are distributed uniformly in all directions. However, real-world data, such as images or text, is inherently anisotropic, residing on low-dimensional manifolds where certain features are far more salient than others.

This paper addresses the critical gap between idealized isotropic theory and structured reality. We investigate how the alignment between a dataset's underlying structure and the target task influences generalization. Specifically, we compare the performance of Square Loss versus Logistic Loss in these structured environments, revealing that the choice of loss function is not merely a technical detail but a fundamental determinant of performance in overparameterized models.

Methodology and Data Modeling

To analyze these effects, we utilize a Random Feature (RF) model, a two-layer neural network where the first layer's weights are fixed and random, and only the output layer is trained. This setup effectively captures the "lazy learning" dynamics observed in many deep learning scenarios.

Central to our study is the "Strong and Weak Features" model. We represent data using a block-covariance structure that allows us to independently control the saliency (the variance or "strength" of a feature subset) and the alignment (the degree to which these salient features correlate with the ground-truth labels).

Figure 1: (a) Schematic of the Random Feature model. (b) The structured data model illustrating isotropic, aligned, and misaligned feature configurations.

We employ the replica method from statistical physics to derive exact asymptotic expressions for training and test errors. This approach, combined with an extension of the Gaussian Equivalence Theorem (GET) for anisotropic data, provides a rigorous framework for predicting model behavior as the number of features and data points scale to infinity. Our theoretical predictions are further validated through experiments on synthetic data and real-world datasets like MNIST and CIFAR-10, where PCA-based preprocessing is used to tune task difficulty.

Key Insights: Alignment and Loss Functions

Our analysis reveals that the alignment between salient features and labels is a primary driver of generalization. In "easy" tasks, where labels are determined by high-variance (strong) features, models generalize rapidly. Conversely, when labels depend on low-variance (weak) features—a "misaligned" setup—the task becomes significantly harder, resembling a "needle in a haystack" problem.

A pivotal finding is the distinct behavior of different loss functions in the face of this structure. While Square Loss attempts to match exact target values, Logistic Loss functions as an implicit regularizer. In overparameterized settings, Logistic Loss focuses on correctly separating classes rather than minimizing a distance to a fixed target. This property allows it to effectively "shield" the model from the overfitting peaks typically associated with the interpolation threshold.

Results: The "Easy Task" Gap and Double Descent

The impact of data structure is most visible in the "double descent" curve, which plots error against the ratio of parameters to data points ($P/D$).

Figure 5: Comparison of test loss and test error for Square Loss (left) and Logistic Loss (right) under true labels and noisy labels. The curves show the performance for Aligned (green), Isotropic (blue), and Misaligned (orange) data structures.

As shown in Figure 5, Square Loss exhibits a sharp overfitting peak at the interpolation threshold ($P=N$). In contrast, Logistic Loss significantly suppresses this peak, particularly in noiseless scenarios. Furthermore, we observe an "Easy Task Gap": as the task becomes easier (better alignment), the performance advantage of Logistic Loss over Square Loss grows. Logistic Loss is inherently better at detecting and exploiting the underlying low-dimensional structure of the data. In the overparameterized "kernel regime" ($P \to \infty$), Logistic Loss consistently achieves lower test error than square loss on aligned, structured data.

Discussion and Limitations

While our work provides a precise characterization of lazy learning in structured environments, several avenues for future research remain. Our focus on Random Feature models does not account for "active" feature learning, where the first layer also adapts during training. Recent studies suggest that active learning might interact differently with data dimensionality, potentially narrowing the gap between loss functions in certain regimes.

Additionally, while the replica method is a powerful and widely accepted tool in the physics community, providing a full formal mathematical proof for this specific anisotropic model remains an open challenge. Finally, extending these insights from binary classification to multi-class problems will be essential for a comprehensive understanding of modern deep learning architectures.

Summary updated

BibTeX
@inproceedings{dascoli2021interplay,
  author = {Stéphane d'Ascoli and Marylou Gabrié and Levent Sagun and Giulio Biroli},
  title = {{On the interplay between data structure and loss function in classification problems}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2021},
}
Figure