Exploring weak-to-strong generalization with in-context learning
This project uses uv for fast and reliable dependency management.
uv sync
cp .env.example .envEdit .env and add your API keys:
OPENAI_API_KEY=your_openai_api_key_here
API_KEY=your_api_key_hereInstall the prm800k grader for evaluation:
git clone https://github.com/openai/prm800k.git
cd prm800k
pip install -e .Use the cleaning script to prepare the MATH dataset's train split. This aligns the training data with the MATH test dataset format.
The main script provides several experiment types to explore weak-to-strong generalization:
Run a single weak-to-strong in-context learning experiment:
uv run python main.py \
--experiment single \
--weak_model gpt-4o-mini \
--strong_model gpt-5-mini \
--num_few_shot 5 \
--test_size 200Parameters:
--weak_model: The weaker model to use for generating examples--strong_model: The stronger model to evaluate--num_few_shot: Number of few-shot examples--test_size: Number of test samples
Compare multiple models' zero-shot behavior on the MATH test dataset:
- First, modify
src/weak2strong/config.pyto add the models you want to compare - Run the comparison experiment:
uv run python main.py --experiment comparison --test_size 500Use run.py to run multiple experiments with different parameters:
uv run python run.pyThis will automatically run experiments with various few-shot values and save comprehensive results.