mirror of
https://github.com/wassname/Unsupervised-Elicitation.git
synced 2026-08-20 12:10:10 +08:00
readme: expand ICM, commit the plot images, replace pasted upstream readme with a link
Co-Authored-By: Claudypoo <288921227+claudypoo@users.noreply.github.com>
This commit is contained in:
@@ -1,10 +1,10 @@
|
||||
# ICM on chat models
|
||||
# ICM replication, with reasons
|
||||
|
||||
I replicated ICM, and added to it. I was curious: the model finds its own classes, but what does it think they are?
|
||||
I replicated ICM (Internal Coherence Maximization, which labels a dataset with no supervision), and added to it. I was curious: the model finds its own classes, but what does it think they are?
|
||||
|
||||
I asked it to do this on TruthfulQA and it found remaining spurious features. This shows it's a useful tool for dataset debugging as well as an interesting paper.
|
||||
|
||||
It thought the TruthfulQA classes were
|
||||
It thought the TruthfulQA v2 classes were
|
||||
|
||||
- **Set A - "Factually-correct/Scientifically-supported/Nuanced or context-dependent statement"**
|
||||
- **Set B - "Myth/Misconception/False-or-over-simplified claim"**
|
||||
@@ -77,8 +77,6 @@ By roughly the middle of the log it converged on the cleaner dichotomy above:
|
||||
|
||||

|
||||
|
||||
TruthfulQA label accuracy in this run is poor (`docs/tqa_icm_progress.png`), which fits the confound above.
|
||||
|
||||
Discussion: [my shortform](https://www.lesswrong.com/posts/EjsceYeeKEMoAohMs/wassname-s-shortform?commentId=g7ZnMh4ccs8xwdxX6), [comment on the paper](https://www.lesswrong.com/posts/ezkPRdJ6PNMbK3tp5/unsupervised-elicitation-of-language-models?commentId=NPKd8waJahcfj4oY5).
|
||||
|
||||
<details>
|
||||
@@ -142,84 +140,4 @@ Discussion: [my shortform](https://www.lesswrong.com/posts/EjsceYeeKEMoAohMs/was
|
||||
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary>Upstream README</summary>
|
||||
|
||||
## Unsupervised Elicitation of Language Models
|
||||
|
||||
We introduce a new unsupervised algorithm for eliciting skills from pretrained language models. This algorithm is competitive with training on human labels on common misconceptions (TruthfulQA), math (GSM8k-verification), and helpfulness reward modeling (Alpaca). Without supervision, we train a helpful chat assistant from the Haiku 3.5 base model that outperforms a similarly trained human-supervised baseline.
|
||||
|
||||
<p align="center">
|
||||
<img width="100%" src="figures/llama_performance.png">
|
||||
</p>
|
||||
|
||||
<p align="center">
|
||||
<img width="100%" src="figures/claude_performance.png">
|
||||
</p>
|
||||
|
||||
### Environment
|
||||
|
||||
1. create conda environment: `conda env create -f env.yaml`
|
||||
2. install package `pip install -e .`
|
||||
|
||||
### API for Pretrained Base Models
|
||||
|
||||
You should have access to an API for pretrained base models, which can return top-K (e.g. 20) logprobs.
|
||||
|
||||
Since most public api servers (e.g. openrouter) only support post-trained chat models, you probably need to deploy pretrained base models yourself. For example, we use vllm to deploy llama models in our experiments.
|
||||
|
||||
In particular, we highly recommend activating the `prefix caching` feature to accelerate the experiments, because our algorithm will create many API queries with similar prefixes.
|
||||
|
||||
### Secrets
|
||||
|
||||
You should create a file called SECRETS at the root of the repository with the following contents:
|
||||
```
|
||||
LLAMA_API_BASE=<your_api_base_url>
|
||||
NYU_ORG=None
|
||||
ARG_ORG=None
|
||||
API_KEY=None
|
||||
```
|
||||
|
||||
### Data Preparation
|
||||
|
||||
Download data from this [link](https://drive.google.com/file/d/1AJdFJO9IHfOnWHyIlGvInyndLu6EvcfV/view?usp=sharing).
|
||||
Put it under the `data/` directory.
|
||||
|
||||
### ICM
|
||||
<p align="center">
|
||||
<img width="100%" src="figures/algorithm.png">
|
||||
</p>
|
||||
|
||||
The main script is located in `src/experiments/ICM.py`
|
||||
An example command for labeling truthfulQA data:
|
||||
```
|
||||
cd src/experiments
|
||||
python ICM.py --testbed truthfulQA --alpha 50
|
||||
```
|
||||
|
||||
Arguments:
|
||||
|
||||
- `--seed`: random seed
|
||||
- `--alpha`: the coefficient for mutual predictability in our scoring function
|
||||
- `--testbed`: name of the testbed, e.g., alpaca, truthfulqa, gsm8k
|
||||
- `--model`: name of the pretrained base model, e.g., meta-llama/Llama-3.1-70B
|
||||
- `--batch_size`: size of a minibatch when running ICM on large datasets that cannot be fit in to the context all at once[^1].
|
||||
[^1]: Since ICM relies on in-context learning, it might not be able to fix all datapoints in the context at once. In our experiments, we split the whole dataset into $N$ batches (e.g., each batch consists of 256 datapoints) based on the context limit and data length, and run ICM independently on each batch.
|
||||
- `--num_seed`: number of randomly labeled datapoints in the beginning.
|
||||
- `--K`: max iteration
|
||||
- `--consistency_fix_K`: max iteration for consistencyfix
|
||||
- `--decay`: decay rate for simulating annealing
|
||||
- `--initial_T`: initial temprature for simulated annealing
|
||||
- `--final_T`: final temperature for simulated annealing
|
||||
- `--scheduler`: decay scheduler for simulated annealing
|
||||
|
||||
### Iterative Fine-tuning
|
||||
|
||||
Instead of using the initial pretrained model ($M_0$) to label all $N$ batches, we do iterative fine-tuning:
|
||||
|
||||
- fine-tune the pretrained model on the first $j$ batches to obtain $M_j$
|
||||
- use $M_j$ to label the $j+1$-th batch.
|
||||
|
||||
We use [axolotl](https://github.com/axolotl-ai-cloud/axolotl) for fine-tuning.
|
||||
|
||||
</details>
|
||||
Upstream: [Jiaxin-Wen/Unsupervised-Elicitation](https://github.com/Jiaxin-Wen/Unsupervised-Elicitation). Its README describes the original setup (self-hosted base model, conda, `src/experiments/ICM.py`), none of which applies here.
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 44 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 29 KiB |
Reference in New Issue
Block a user