Skip to content

Repository files navigation

Extraction of multimodal concepts through SAE

This repository provides a modular pipeline to extract and analyze multimodal concepts using Sparse AutoEncoder (SAEs). All the details and results will presented at ICANN 2026 paper. The current reference setup targets VLMs injected into LLaVA 8B-OV and the LLaVA-Next dataset, but the codebase is adaptable to other vision-language models and datasets.

Requirements

Installation

  1. Create a Python virtual environment and install dependencies:
./setup.sh
  1. Recommended GPU: 1 or 2 A100 or H100

Configuration (gin)

This project uses gin-config files to manage hyperparameters and experiment settings. Each module has an associated .gin file in the configs/ directory, After cloning the repo, update paths and other relevant values in configs/config_general.gin

DATASET_LLAVA_PATH = "/path/to/your/llava-next"
EMBEDDING_PATH = "/path/to/output/embeddings"

Repeat for other config files as needed before running modules.

Pipeline modules and usage All modules write one or more JSON files to EMBEDDING_PATH.

1) Extract embeddings

python run_extract_llava.py 

2) Generate visual and textual concept hypotheses

python run_generate_hypotheses_llava.py 

3) Evaluation is divided in two main files for both metrics

python evaluation/run_concept_evaluation.py

and

python evaluation/run_autointerpretability.py

About

Repo for my code for SAE

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages