Code repository for the corresponding paper accepted for the Causal Representation Learning workshop at the 38th Conference on Uncertainty in Artificial Intelligence (UAI CRL 2022).
Abstract Foundation models are subject to an ongoing heated debate, leaving open the question of progress towards AGI and dividing the community into two camps: the ones who see the arguably impressive results as evidence to the scaling hypothesis, and the others who are worried about the lack of interpretability and reasoning capabilities. By investigating to which extent causal representations might be captured by these large scale language models, we make a humble efforts towards resolving the ongoing philosophical conflicts.
conda create -n fm python=3.8
conda install pytorch torchvision torchaudio cudatoolkit=11.3 -c pytorch
pip install numpy, matplotlib, rtpt
pip install wrapt, transformers, openai, aleph_alpha_client
- Create an openAI and aleph-alpha account and store your keys in a file under
./keys/openai
and./keys/aleph_alpha
. - Generate queries. Write/modify and run:
./generate_DATASET.py
- Queries are stored in the
queries/
folder.dataset_questions.txt
contains a human readable form.dataset_full.pkl
contains meta information about the used template and variables. - Note: The order of the queries is assumed to be unchanged throughout the process.
- Queries are stored in the
- Adjust
active_apis
anddatasets
variables in./query_questions.py
. The script will query all specified datasets from all given APIs.- The OPT-30B model needs ~65GB of GPU RAM. Default download dir:
~/.cache/huggingface/
. (Loading the model into memory may take up to 15 minutes). - Responses are stored under
./queries/API_DATASET/IDX.txt
. - Already recorded queries are skipped on rerunning the script.
- The OPT-30B model needs ~65GB of GPU RAM. Default download dir:
- Classify the answers using
add_summary.py
. Again adjustfrom_apis
anddatasets
and run the script.- The script auto classifies answers starting with 'yes' or 'no' (auto-classified classes: 'y', 'n', 'uqy', 'uqn').
- For all other answers the intention has to be entered manually.
- Once all answers of a dataset are classifier a
summary.txt
is written to the dataset folder. - Have a look at the bottom of the script (line 95) for explanations of the different categories.
- The auto classification classifies with .
- For plotting all 'yes' ('y', 'ye', 'yo', ...), 'no' ('n', 'ne', ..) and 'undefined/uncertain' ('u', 'x', ...) answers will be grouped together for visualization.
- Run one of the
present_*.py
scripts to create the plots.- Results are stored under
./evaluations/
. present_base_graphs.py
- Visualizes all positive ('yes') edges grouped by API and question template.present_stability_graphs.py
- Counts the number of predicted edges when altering the question template.present_wording_stability_graphs.py
- Displays the differences in connectivity when changing variable wordings.present_common_datasets.py
- Stores queries and answers into a single json file.
- Results are stored under