Repository for the paper "Operationalizing the Superficial Alignment Hypothesis via Task Complexity".
This project uses uv for dependency management.
uv sync
. .venv/bin/activateExperiments are configured with Hydra and run through a single entry point:
python sah/main.py --helpTo 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.pyThe 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=ifevalThe 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.
The figures in the paper are generated by scripts in the notebooks/ directory.
Scripts for running experiments on SLURM clusters are in the slurm/ directory.