[Paper Review] TraDE: Transformers for Density Estimation
TraDE introduces a self-attention-based autoregressive density estimator using Transformers for continuous and discrete data, trained via penalized maximum likelihood to improve sample quality and robustness. It achieves state-of-the-art log-likelihood performance and superior downstream task results on tabular and image benchmarks, outperforming normalizing flows and RNN-based models in generation, OOD detection, and noise robustness.
We present TraDE, a self-attention-based architecture for auto-regressive density estimation with continuous and discrete valued data. Our model is trained using a penalized maximum likelihood objective, which ensures that samples from the density estimate resemble the training data distribution. The use of self-attention means that the model need not retain conditional sufficient statistics during the auto-regressive process beyond what is needed for each covariate. On standard tabular and image data benchmarks, TraDE produces significantly better density estimates than existing approaches such as normalizing flow estimators and recurrent auto-regressive models. However log-likelihood on held-out data only partially reflects how useful these estimates are in real-world applications. In order to systematically evaluate density estimators, we present a suite of tasks such as regression using generated samples, out-of-distribution detection, and robustness to noise in the training data and demonstrate that TraDE works well in these scenarios.
Motivation & Objective
- To develop a flexible, scalable autoregressive density estimator that handles both continuous and discrete data without invertibility constraints.
- To improve sample quality and generalization beyond log-likelihood by evaluating on real-world downstream tasks.
- To demonstrate that self-attention mechanisms are well-suited for density estimation, especially in capturing long-range dependencies.
- To systematically evaluate density estimators beyond log-likelihood using regression, OOD detection, and noise robustness benchmarks.
Proposed method
- TraDE uses a Transformer architecture with self-attention to model conditional densities in an autoregressive manner, processing features sequentially.
- It employs an RNN-based input embedding to represent the history of previously generated variables, enabling effective context modeling.
- The model is trained using a penalized maximum likelihood objective to improve generalization and prevent overfitting.
- Self-attention allows the model to attend to relevant past variables without storing high-dimensional sufficient statistics, unlike RNNs.
- The architecture avoids the need for invertible flows or Jacobian computation, enabling greater flexibility than normalizing flows.
- It supports both continuous and discrete data through appropriate conditional distribution parameterization in the output head.
Experimental results
Research questions
- RQ1Can a Transformer-based architecture achieve state-of-the-art performance in autoregressive density estimation for continuous and discrete data?
- RQ2How do density estimates from TraDE perform in real-world downstream tasks such as regression and out-of-distribution detection?
- RQ3To what extent is TraDE robust to noisy training data compared to existing methods?
- RQ4Does self-attention provide advantages over RNNs in modeling long-range dependencies in autoregressive density estimation?
- RQ5How well does log-likelihood correlate with practical utility in downstream applications?
Key findings
- TraDE achieves a test log-likelihood of -11.98 nats on the HEPMASS dataset, outperforming NSF (-14.51) and RNN-based models.
- In regression using generated samples, TraDE achieved an MSE of 0.780 on HEPMASS, closely matching real data (0.773), while a standard Transformer scored 1.37.
- The two-sample test accuracy for distinguishing real vs. generated data was 51±1% for TraDE, significantly lower than the 88±15% for a standard Transformer, indicating higher sample quality.
- TraDE achieved an average precision of 0.98 on Pendigits, 0.95 on ForestCover, and 1.0 on Satimage-2 for out-of-distribution detection, surpassing NADE, NICE, and TAN.
- On noisy training data (10% noise), TraDE maintained a log-likelihood of -12.43 nats, showing comparable robustness to NSF despite higher performance on clean data.
- Ablation studies confirm that the combination of self-attention and RNN-based input embedding is key to TraDE’s performance, with ablations showing significant drops in downstream task accuracy.
Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.