If manual installation produces a
ModuleNotFoundError, runexport PYTHONPATH=.from the repository root. Most scripts also accept a--pathargument to change the defaultresults/output directory.
This directory contains the small-scale experiments from the ExPLAIND paper and the additional camera-ready ablations. A typical workflow is:
- train a model while storing the required model, optimizer, and data checkpoints;
- compute EPK predictions and ExPLAIND influence scores from those checkpoints;
- run the ablation or plotting script for the experiment section you want to reproduce.
Run these scripts from the repository root:
python experiments/train_models/modulo_model.py --path results/modulo_val_results/
python experiments/train_models/cifar2_model.py --path results/cifar2/
python experiments/train_models/mnist10_model.py --path results/mnist10/The modulo and CIFAR-2 models are the main inputs for the EPK validation, component attribution, pruning, and pipeline experiments. The MNIST model supports the sensitivity and LDS-style data-attribution experiments.
python experiments/validate_epk/modulo_epk_prediction.py --path results/modulo_val_results/
python experiments/validate_epk/cifar2_epk_prediction.py --path results/cifar2/
python experiments/validate_epk/modulo_epk_train_set.py --path results/modulo_train_epk_new/These scripts combine prediction of the EPK-reformulated model with influence-score computation to avoid recomputing the same feature maps. The output includes predictions, kernel matrices, and accumulated score statistics used by the plotting scripts.
python experiments/component_attribution/component_attribution.py
python experiments/component_attribution/comp_att_history.py
python experiments/component_attribution/comp_att_history_train.py
python experiments/component_attribution/comp_train_to_val_hist.pyThese scripts aggregate ExPLAIND scores by model component and compare score histories across train and validation behavior.
python experiments/cifar_pruning/model_pruning.py
python experiments/cifar_pruning/plot_pruning_results.pyThe pruning experiment removes or perturbs weights based on attribution statistics and plots the effect on model behavior.
python experiments/swap_aligned/swap_pipelines.py
python experiments/retrain_pipeline/retrain_with_pipeline.py
python experiments/retrain_pipeline/plot_pipeline_train.pyThese scripts study how intermediate representations change by swapping aligned outer layers and retraining random models initialized from different representation-pipeline states.
python experiments/sensitivity/mnist_sensitivity.py
python experiments/sensitivity/plot.py
bash experiments/mnist_data_attribution/train_and_attribute.sh
python experiments/mnist_data_attribution/eval_lds.py
python experiments/mnist_data_attribution/plot.pyThe sensitivity experiment evaluates score stability under perturbations. The MNIST data-attribution scripts compare ExPLAIND-style scores with LDS-style baselines.
General plotting utilities live in experiments/plots/:
python experiments/plots/plot_kernel_matrices.py
python experiments/plots/plot_epk_matrices_mod.py
python experiments/plots/plot_mod_epk_stats.py
python experiments/plots/plot_mod_training_process.py
python experiments/plots/plot_kernel_reg_balance.py
python experiments/plots/plot_cosines.pyMost plotting scripts expect artifacts generated by the training and validation steps under results/. If a plot script fails with a missing file, rerun the corresponding training or validation script and check the hard-coded or CLI-configured result path.
python -m unittest discover tests
python -m ruff check explaind experiments scaled_experiments testsRuff is configured in pyproject.toml; install it in your development environment if python -m ruff is unavailable.