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.
Glossary
Hierarchical Risk Parity (HRP)

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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
Enabling Efficiency, Speed & Accuracy
Intelligent Analysis, Decision & Execution
We build AI systems for teams that need search across company data, workflow automation across tools, or AI features inside products and internal software.
Talk to Us
Search across company data
Give teams answers from docs, tickets, runbooks, and product data with sources and permissions.
Useful when people spend too long searching or get different answers from different systems.

Automate internal workflows
Use AI to route work, draft outputs, trigger actions, and keep approvals and logs in place.
Useful when repetitive work moves across multiple tools and teams.

Add AI to products and internal tools
Build assistants, guided actions, or decision support into the software your team or customers already use.
Useful when AI needs to be part of the product, not a separate tool.
Related Terms
Explore the core mathematical and methodological concepts that underpin Hierarchical Risk Parity, from the foundational risk decomposition theorems to alternative clustering and allocation techniques.
Euler Decomposition
The mathematical backbone of all risk parity strategies. Euler's theorem for homogeneous functions allows total portfolio risk to be perfectly decomposed into additive contributions from each asset. For a portfolio volatility $\sigma(w)$, the marginal risk contribution (MRC) is the partial derivative $\partial \sigma / \partial w_i$, and the risk contribution (RC) is $w_i \times MRC_i$. The sum of all RCs exactly equals total portfolio volatility, enabling the precise balancing that HRP seeks to achieve without inverting the covariance matrix.
Covariance Shrinkage
A statistical remedy for the estimation error that plagues sample covariance matrices, especially in high-dimensional portfolios. Shrinkage combines the noisy sample matrix with a highly structured target, like constant correlation, using a shrinkage intensity parameter. This pulls extreme eigenvalues toward the center, dramatically improving out-of-sample performance. While HRP avoids direct inversion, robust covariance estimation remains critical for the quasi-diagonalization and recursive bisection steps that define the algorithm.
Risk Factor Parity
An evolution of asset-based parity that balances risk across underlying economic drivers rather than individual securities. Instead of equalizing the risk contribution of stocks and bonds, factor parity targets uncorrelated factors like growth, inflation, and volatility. This addresses a key limitation of naive risk parity: assets that cluster around the same factor can create hidden concentration risk. HRP's clustering step implicitly addresses this by grouping assets with similar return drivers before allocation.
Principal Component Analysis Parity (PCA Parity)
A dimensionality reduction approach that allocates risk equally across the uncorrelated principal components of asset returns rather than the correlated assets themselves. By diagonalizing the covariance matrix, PCA identifies truly independent sources of risk. HRP achieves a similar goal through hierarchical clustering on the correlation matrix, but PCA parity uses a mathematically orthogonal basis. Both methods solve the problem of spurious diversification where seemingly different assets share common risk drivers.
Effective Number of Bets (ENB)
A diagnostic metric that quantifies true diversification by calculating the exponential of the entropy of risk contributions. An equally weighted portfolio of 10 assets might have an ENB of only 3 if most risk concentrates in a few positions. HRP explicitly maximizes this measure by ensuring capital is distributed across genuinely distinct clusters. ENB provides a single, interpretable number to compare the diversification quality of HRP against naive risk parity or mean-variance optimization.
Dynamic Conditional Correlation (DCC)
A time-series model that captures how correlations between assets evolve through market regimes. Unlike static covariance, DCC estimates allow risk parity weights to adapt as relationships shift during crises or bull markets. Integrating DCC with HRP creates a time-varying hierarchical structure where the clustering dendrogram itself updates as correlations change, preventing the portfolio from relying on stale diversification assumptions during periods of market stress.

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.
Partnered with leading AI, data, and software stack.
How We Work
Custom AI workflows for your Business
One-fit-all AI don't work for modern businesses. At Inferensys, we aim to understand your business & custom requirements; which we use to define most efficient agentic workflows, the data, and the tools for your business.
01
Review the use case
We understand the task, the users, and where AI can actually help.
Read more02
Pick the right approach
We define what needs search, automation, or product integration.
Read more03
Build the first useful version
We implement the part that proves the value first.
Read more04
Improve from there
We add the checks and visibility needed to keep it useful.
Read moreThe first call is a practical review of your use case and the right next step.
Talk to Us