OpenViSTAI · Agents · Blockchain · Crypto
Menu
AI Developer Tools & SDKs

Concept Embedding Models

Concept Embedding Models is an open-source Python repository with PyTorch implementations of Concept Embedding Models, Intervention-aware Concept Embedding Models, and Concept Bottleneck Model variants. It provides code for training models on samples annotated with downstream task labels and binary concepts, and for researching concept-based explanations and interventions.

Independent OpenViST project profile, based on linked sources.

Concept Embedding Models — OpenViST project profile in AI Developer Tools & SDKs.
OpenViST project illustration. See the linked sources for product details.
Understand the project

Practical overview

When it fits

Use it when you have a Python/PyTorch research workflow and want code for training concept-based models or investigating interventions, rather than a hosted prediction service.

Who it is for

  • Machine-learning researchers studying concept-based interpretability
  • Python developers building research prototypes with task and concept annotations

Documented uses

  • Train a concept embedding model on task-labelled samples with binary concept annotations
  • Explore test-time concept interventions on model predictions
  • Investigate intervention-aware training and concept-selection policies
  • Study concept interventions under distribution shifts using the repository’s research implementations
Before you choose

Requirements & limits

The repository is public on GitHub and licensed under MIT. The README specifies Python 3.7 or later.

  • The documented training workflow requires task-labelled samples and binary concept annotations.
  • Users need to provide dataset objects and an appropriate concept extractor architecture.
  • The README lists dependencies in requirements.txt and shows a PyTorch Lightning trainer using either GPU or CPU.

Check current requirements in the official documentation. Source-based guidance does not mean OpenViST has run or independently tested this project.

Source-based practical guide

Install the Python package

Clone the repository, install its package, and import it locally.

Before you start

  • Python 3.7 or later
  • Git and a local Python environment

Steps

  1. Clone the repository with the command below.

    Documented command
    git clone https://github.com/mateoespinosa/cem
  2. Change into the cloned cem directory.

  3. Run the command below.

    Documented command
    python setup.py install
  4. Import the installed package with import cem.

Expected outcome

The `cem` package is installed locally and can be imported from Python.

Guide limitations

  • Training requires installing the code requirements listed in requirements.txt.
  • Installation instructions do not establish that a particular environment or dependency set is compatible.
Source-based practical guide

Prepare a CEM training workflow

Set up the documented model and trainer pattern for training a CEM on annotated samples.

Before you start

  • The package installed and its requirements installed
  • PyTorch dataset objects for training and validation, with samples annotated for a downstream task and binary concepts
  • A suitable concept extractor architecture

Steps

  1. Import PyTorch Lightning and ConceptEmbeddingModel from cem.models.cem.

  2. Provide training and validation dataset objects.

  3. Construct ConceptEmbeddingModel with the concept and task counts, model settings, and concept extractor.

  4. Configure a PyTorch Lightning trainer and call trainer.fit(cem_model, train_dl, val_dl).

Expected outcome

A CEM training workflow is configured to fit the model on the supplied training and validation data.

Guide limitations

  • The README uses placeholders for datasets and the concept extractor; these must be supplied for the intended task.
  • The example does not provide a dataset, model architecture, or results for a particular application.
Evidence and transparency

Sources & review

Source record details
Source availability
Active
Sources checked
12 October 2026
Original website title
mateoespinosa/cem · Official homepage title · retained in its source language