Official repository for the paper GIM: Improved Interpretability for Large Language Models
I've tested many approaches before ending up with GIM, and this is visible in the complexity of the code. GIM can be implemented in a simpler manner than in this repository, for example, by using Transformer Lens. I will release a better implementation after I've handed in my PhD thesis 1st of August.
make setupmake download_dataYou must download the twitter sentiment classification manually from https://www.kaggle.com/competitions/tweet-sentiment-extraction/data
CUDA_VISIBLE_DEVICES="0" uv run python src/evaluation/evaluate_models.pyChange CUDA_VISIBLE_DEVICES if you want to use a different GPU.
You can reproduce our three experiments using the following lines of code:
CUDA_VISIBLE_DEVICES="0" uv run python src/evaluation/evaluate_self_repair.pyCUDA_VISIBLE_DEVICES="0" uv run python src/evaluation/evaluate_feature_attributions.pyThis command will also compute the results needed for the ablation study. This will be take a lot of time. You can change the parameters in the code to only run a few models in the same run.
CUDA_VISIBLE_DEVICES="0" uv run python src/evaluation/evaluate_layers.pyThe code for creating the figures and tables are in the /resultsfolder.