Skip to content

jhrystrom/multicultural-alignment

Repository files navigation

multicultural-alignment

Hugging Face Dataset Arxiv

This is the code for the paper Multilingual != Multicultural: Evaluating Gaps Between Multilingual Capabilities and Cultural Alignment in LLMs .

Installation

The project is pip-installable. To install, run the following command in the root directory of the project:

pip install -e .

For a faster experience, we recommend using uv, which is an extremely fast drop-in replacement for pip.

VLLM setup

For running non-API LLMs (i.e., gemma and olmo LLMs), we use the vllm library. As described in their docs, they recommend using uv or conda. Since we are already using conda, you can install vllm using uv:

uv sync --group=cuda

This will add vllm to the virtual environment. To get responses for the open-source models, you need to activate this environment and run the following command:

python scripts/vllm_batch_responses.py

Data

We release our dataset on huggingface 🤗 (see top of readme for link). This includes a detailed datasheet (Gebru et al., 2021).

Reproducing the analysis

  1. Create WVS ground truth: Calculates the "ground truth" pro score for each chosen country and question.
  2. Translate prompts: Automatically translate the prompts to Danish, Portuguese, and Dutch using gpt-3.5-turbo.
  3. Get responses from OpenAI: Generates response from the OpenAI models. Note that I did gpt-4o in a seperate run here. For future runs, they can be done with the same script.
  4. Get responses from Open Source: Same as above but using vLLM for the open source models. Note, that running this requires cuda - see here for installation instructions.
  5. Categorize response: Categorizes the responses into pro and con using function calling and gpt-4.1.
  6. Merge results with scores: Merges all the results and calculates the pro-score.
  7. Analyze hypotheses: Finally, this analyses and plots the results. These canbe found in the plots folder.
  8. Plot and regressions: To get all the plots from the paper, you need to run the following scripts: WVS plot, Multilingual regression, US-centric bias, and Self-consistency. Running these scripts will also provide print-outs of the regression tables where relevant.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published