Inferensys

Glossary

Hierarchical Risk Parity (HRP)

A machine learning-based risk parity method that uses hierarchical clustering on a correlation matrix to allocate capital without inverting the covariance matrix.
Risk analyst performing AI risk assessment on laptop, risk matrices visible, casual office risk session.
PORTFOLIO CONSTRUCTION

What is Hierarchical Risk Parity (HRP)?

Hierarchical Risk Parity (HRP) is a modern portfolio optimization method that uses hierarchical clustering on a correlation matrix to allocate capital without requiring the inversion of the covariance matrix, thereby addressing the instability inherent in traditional mean-variance optimization.

Hierarchical Risk Parity (HRP) is a three-stage machine learning algorithm for portfolio construction introduced by Marcos López de Prado. It replaces the problematic matrix inversion step of Markowitz optimization with a recursive bisection of a hierarchical tree structure. The algorithm first computes a distance matrix from asset correlations, then applies agglomerative clustering to form a dendrogram, and finally allocates capital top-down by splitting weights between nested clusters based on their inverse variance, ensuring robust diversification.

Unlike traditional risk parity or mean-variance optimization, HRP does not require a positive-definite covariance matrix, making it immune to the curse of dimensionality and estimation errors in large asset universes. By leveraging the hierarchical structure of the correlation matrix, it naturally groups similar assets and allocates more weight to uncorrelated clusters, producing portfolios that are significantly more stable out-of-sample and resilient to the noise introduced by short estimation windows.

MACHINE LEARNING-DRIVEN RISK ALLOCATION

Key Features of HRP

Hierarchical Risk Parity (HRP) replaces the unstable matrix inversion of traditional risk parity with a three-step machine learning pipeline: clustering, recursive bisection, and variance-based allocation.

01

Hierarchical Tree Clustering

HRP begins by computing a distance matrix from the asset correlation matrix, typically using the transformation d = √(1 - ρ). A linkage method (single, average, or Ward) is then applied to build a hierarchical tree (dendrogram) that groups assets by similarity. This step identifies the natural nested structure in the data without imposing a rigid factor model, making it robust to the curse of dimensionality.

02

Quasi-Diagonalization (Seriation)

The rows and columns of the covariance matrix are reordered to match the leaf order of the dendrogram. This produces a quasi-diagonal matrix where large covariances cluster near the diagonal. This step organizes assets so that similar investments are adjacent, enabling the recursive bisection algorithm to allocate capital efficiently without needing to invert the full covariance matrix.

03

Recursive Bisection Allocation

Starting from the top of the clustered tree, capital is split recursively at each node using inverse-variance weighting on the two sub-clusters. The allocation to each branch is proportional to the inverse of its cluster variance, ensuring that risk is distributed evenly across the hierarchy. This top-down approach avoids the concentration and instability issues of traditional mean-variance optimization.

04

Matrix Inversion-Free Construction

Unlike Markowitz's critical line algorithm or standard risk parity, HRP never requires inverting the covariance matrix. This is a critical advantage when the number of assets N approaches or exceeds the number of observations T (the N > T problem). By avoiding inversion, HRP eliminates the primary source of numerical instability and estimation error that plagues traditional portfolio optimizers.

05

Out-of-Sample Robustness

Empirical studies, including those by López de Prado (2016), demonstrate that HRP delivers lower out-of-sample variance and higher Sharpe ratios than inverse-variance weighting, equal risk contribution, and mean-variance portfolios. The hierarchical structure acts as a regularizer, preventing the optimizer from chasing spurious correlations and producing more stable weights across rebalancing periods.

06

Distance Metric Flexibility

The clustering step can incorporate alternative distance measures beyond the standard correlation-based metric. Practitioners can use tail-dependence coefficients, mutual information from information theory, or partial correlations to capture non-linear dependencies. This flexibility allows HRP to adapt to specific market regimes or asset classes where linear correlation is an insufficient measure of co-movement.

HIERARCHICAL RISK PARITY

Frequently Asked Questions

Clear, technically precise answers to the most common questions about Hierarchical Risk Parity (HRP), the machine learning-based portfolio allocation method that avoids inverting the covariance matrix.

Hierarchical Risk Parity (HRP) is a machine learning-based portfolio allocation method developed by Marcos López de Prado that uses hierarchical clustering on a correlation matrix to allocate capital without requiring the inversion of the covariance matrix. The algorithm operates in three distinct stages: tree clustering, quasi-diagonalization, and recursive bisection. First, it computes a distance matrix from asset correlations and applies single-linkage clustering to form a hierarchical tree (dendrogram) that groups similar assets together. Second, it reorders the covariance matrix so that closely correlated assets appear near each other along the diagonal, creating a quasi-diagonal structure. Finally, it performs a top-down recursive bisection of the clustered tree, allocating weights to each sub-cluster inversely proportional to its variance. This approach elegantly sidesteps the numerical instability and estimation errors inherent in inverting large, ill-conditioned covariance matrices, making it particularly robust for high-dimensional portfolios where traditional mean-variance optimization fails.

Prasad Kumkar

About the author

Prasad Kumkar

CEO & MD, Inference Systems

Prasad Kumkar is the CEO & MD of Inference Systems and writes about AI systems architecture, LLM infrastructure, model serving, evaluation, and production deployment. Over 5+ years, he has worked across computer vision models, L5 autonomous vehicle systems, and LLM research, with a focus on taking complex AI ideas into real-world engineering systems.

His work and writing cover AI systems, large language models, AI agents, multimodal systems, autonomous systems, inference optimization, RAG, evaluation, and production AI engineering.