salesforce / fast-influence-functions

BSD 3-Clause "New" or "Revised" License
83 stars 17 forks source link

FastIF: Scalable Influence Functions for Efficient Model Interpretation and Debugging

Link to the Paper

main

Requirements

Please see requirements.txt and Dockerfile for detailed dependencies. The major ones include

Setup

Docker Setup

To build the docker image, run the following script.

DOCKER_BUILDKIT=1 docker build \
    -t ${TAG} \
    -f Dockerfile .

Data Setup

  1. Download the data following the examples from here and here.
  2. Mount the data into /export/home/Data/Glue and /export/home/Data/HANS inside the image.

Experiments

  1. To train the base models, please use scripts/run_MNLI.sh and scripts/run_HANS.sh.
  2. To build FAISS indices, please see the function create_FAISS_index in experiments/hans.py.
  3. Modify the paths in experiments/constants.py based on your setup.
  4. To run the experiments, please follow the instructions in run_experiments.py where we have provided most of the default configurations/hyper-parameters.

Code Structure

experiments/

influence_utils/

This directory contains the core components of the influence functions. Most of the codes are designed to be independent of the experiments so could be adapted for others downstream needs. Two of the most important ones are: