Non-Convex Portfolio Optimization via Energy-Based Models: A Comparative Analysis Using the Thermodynamic HypergRaphical Model Library (THRML) for Index Tracking
Javier Mancilla, Theodoros D. Bouloumis, Frederic Goguikian
TL;DR
This paper tackles index tracking under cardinality constraints by reframing the problem as probabilistic inference over an Ising Hamiltonian and solving it with THRML’s GPU-accelerated block Gibbs sampling. The method encodes asset quality as external biases and diversification as antiferromagnetic couplings, with a dynamic coupling that adapts to market volatility via the VIX. Empirical results on a 100-stock S&P 500 universe (2023–2025) show a tracking error of 4.31% and a total return of 128.63% (vs 79.61% for the index), with Diebold-Mariano tests indicating strong statistical significance ($p<0.0001$). These findings suggest energy-based models can robustly balance tracking performance and diversification, offering a scalable, probabilistic alternative to deterministic convex or heuristic portfolio optimizers and providing groundwork for real-time exploration on future probabilistic hardware.
Abstract
Portfolio optimization under cardinality constraints transforms the classical Markowitz mean-variance problem from a convex quadratic problem into an NP-hard combinatorial optimization problem. This paper introduces a novel approach using THRML (Thermodynamic HypergRaphical Model Library), a JAX-based library for building and sampling probabilistic graphical models that reformulates index tracking as probabilistic inference on an Ising Hamiltonian. Unlike traditional methods that seek a single optimal solution, THRML samples from the Boltzmann distribution of high-quality portfolios using GPU-accelerated block Gibbs sampling, providing natural regularization against overfitting. We implement three key innovations: (1) dynamic coupling strength that scales inversely with market volatility (VIX), adapting diversification pressure to market regimes; (2) rebalanced bias weights prioritizing tracking quality over momentum for index replication; and (3) sector-aware post-processing ensuring institutional-grade diversification. Backtesting on a 100-stock S and P 500 universe from 2023 to 2025 demonstrates that THRML achieves 4.31 percent annualized tracking error versus 5.66 to 6.30 percent for baselines, while simultaneously generating 128.63 percent total return against the index total return of 79.61 percent. The Diebold-Mariano test confirms statistical significance with p less than 0.0001 across all comparisons. These results position energy-based models as a promising paradigm for portfolio construction, bridging statistical mechanics and quantitative finance.
