Portfolio LabKnowledgeSign inCreate account

Hierarchical risk parity: building portfolios from clusters

Advanced9 min read · updated 3 September 2026 · 4 sources

Hierarchical risk parity (HRP) is a portfolio construction method that Marcos López de Prado introduced in 2016. It first sorts the assets into groups (clusters) according to their correlations and then allocates the capital from the top down: between groups according to their risk, and within groups according to inverse variance. The covariance matrix does not need to be inverted for this. That makes HRP robust to estimation errors.

Why a new method?

Classic Markowitz optimization requires the inverse of the covariance matrix. If many assets are highly correlated with one another, this matrix is ill-conditioned: small errors in the estimated correlations lead to large swings in the weights, often with extreme positions or short sales. Michaud (1989) therefore called optimizers error maximizers, and DeMiguel et al. (2009) showed that many optimization models do not reliably beat simple equal weighting out of sample.

Equal weighting and inverse volatility are stable but ignore correlations entirely. Ten almost identical equity indices would together receive ten times as much weight as a single bond. HRP sits in between: it uses the structure of the correlations, but without the delicate inversion.

The algorithm in three steps

  1. Clustering: each correlation ρ is turned into a distance d = √((1 − ρ) / 2). Highly correlated assets lie close together. A hierarchical clustering method merges the nearest assets and groups step by step; the result is a tree (dendrogram).
  2. Quasi-diagonalisation: the assets are sorted in the order of the leaves of this tree. Similar assets now sit next to each other, and large covariances gather near the diagonal of the matrix.
  3. Recursive bisection: the sorted list is split in half. Each half receives a cluster variance V (with inverse-variance weights within the half). The capital is allocated in the ratio α = 1 − V₁ / (V₁ + V₂) to the first half and 1 − α to the second. This is repeated within each half until single assets remain.
distance: d_ij = √((1 − ρ_ij) / 2) cluster variance: V = wᵀ Σ_C w with w_i ∝ 1 / σ_i² split: α = 1 − V₁ / (V₁ + V₂)
ρ_ij
correlation of two assets
Σ_C
covariance matrix of the assets in a cluster
α
share of capital for the first half

The result: groups with lower risk receive more capital, but a group of ten similar equity indices is treated as one group and not overweighted tenfold. All weights are positive.

Worked example with four assets

Two equity indices (volatility 16% and 18%, correlation 0.9) and two bond indices (5% and 6%, correlation 0.8); the correlation between each equity and each bond index is 0.1. The distances are 0.22 within the equities, 0.32 within the bonds and 0.67 between the two groups. The tree therefore separates equities from bonds straight away.

The tree is built as follows: the clustering method first joins the two equity indices (distance 0.22), then the two bond indices (0.32) and finally the two groups (0.67). The sorted order is therefore equities 1, equities 2, bonds 1, bonds 2. The first bisection separates exactly the two groups, and the second separates the two indices within each group.

How the capital is split from the top of the tree down

Figures from the worked example below. The height of a branch point corresponds to the distance (0.22 within the equities, 0.32 within the bonds, 0.67 between the groups), and the line thickness to the share of capital. The first bisection splits according to the cluster variances, the second within each cluster according to inverse variance.

MethodEquities 1Equities 2Bonds 1Bonds 2Volatility
HRP4.96%3.92%53.78%37.35%5.05%
Minimum variance (unconstrained)8.24%−1.87%87.18%6.45%4.88%
Inverse volatility12.89%11.46%41.26%34.38%5.91%
Risk parity (equal risk contributions)12.63%11.23%41.53%34.61%5.87%

The minimum variance portfolio achieves the lowest volatility, at least with the estimated figures. To do so, it puts almost everything into one bond index and even goes short the second equity index, because the two equity indices are so similar that the optimization hedges one against the other. A small change in the correlation of 0.9 can reverse this picture. HRP comes close to the minimum in terms of volatility but spreads the capital more calmly.

Advanced: properties and variants

  • No inversion: HRP works only with diagonal elements within the clusters and with cluster variances. It therefore also works when the covariance matrix is singular, for example when there are more assets than observations.
  • Dependence on the tree: the original method uses single linkage; other linkage methods (average, Ward) produce different trees and therefore different weights. Recursive bisection splits the sorted list in the middle, not necessarily along the branches of the tree. Variants such as hierarchical equal risk contribution follow the branches.
  • No return target: HRP does not use expected returns. It is a method for allocating risk, related to risk parity and inverse variance, not to risk-return optimization.
  • Stability: because small changes in correlations usually only shift the fine structure of the tree, the weights change less from month to month than with mean-variance optimization. The method is not completely stable, though: if an asset jumps into a different cluster, its weight changes markedly.

In our example, HRP is very close to pure inverse variance (5.22% / 4.13% / 53.50% / 37.15%) because the groups are clearly separated. The difference grows when a cluster has many members: inverse variance would count ten similar equity indices ten times, whereas HRP treats them as one group.

What the research shows

López de Prado (2016) presents HRP as an answer to three weaknesses of quadratic optimizers: instability, concentration and poor out-of-sample performance. In his Monte Carlo experiments, HRP has a lower out-of-sample variance than Markowitz's critical line algorithm, even though the latter explicitly aims for minimum variance.

“HRP does not require the invertibility of the covariance matrix.”
López de Prado (2016)

López de Prado (2018) describes the method in more detail, with code and further machine learning methods. The fundamental problems that HRP addresses are well documented: Michaud (1989) on error maximization and DeMiguel et al. (2009) on the strength of naive equal weighting out of sample. How well HRP performs in real portfolios compared with shrunk covariance matrices or simple weighting schemes depends heavily on the data set; there is no evidence of an overall winner.

In practice: data, frequency and implementation

For HRP you need the same ingredients as for any risk-based weighting: a history of returns from which volatilities and correlations are estimated. Monthly returns over five years are a common starting point; daily returns provide more observations, but for assets in different time zones they are out of sync and then underestimate the correlation. The cluster structure of equities, bonds and commodities is usually stable for years, while the weights within the clusters shift with the volatilities.

The weights are typically recalculated monthly or quarterly. Because HRP reacts more calmly than mean-variance optimization, turnover usually stays low. A tolerance band (only reallocate when a weight deviates markedly from its target) lowers costs further, as described in the article on rebalancing. If you want to combine HRP with a return target, scale the portfolio afterward: for example with leverage to a target volatility, or by mixing it with an equity portfolio.

Limitations and common mistakes

  • Simulations are not practice: the advantages come mainly from Monte Carlo studies with known distributions. With real, changing correlations, the differences from simple methods are often small.
  • The covariance is still estimated: HRP is more robust, but not immune to bad data. Short histories and outliers also distort the clusters.
  • Few assets, little benefit: with three or four clearly separated asset classes, HRP hardly differs from inverse variance. Its advantage shows with many similar assets.
  • No leverage, no return target: if you want to achieve a particular return or volatility, you have to scale the result afterward.

How Portfolio Lab calculates

Portfolio Lab does not yet offer HRP as a separate objective. The Optimization tool has three methods that require no return estimates: “Risk parity (equal risk contributions)”, “Min. variance” and “Max. diversification”; by default, the covariance matrix is estimated with Ledoit-Wolf shrinkage, which also mitigates the instability of the sample matrix. Minimum and maximum weights can be used to limit extreme positions; short sales are excluded. The out-of-sample test is handled by the rolling mode. How this works in detail is described in the optimization methodology.

Frequently asked questions

What is hierarchical risk parity?

A method that sorts assets into groups according to their correlations and allocates capital from the top down according to the risk of the groups, without inverting the covariance matrix.

Is HRP better than Markowitz?

In simulations with estimation errors, HRP was more stable and less volatile out of sample. With real data, the advantage is smaller and depends on the data set.

What is the difference from risk parity?

Risk parity seeks equal risk contributions from all assets and needs the full covariance matrix to do so. HRP allocates hierarchically between groups and uses inverse variance within the groups.

Which distance does HRP use?

d = √((1 − ρ) / 2). A correlation of 1 gives a distance of 0, and a correlation of −1 a distance of 1.

Which assets are suitable for HRP?

Above all, many assets, some of them similar, such as dozens of country or sector indices. With a few clearly separated asset classes, the result hardly differs from simple inverse variance.

Can I calculate HRP in Portfolio Lab?

Not directly yet. Risk parity with Ledoit-Wolf estimation and weight limits comes closest to the goal of a robust risk allocation.

Literature

  1. DeMiguel, Victor; Garlappi, Lorenzo; Uppal, Raman (2009): Optimal Versus Naive Diversification: How Inefficient is the 1/ N Portfolio Strategy?. Review of Financial Studies 22 (5), pp. 1915–1953. doi:10.1093/rfs/hhm075
  2. López de Prado, Marcos (2016): Building Diversified Portfolios that Outperform Out of Sample. The Journal of Portfolio Management 42 (4), pp. 59–69. doi:10.3905/jpm.2016.42.4.059
  3. López de Prado, Marcos (2018): Advances in Financial Machine Learning. Wiley.
  4. Michaud, Richard O. (1989): The Markowitz Optimization Enigma: Is 'Optimized' Optimal?. Financial Analysts Journal 45 (1), pp. 31–42. doi:10.2469/faj.v45.n1.31

Full bibliography

This article explains a method; it is not investment or tax advice. Worked examples are simplified and rounded. All terms in the glossary.