Skip to content

tvergara/sah

Repository files navigation

Superficial Alignment Hypothesis

Repository for the paper "Operationalizing the Superficial Alignment Hypothesis via Task Complexity".

Installation

This project uses uv for dependency management.

uv sync
. .venv/bin/activate

Usage

Experiments are configured with Hydra and run through a single entry point:

python sah/main.py --help

To run a specific experiment:

python sah/main.py experiment=finetune-with-strategy-{strategy}

where {strategy} is one of:

Strategy Description
baseline Naive prompting on the task
icl In-context learning with example demonstrations
urial In-context examples plus a brief description of the task
lora LoRA fine-tuning
blora Bayesian LoRA (Meo et al., 2024)
lm-head Linear logit projection (Chen et al., 2025)
online-coding Fine-tuning on a subset of the training data

Each experiment requires a model and dataset to be specified via Hydra overrides:

python sah/main.py experiment=finetune-with-strategy-{strategy} algorithm/model={model} algorithm/dataset={dataset}

Available datasets: metamath (GSM8K), flores (FLORES translation), ifeval (IFEval instruction following).

Note: The metamath and flores datasets are downloaded automatically from HuggingFace. The ifeval dataset requires a pre-generated local file at $SCRATCH/correct_ifeval_examples_extended_32_clean.jsonl. To generate it:

# 1. Generate correct examples in parallel (uses vLLM with Olmo-3-32B-Think)
sbatch --array=0-49 slurm/generate-it-data.sh 50

# 2. Aggregate and deduplicate the split files
python scripts/aggregate_it_data.py

The generation procedure is described in more detail in the paper.

Available models include: smollm3-stage1, olmo3-7b-step1414k, olmo3-32b-step656k, among others (see sah/configs/algorithm/model/ for the full list).

For example:

python sah/main.py experiment=finetune-with-strategy-lora algorithm/model=smollm3-stage1 algorithm/dataset=metamath
python sah/main.py experiment=finetune-with-strategy-icl algorithm/model=olmo3-7b-step1414k algorithm/dataset=flores
python sah/main.py experiment=finetune-with-strategy-blora algorithm/model=olmo3-32b-step656k algorithm/dataset=ifeval

Script Sizes

The script sizes in bytes reported in the paper were measured using scripts/inference.py, scripts/batch_inference.py, scripts/baseline_inference.py, scripts/lora_inference.py, and scripts/blora_inference.py.

Plots

The figures in the paper are generated by scripts in the notebooks/ directory.

SLURM

Scripts for running experiments on SLURM clusters are in the slurm/ directory.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors