src.pipeline module

Neuron concept attribution explanation pipeline.

Integrates language models, image generation models, and image classification models to iteratively generate and refine concept descriptions that explain individual neuron behavior.

class src.pipeline.Pipeline(load_config: LoadConfig, image_generation_config: ImageGenerationConfig, concept_history_config: ConceptHistoryConfig, history_managing_config: HistoryManagingConfig, control_activations_path: str, layer: str, neuron_id: int, metric: Metric)[source]

Bases: object

Explanation pipeline for neuron concept attribution.

Orchestrates an iterative process of generating concepts, creating images, and scoring concepts based on their ability to activate target neurons.

run_pipeline(n_iters: int) None[source]

Run the complete neuron explanation pipeline.

Initializes components, runs the specified number of concept generation and scoring iterations, then a final summary iteration. Saves all artifacts including images, reasoning, and best concepts.

Parameters:

n_iters – Number of main iterations to run before the summary iteration.