Skip to content

This is the official repository for the "Towards Vision-Language Mechanistic Interpretability: A Causal Tracing Tool for BLIP" paper accepted at the ICCV CLVL Workshop 2023

License

Notifications You must be signed in to change notification settings

vedantpalit/Towards-Vision-Language-Mechanistic-Interpretability

Repository files navigation

Towards-Vision-Language-Mechanistic-Interpretability

This is the repository for the Implementation of Causal Mediation Analysis on the Vision-Language Transformer BLIP, focussed on the Visual Question Answering task of colour identification in images and questions sourced from the COCO-QA Dataset from the paper "Exploring Models and Data for Image Question Answering"

BLIPforVQA or Bootstrapping Language-Image Pre-training for Unified Vision-Language Understanding and Generation Transformer is a sequential encoder and decoder model, which takes as input an image and a question, each of which is sent into an Image Encoder and an Image Grounded Question Encoder.

The Image Grounded Question Encoder also obtains the image embedding output from the Image Encoder as an input, following which it generates Question Embeddings. These Question Embeddings are sent into the Answer Decoder alongside a BOS(Beginning-Of-String) ID --> [Decode] which allows it to decode the tensors into open-ended Answers

Screenshot 2023-07-06 at 4 14 33 PM

Blip for VQA Architecture

Causal Tracing by our methodology involves introducing noise to the Image Embeddings, and creating a batch of 2 image embeddings being input into the Question Encoder - one being uncorrupted and the other being corrupted. Following this, we hook the outputs of different layers inside the encoder and patch the uncorrupted states to the corrupted states.

Screenshot 2023-07-23 at 11 21 43 PM

Visualization of Patching of States for Interpretability

The following are the results of causal tracing on a couple of samples alongside the corresponding images:
Example 1:

COCO-QA ID:000000220218 Image and Causal Trace Heatmap

Screenshot 2023-08-22 at 1 43 58 PM

Example 2:

COCO-QA ID:000000458864 Image and Causal Trace Heatmap

Screenshot 2023-08-22 at 1 44 07 PM

About

This is the official repository for the "Towards Vision-Language Mechanistic Interpretability: A Causal Tracing Tool for BLIP" paper accepted at the ICCV CLVL Workshop 2023

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published