Imagenette was chosen due to logistic and compute restrictions (bigger experiments coming soon!)
Inspired by OpenAI's research at (https://github.com/openai/weak-to-strong/tree/main)
Original Approach: Generate the weak labels using an AlexNet model pretrained on ImageNette and we use linear probes on top of DINO models as a strong student.
Modified Approach: Use the weak labels to generate pairwise preferences to train a linear probe, eliciting a stronger weak-to-strong supervision.
Set download=True in data.py for the first run
python3 run_weak_strong.py \
data_path: <DATA_PATH> \
weak_model_name: <WEAK_MODEL>\
strong_model_name: <STRONG_MODEL> \
batch_size <BATCH_SIZE> \
seed <SEED> \
n_epochs <N_EPOCHS> \
lr <LR> \
n_train <N_TRAIN>
Run the prefs version using the same command. Refer to the OpenAI GitHub for detailed parameter explanations.
With the commands above we get the following results (note that the results may not reproduce exactly due to randomness):
AlexNet (weak label) Accuracy: 0.089
DINO ResNet50 (strong on gt) Accuracy: 0.91
Model | PGR |
---|---|
AlexNet → DINO ResNet50 | 0.096 |
| AlexNet → DINO ResNet50 (Prefs) | 0.132 |
Scores are low, but better for prefs.
You can add new custom models to models.py
and new datasets to data.py
.
Submitted as a classroom assignment for CS 690S, here are some results:
![w2s1](https://private-user-images.githubusercontent.com/66398068/345902226-86746ce3-d123-4991-9583-1bfef91a5cb9.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjQxMDQ4NDIsIm5iZiI6MTcyNDEwNDU0MiwicGF0aCI6Ii82NjM5ODA2OC8zNDU5MDIyMjYtODY3NDZjZTMtZDEyMy00OTkxLTk1ODMtMWJmZWY5MWE1Y2I5LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA4MTklMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVx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3Y)
![w2s3](https://private-user-images.githubusercontent.com/66398068/345902293-9aa7ff00-e526-4496-aea2-c1fb33cb6261.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjQxMDQ4NDIsIm5iZiI6MTcyNDEwNDU0MiwicGF0aCI6Ii82NjM5ODA2OC8zNDU5MDIyOTMtOWFhN2ZmMDAtZTUyNi00NDk2LWFlYTItYzFmYjMzY2I2MjYxLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA4MTklMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwODE5VDIxNTU0MlomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTdmZWVlZDI0MTc4NTc0YmU2Mjc0NWZlNmU3MTA2YWNjNmQ1YmQyNTRiMDRkNzQyYzdlMzdhNGQwYzA0MzA4YWUmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.v0hXRL2K9QONO1nywXlA7i3CfwWsfQ2lYbvDtaAs-HY)
![w2s4](https://private-user-images.githubusercontent.com/66398068/345902305-5c661ed8-b9e6-40d1-988f-9326e9d2fb64.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjQxMDQ4NDIsIm5iZiI6MTcyNDEwNDU0MiwicGF0aCI6Ii82NjM5ODA2OC8zNDU5MDIzMDUtNWM2NjFlZDgtYjllNi00MGQxLTk4OGYtOTMyNmU5ZDJmYjY0LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA4MTklMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwODE5VDIxNTU0MlomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTUzYmM3ZDA5ZDYyYjBiMzI2YmFhMmYxNDBiODIyYjEyM2I2YTE3YWQ0MzkwZWJjOGUyNjg4NmVkNTNmMDhmOWYmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.unGIBi6c5uYH4HOVoOnq73eTxESX49iuZN4wLe7-7eQ)
Collin Burns, Pavel Izmailov, Jan Hendrik Kirchner, Bowen Baker, Leo Gao, Leopold Aschenbrenner, Yining Chen, Adrien Ecoffet, Manas Joglekar, Jan Leike, Ilya Sutskever, and Jeff Wu. Weak-to- strong generalization: Eliciting strong capabilities with weak supervision, 2023.
Rafael Rafailov, Archit Sharma, Eric Mitchell, Stefano Ermon, Christopher D. Manning, and Chelsea Finn. Direct preference optimization: Your language model is secretly a reward model, 2023. John Schulman, Filip Wolski, Prafulla Dhariwal, Alec Radford, and Oleg Klimov. Proximal policy optimization algorithms, 2017.
Karl Moritz Hermann, Tomas Kocisky, Edward Grefenstette, Lasse Espeholt, Will Kay, Mustafa Suleyman, and Phil Blunsom. Teaching machines to read and comprehend. Advances in neural information processing systems, 28, 2015.
Alec Radford, Jeffrey Wu, Rewon Child, David Luan, Dario Amodei, Ilya Sutskever, et al. Language models are unsupervised multitask learners. OpenAI blog, 1(8):9, 2019.