Realmbird commited on
Commit
52d46e8
·
verified ·
1 Parent(s): 2884562

Upload README.md with huggingface_hub

Browse files
Files changed (1) hide show
  1. README.md +97 -0
README.md ADDED
@@ -0,0 +1,97 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: mit
3
+ tags:
4
+ - mechanistic-interpretability
5
+ - nla
6
+ - gsm8k
7
+ - qwen
8
+ - thought-anchors
9
+ - sentence-embeddings
10
+ ---
11
+
12
+ # nla-thought-anchors-rollouts
13
+
14
+ Sentence-level NLA rollout dataset for Qwen2.5-7B-Instruct on GSM8K test set.
15
+
16
+ For each activation vector (layer 20, 1319 examples), **40 NLA descriptions** were sampled from the actor `kitft/nla-qwen2.5-7b-L20-av` (temperature=0.7). Each description was split into sentences and scored with the NLA critic `kitft/nla-qwen2.5-7b-L20-ar`.
17
+
18
+ Part of the [nla-thought-anchors](https://github.com/Realmbird/nla-thought-anchors) project.
19
+
20
+ ## Files
21
+
22
+ | File | Extraction point | Rows |
23
+ |---|---|---|
24
+ | `hash.parquet` | `####` token (model finished CoT, about to write answer) | 175,240 |
25
+ | `answer.parquet` | Answer digit token (answer now in context) | ~175,000 |
26
+
27
+ ## Schema
28
+
29
+ | Column | Type | Description |
30
+ |---|---|---|
31
+ | `example_idx` | int32 | Index in GSM8K test split |
32
+ | `is_correct` | bool | Whether model answer matched gold |
33
+ | `gold_answer` | string | Ground-truth answer |
34
+ | `rollout_idx` | int32 | 0–39 — which of the 40 sampled descriptions |
35
+ | `sentence_idx` | int32 | Sentence position within this rollout |
36
+ | `sentence_text` | string | The sentence text |
37
+ | `sentence_embedding` | list\<float32\> len=384 | MiniLM-L6-v2 embedding |
38
+ | `cos_sim_to_full_nla` | float32 | Cos-sim of sentence to its own rollout's full description |
39
+ | `critic_cos_sim` | float32 | NLA critic reconstruction cos-sim vs original activation |
40
+ | `critic_mse` | float32 | NLA critic reconstruction MSE vs original activation |
41
+ | `contains_gold_answer` | bool | Sentence contains the gold answer number |
42
+ | `contains_pred_answer` | bool | Sentence contains the predicted answer number |
43
+
44
+ ## Key findings
45
+
46
+ **Reconstruction quality by correctness** (hash position):
47
+
48
+ | Group | Mean critic cos-sim |
49
+ |---|---|
50
+ | Correct examples | 0.604 |
51
+ | Incorrect examples | 0.416 |
52
+
53
+ Incorrect examples reconstruct ~35% worse — the activation at `####` is qualitatively different when the model gets the answer wrong.
54
+
55
+ **Thought anchor analysis**: sentences that are stable across all 40 rollouts (high cos-sim to cross-rollout centroid) reconstruct significantly better than peripheral sentences:
56
+
57
+ | Group | Correct | Incorrect |
58
+ |---|---|---|
59
+ | Peripheral sentences (Q1 anchor score) | 0.503 | 0.366 |
60
+ | Anchor sentences (Q4 anchor score) | 0.661 | 0.673 |
61
+
62
+ The most striking result: **anchor sentences from incorrect examples (0.673) reconstruct better than peripheral sentences from correct examples (0.503)** — the stable recurring content is what carries the activation signal regardless of correctness.
63
+
64
+ **Anchor score** is not stored in this dataset — compute it post-hoc from `sentence_embedding` by grouping rows by `example_idx`, computing the centroid of all embeddings, and taking cos-sim of each sentence to the centroid.
65
+
66
+ ## Usage
67
+
68
+ ```python
69
+ from datasets import load_dataset
70
+ import numpy as np
71
+ from sklearn.metrics.pairwise import cosine_similarity
72
+
73
+ ds = load_dataset("Realmbird/nla-thought-anchors-rollouts", split="hash")
74
+
75
+ # compute anchor scores for each example
76
+ import pandas as pd
77
+ df = ds.to_pandas()
78
+ embs = np.stack(df["sentence_embedding"].values)
79
+
80
+ anchor_scores = np.zeros(len(df))
81
+ for ex_idx, group in df.groupby("example_idx"):
82
+ idx = group.index
83
+ centroid = embs[idx].mean(axis=0)
84
+ centroid /= np.linalg.norm(centroid) + 1e-12
85
+ sims = cosine_similarity(embs[idx], centroid.reshape(1, -1)).flatten()
86
+ anchor_scores[idx] = sims
87
+
88
+ df["anchor_score"] = anchor_scores
89
+ ```
90
+
91
+ ## Related
92
+
93
+ - Step 1 activations (#### token): `Realmbird/nla-thought-anchors-hash`
94
+ - Step 1 activations (answer token): `Realmbird/nla-thought-anchors-answer`
95
+ - Step 2 NLA descriptions: `Realmbird/nla-thought-anchors-hash-step2`
96
+ - NLA actor: `kitft/nla-qwen2.5-7b-L20-av`
97
+ - NLA critic: `kitft/nla-qwen2.5-7b-L20-ar`