hi_class

Horndeski in the Cosmic Linear Anisotropy Solving System

An Einstein-Boltzmann solver for dark energy and modified gravity.

99 papers v3.3.4.4 pip install hiclassy built on CLASS ascl:1808.010

News

Recent developments

  • hi_class v3.3.4.4 was released, rebuilt on CLASS v3.3.4. The beyond-Horndeski (GLPV) and conformally coupled Galileon models are now part of the public code. hiclassy on PyPI carries the same version: v3.3.4.4 · PyPI

  • Single Scalar Field Dark Energy: 2026 Status Report, a review talk on where the field stands, by Carlos García-García and William Wolf. video

  • The Python wrapper was published on PyPI as hiclassy, so pip install hiclassy is all it takes to drive hi_class from a script. PyPI

  • DESI put out modified-gravity constraints from the full-shape modelling of its 2024 clustering measurements, computed with hi_class. JCAP 09 (2025)

All news

The Science

Cosmology for general scalar-tensor gravity

hi_class implements Horndeski's theory in the modern Cosmic Linear Anisotropy Solving System. Any background or linear cosmological observable can be computed, including FRW distances, CMB, matter power and number count spectra. hi_class can be readily interfaced with Monte Python to test gravity and dark energy models.

Horndeski is the most general scalar-tensor theory whose equations of motion remain second order, and contains many well known models, including (but by no means limited to) covariant Galileons, Brans-Dicke, f(R), chameleons, k-essence and quintessence. It is not, however, the most general healthy scalar-tensor theory: general disformal couplings and degenerate theories generalize Horndeski without introducing Ostrogradski instabilities (see PRD 89 (2014) 064046 and JHEP 12 (2016) 100). hi_class implements GLPV theories beyond Horndeski (PRL 114 (2015) 211101), used for example in JCAP 08 (2019) 035; they ship with the code as glpv_galileon and propto_omega_bh.

hi_class relies on a reformulation of the Effective Field Theory for Dark Energy developed by E. Bellini and I. Sawicki (see JCAP 1407 (2014) 050).

Any linear observable

FRW distances, CMB temperature and polarization, matter power and number counts — and their cross-correlations.

Fast enough for Bayesian analysis

A full Horndeski model — background, lensed CMB and matter power spectrum — computes fast enough to sample the parameter space of each model. Interfaces directly with Monte Python.

Covariant or effective theory

Start from a Horndeski Lagrangian and hi_class derives the background and α-functions itself, or parametrize the α-functions directly.

Free and open

Available to the scientific community on GitHub, and registered in the Astrophysics Source Code Library.

Flexible input

Two ways to test gravity

The effective-theory approach consists of providing a parametrization of the α-functions and the dark-energy equation of state, independent of any underlying theory, with the aim of testing for particular physical effects.

The covariant-theory approach starts from a particular model defined in terms of the Horndeski functions Gi. Upon specifying the initial conditions for the background field and the additional parameters of the theory, hi_class automatically computes the cosmological background and the α-functions are fully determined.

Sixteen worked-out examples ship with the code — Galileon, nKGB, quintessence (monomial and tracker), Brans-Dicke, α-attractors, the conformally coupled cubic Galileon and the beyond-Horndeski models — and serve as a template for further implementations. hi_class is easy to use and to modify, so new models are straightforward to add.

The two routes from a theory of gravity to a cosmological prediction A covariant Horndeski Lagrangian determines the alpha-functions, which in turn determine the observables. The covariant-theory approach enters at the Lagrangian; the effective-theory approach enters at the alpha-functions, skipping the Lagrangian entirely. Covariant theory Effective description (linear) Predictions S[gμν, φ] G2, G3, G4, G5 (X, φ) φ(τi), φ′(τi) a Horndeski Lagrangian initial conditions w(τ) αK(τ) αB(τ) αM(τ) αT(τ) expansion history kineticity braiding Planck-mass running tensor speed H(z) Cij P(k, z) Covariant-theory approach — start from the Lagrangian Effective-theory approach — start from the α-functions
Both routes end at the same observables. The covariant-theory approach starts from a Lagrangian and lets hi_class derive the α-functions; the effective-theory approach specifies those functions directly, and never commits to an underlying theory. After JCAP 08 (2017) 019.

Cosmological observables: effective vs covariant theories

The animations below illustrate an example of each type as it is driven away from GR+ΛCDM (in gray). Both hold one Planck 2018 cosmology fixed — including the acoustic angular scale 100 θ*, so H0 is derived from it — and vary the dark-energy sector. Left: the expansion rate. Right: the lensed temperature spectrum. The effective theory approach allows for independent variations of the expansion and perturbation parameters, while the covariant theory modifies all observables at once.

Two panels: the expansion rate and the CMB temperature spectrum, each over a residual against LambdaCDM, with sliders for the two swept parameters.
The effective-theory route. First the braiding αB runs from 0 to 2ΩDE(a) with w0 = −1: this modifies the low-ℓ CMB, leaving H(z) and H0 invariant. Then w0 runs to −0.9 and the roles swap: H0 is modified, but the CMB spectrum changes minimally. This provides an agnostic way to test dark energy and cosmological gravity.
The same two panels, with a stacked bar splitting the dark-energy budget between Lambda and the Galileon.
The covariant route. A cubic Galileon on the tracker, where the relative contributions of Λ and the scalar field are varied. Covariant Lagrangians tie together not only the expansion history and perturbation growth, but also any other observable, and can be connected to fundamental theories. Covariant theories allow a comprehensive investigation of a theory, including the potential to solve cosmological tensions.

Presented and described in

Selected results obtained with hi_class

See all 99 publications using hi_class If your article is not listed, please contact us.

The Code

Flexible, fast and accurate

hi_class computes the cosmological predictions of alternative theories of gravity. It solves the linear equations starting deep in the radiation era, and returns any cosmological observable — distances, the matter power spectrum, Cosmic Microwave Background temperature and polarization, and their correlation with the matter distribution.

Accurate
hi_class lets you balance accuracy against speed through a wide range of precision parameters, and it was the first code to implement self-consistent initial conditions for linear perturbations. Its accuracy was established in a dedicated comparison paper, A comparison of Einstein-Boltzmann solvers for testing General Relativity, which ran the same models through four independent codes. Across that range of models the CMB and matter power spectra agree to 0.1% — as good as base CLASS/CAMB at default precision parameters — and to 0.5% at low multipoles, comfortably within cosmic variance. That is sufficient precision for tests of gravity with next-generation surveys.
Fast
A full model — background, lensed CMB and matter power spectrum — is computed efficiently, fast enough to sample the parameter space of each theory. hi_class also implements the quasi-static approximation, which speeds up computations on small scales. This makes Bayesian parameter estimation practical, and hi_class interfaces directly with Monte Python to do it.
Flexible
Test gravity two ways: parametrize the α-functions and the dark-energy equation of state independently of any underlying theory, or start from a covariant Horndeski Lagrangian and let hi_class determine the background and the α-functions itself. Worked-out models ship ready to run, and every configuration is screened for ghost and gradient instabilities before it is used.

Covariant theory

# a quartic Galileon Lagrangian
#   G2 = -X
#   G3 = c3 X /(H0^2 Mp)
#   G4 = Mp^2/2 + c4 X^2/(H0^2 Mp)^2
gravity_model    = galileon
gravity_submodel = quartic
# xi; the rest follows from the tracker
parameters_smg   = 2.43
Omega_smg        = -1
# the scalar replaces Lambda entirely
Omega_Lambda     = 0
Omega_fld        = 0

Effective theory

# the alpha-functions directly, each one
# proportional to Omega_smg(a)
gravity_model    = propto_omega
# x_k, x_b, x_m, x_t, M*^2_ini
parameters_smg   = 1., 0., 0., 0., 1.
# and an expansion history to go with it
expansion_model  = lcdm
expansion_smg    = 0.5
Omega_smg        = -1
# the scalar replaces Lambda entirely
Omega_Lambda     = 0
Omega_fld        = 0

From Python

Drive it from a script or a notebook

The code also builds a Python wrapper, inherited from CLASS and published on PyPI as hiclassypip install hiclassy. Parameters go in as a dictionary — hi_class options alongside the standard CLASS ones — and spectra come back as arrays, ready to plot. It is what CLOE, the Euclid likelihood library, calls to get modified-gravity predictions. Worked examples ship in notebooks/.

from hiclassy import HiClass

cosmo = HiClass()
cosmo.set({
    'output': 'tCl,pCl,lCl,mPk',
    'lensing': 'yes',

    # the same quartic Galileon, driven from Python
    'gravity_model': 'galileon',
    'gravity_submodel': 'quartic',
    # xi = (H phi')/(a H0^2); the remaining parameters follow
    # from Omega_smg and the tracker condition
    'parameters_smg': 2.43,

    'Omega_smg': -1,  # fixed by the closure equation
    'Omega_Lambda': 0,
    'Omega_fld': 0,
})
cosmo.compute()

cl = cosmo.lensed_cl(2500)  # TT, TE, EE, lensing
pk = cosmo.pk(0.1, 0.)      # P(k = 0.1/Mpc, z = 0)

Scope

Other modified gravity codes

Other codes solve a covariant theory in much the same sense: H-EFTCAMB (built on CAMB), COOP, and mochi_class, which extends this architecture with stability-by-construction parametrizations.

A different family — MGCAMB, ISiTGR, MGCLASS II — instead parametrizes the relation between the metric potentials and matter: the μ–Σ approach, a modified Poisson equation.

hi_class is a linear code. Screening — the mechanism that hides the fifth force in the Solar System, and the reason many of these theories are viable at all — is intrinsically nonlinear and is not modelled here. For non-linear codes see MG-PICOLA and Hi-COLA, ReACT, KGB-evolution, and the ECOSMOG and MG-GADGET families of N-body solvers.

Download

Get hi_class

hi_class is freely available to the scientific community. The code can be cloned from the GitHub repository or downloaded as a compressed archive. To get started and find detailed information on the available models and code functionality, please read the hi_class.ini file.

Versions

The current release is v3.3.4.4, built on CLASS v3.3.4, and it lives on the default master branch — the separate hi_class branch is gone, so cloning the repository gives you the code. The Python wrapper carries the same number on PyPI: hiclassy 3.3.4.4.

Interfaces

How well each of these is supported differs, and the difference is worth stating plainly.

  • Monte Python official Documented, and the sampler behind most of the published results below.
  • Cobaya community Works as a modified-CLASS theory provider. Cobaya warns that forks carrying an older CLASS version number may need ignore_obsolete.
  • CosmoSIS community Through a third-party wrapper, maintained outside this project.
  • emcee, and any Python sampler generic No adapter is needed: hiclassy is an ordinary Python object, so a log-likelihood that calls it is all it takes.

How to cite

If you use hi_class in a publication or preprint, please cite at least the original CLASS paper and the two hi_class papers.

The Team

Who develops hi_class

A green ring marks the main developers.

We are very grateful to Thomas Tram for his invaluable advice, and to the many users who have offered suggestions, found bugs and contributed to improve the code.

Contact

Get in touch

If you are interested in using a beta version, or for other inquiries about hi_class, please contact emilio - bellini -- ung.si or miguel - zumalacarregui -- aei.mpg.de.

Bug reports and feature requests are also welcome on the GitHub issue tracker and the hi_class forum.

Publications

Papers using hi_class

99 publications have used hi_class

Spanning 2015–2026, from single-author theory papers to Euclid, DESI, KiDS and LISA collaboration analyses. If your article is missing, please let us know.

2026 7

2025 18

2024 12

2023 6

2022 6

2021 5

2020 12

2019 11

2018 12

2017 4

2016 5

2015 1

No publications match that search.

Black Dahlias with Yellow Sky, a 2017 painting by Gregory Horndeski: dark flowers against a vivid yellow sky.
Black Dahlias with Yellow Sky (Gregory Horndeski, 2017), from Horndeski Contemporary. He wrote Int. J. Theor. Phys. 10 (1974) 363 and left physics for painting in 1981.