erikjm commited on
Commit
064890a
·
verified ·
1 Parent(s): 797278f

Add the formality steering grid on GSM8K

Browse files
README.md ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: apache-2.0
3
+ pretty_name: Steerability optimization data
4
+ viewer: false
5
+ tags:
6
+ - steerability
7
+ - activation-steering
8
+ ---
9
+
10
+ # Steerability optimization data
11
+
12
+ Recorded data of the optimization experiments of the [Steerability toolkit](https://github.com/generative-computing/steerability). Each folder contains one recorded experiment, together with a `README.md` that describes its contents and how it was recorded. The notebooks of the toolkit download these files at a pinned commit of this repository.
13
+
14
+ | Folder | Contents | Read by |
15
+ |---|---|---|
16
+ | [`formality-gsm8k-grid/`](./formality-gsm8k-grid/README.md) | Per-item scores of `Qwen/Qwen2.5-0.5B-Instruct` under one CAA formality vector at 10 layers and 10 multipliers, and of the unsteered model, on GSM8K and a formality objective | `examples/notebooks/optimization/optimization.ipynb` |
formality-gsm8k-grid/README.md ADDED
@@ -0,0 +1,40 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Formality steering grid
2
+
3
+ This folder contains the per-item scores of `Qwen/Qwen2.5-0.5B-Instruct` under one CAA formality vector at 10 layers and 10 multipliers, and of the unsteered model, on two benchmarks. Its `grid.json` is the input of the optimization notebook of the [Steerability toolkit](https://github.com/generative-computing/steerability).
4
+
5
+ ## Contents
6
+
7
+ `grid.json` is one JSON object with two keys:
8
+
9
+ - `settings`: the 100 settings as `{"caa.layer_id": <int>, "caa.multiplier": <float>}`, in the order of the per-setting measurements below.
10
+ - `benchmarks`: one entry for GSM8K (`"capability"`) and one for the formality objective (`"behavior"`). Each entry has the item ids (`items`, 3,792 GSM8K ids and 1,500 prompt ids), two measurements of the unsteered model in different batch orders (`baseline`), and one measurement per setting (`settings`).
11
+
12
+ A measurement has one entry per item, in the order of `items`. Its lists are `values` (the GSM8K correctness in {0, 1}, or the formality score in [0, 1]) and `tokens` (the number of completion tokens). The measurements of the formality objective also have `degenerate`, which flags each degenerate completion. The file contains no prompts and no completions.
13
+
14
+ ## How it was recorded
15
+
16
+ - Model and protocol: `Qwen/Qwen2.5-0.5B-Instruct`, float32, greedy decoding (temperature 0, seed 0), batches of 64, Hugging Face backend, steerability 0.6.0 with torch 2.13.0 and transformers 5.19.0 (protocol id `af8f630d8b761825`).
17
+ - Capability benchmark: GSM8K, train and test splits (8,792 questions), zero-shot, with at most 384 completion tokens. The grid uses the 3,792 search items that remain after 5,000 items are sealed (seed 0).
18
+ - Objective: formality of the replies to 1,500 of 2,100 short messaging prompts (600 prompts are sealed, seed 0), with at most 96 completion tokens, scored by [`s-nlp/roberta-base-formality-ranker`](https://huggingface.co/s-nlp/roberta-base-formality-ranker).
19
+ - Steering vector: the mean difference between the activations of eight formal messages and their casual versions.
20
+ - Settings: layers 6, 8, 10, 12, 14, 16, 18, 20, 22, 23 and multipliers 0.5, 1, 1.5, 2, 3, 4, 5, 6, 8, 10. The unsteered model was measured twice.
21
+ - Commands: the settings were divided into eight shards, and shard 7 also measured the unsteered model (the other shards passed `--skip-baseline`). GSM8K and the formality objective were measured in separate passes over the shards. The GSM8K pass ran an earlier revision of `truth_grid.py` that measured GSM8K only, under the same protocol.
22
+
23
+ python examples/notebooks/optimization/scripts/truth_grid.py collect runs/truth_grid/shard_<i> --shard <i> --shards 8 --benchmarks gsm8k --skip-baseline
24
+ python examples/notebooks/optimization/scripts/truth_grid.py collect runs/truth_grid/shard_<i> --shard <i> --shards 8 --benchmarks formality --skip-baseline
25
+ python examples/notebooks/optimization/scripts/replay.py export runs/truth_grid/shard_{0..7} --output grid.json
26
+
27
+ - Cost: about 21 GPU-hours on NVIDIA A100 GPUs (about 19 for GSM8K and 2 for the formality objective).
28
+
29
+ ## Use
30
+
31
+ from huggingface_hub import hf_hub_download
32
+
33
+ path = hf_hub_download(
34
+ repo_id="Steerability/optimization",
35
+ filename="formality-gsm8k-grid/grid.json",
36
+ repo_type="dataset",
37
+ revision="<a commit of this repository>",
38
+ )
39
+
40
+ Pin a commit, as the optimization notebook does. `replay.load_export(path)` in the toolkit's `examples/notebooks/optimization/scripts/replay.py` reads the file.
formality-gsm8k-grid/grid.json ADDED
The diff for this file is too large to render. See raw diff