Show HN: Model Ensembling Tool

4 months ago 4

GitHub issues GitHub closed issues GitHub GitHub forks GitHub forks  WIP – Initial development is in progress, but there has not yet been a stable, usable release suitable for the public. Contributor Covenant

model-ensembleris a tool to configure and automate running model ensembles on High-Performance Computing (HPC) clusters. It reduces the manual configuration of individual ensemble runs, by using a common configuration to individually generate templates for each run.

It also provides pre-and post processing functionality to allow for common tasks to be applied to the ensemble, before and after the individual runs.

model-ensembler is developed to be extendable to various HPC backends,currently supporting SLURM and running locally.

Installation

To install model-ensembler:

python -m venv venv source venv/bin/activate pip install model-ensembler

To check it has installed correctly, you can run:

model_ensemble_check [dummy|slurm]

Basic Usage

Under the examples/ folder you will find example configs and templates that we can run on a local machine:

examples/ ├── template_job/    ├── inputfile.j2    ├── pre_run.sh.j2    ├── slurm_run.sh.js    └── post_run.sh.j2 └── ensemble_config.yml

The command model_ensemble is provided to execute the ensemble.

The --help flag can be used to find out more information:

Its use is as follows:
model_ensemble configuration {slurm, dummy}

Here configuration refers to our configuration file, and {slurm, dummy} are the HPC backend options (where dummy is the options to run locally).

Applying this to our examples/, and running locally:

model_ensemble examples/sanity-check.yml dummy

What is a model ensemble?

Simple diagram of an ensemble Simple diagram of an ensemble

Figure 1. An illustrative diagram of a model ensemble.

Rather than running a single model, we run a model (or multiple models) many times. This is useful when there is high uncertainty around parameters that can affect model predictions. This could be to do with the model physics itself (Bett et al. 2025), but also the initialisation date, resolution (Williams et al. 2025) or the input datasets being used.

Ensembles can also be multi-model (Seroussi et al. 2020), or a comparison between different scenario ensembles (e.g. anthropogenic vs counterfactual in (Bradley et al. 2024)).

Why use model-ensembler?

The example in Figure 1 is a simple example of an ensemble with just three models (or members), but what if your ensemble has 10, 100 or 1000 models? Setting up the configuration for each ensemble member would bring significant manual overhead.

model-ensembler uses a single ensemble configuration file, in the form of a .yml file, and a collection of jinja2 templates to control your ensemble and dynamically generate a batch (or batches) of model runs.

Single BatchList of Batches

Single batch overview, dark mode Single batch overview, light mode

List batch overview, dark mode List batch overview, light mode

Figure 2. A simplified overview of how model-ensembler dynamically generates an ensemble run based on a config.yml and jinja2 templates.

This design means writing a config.yml and corresponding templates just once, and intents to provide flexibility and enable a wide range of applications.

Multiple batches

Figure 2 shows an example of a single batch ensemble, or a list of batches. But why would you need multiple batches?

Multiple batch functionality exists for instances where there is a need to run similar, but different ensembles. Perhaps they have identical input files, domain, but compare different forcing or resolutions.

Where to go from here

The idea of model-ensembler is to give you the flexibility to set this up for your own ensembles.

The basic pattern for using this toolkit is:

  1. Adapt job/model run templates
  2. Adapt YAML Configuration
  3. Running the job using model_ensemble

Jump into Building Configuration & Templates for guidance on creating your own configurations.

Examples and Testimonials

Example configurations and templates are provided under examples/. A worked example is provided under Simple Example - WAVI.

Also take a look at the testimonials page to get a flavour of the types of model ensembles model-ensembler has been used for.

Read Entire Article