--- license: mit tags: - mechanistic-interpretability - nla - gsm8k - qwen - thought-anchors - sentence-embeddings --- # nla-thought-anchors-rollouts Sentence-level NLA rollout dataset for Qwen2.5-7B-Instruct on GSM8K test set. 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`. Part of the [nla-thought-anchors](https://github.com/Realmbird/nla-thought-anchors) project. ## Files | File | Extraction point | Rows | |---|---|---| | `hash.parquet` | `####` token (model finished CoT, about to write answer) | 175,240 | | `answer.parquet` | Answer digit token (answer now in context) | ~175,000 | ## Schema | Column | Type | Description | |---|---|---| | `example_idx` | int32 | Index in GSM8K test split | | `is_correct` | bool | Whether model answer matched gold | | `gold_answer` | string | Ground-truth answer | | `rollout_idx` | int32 | 0–39 — which of the 40 sampled descriptions | | `sentence_idx` | int32 | Sentence position within this rollout | | `sentence_text` | string | The sentence text | | `sentence_embedding` | list\ len=384 | MiniLM-L6-v2 embedding | | `cos_sim_to_full_nla` | float32 | Cos-sim of sentence to its own rollout's full description | | `critic_cos_sim` | float32 | NLA critic reconstruction cos-sim vs original activation | | `critic_mse` | float32 | NLA critic reconstruction MSE vs original activation | | `contains_gold_answer` | bool | Sentence contains the gold answer number | | `contains_pred_answer` | bool | Sentence contains the predicted answer number | ## Key findings **Reconstruction quality by correctness** (hash position): | Group | Mean critic cos-sim | |---|---| | Correct examples | 0.604 | | Incorrect examples | 0.416 | Incorrect examples reconstruct ~35% worse — the activation at `####` is qualitatively different when the model gets the answer wrong. **Thought anchor analysis**: sentences that are stable across all 40 rollouts (high cos-sim to cross-rollout centroid) reconstruct significantly better than peripheral sentences: | Group | Correct | Incorrect | |---|---|---| | Peripheral sentences (Q1 anchor score) | 0.503 | 0.366 | | Anchor sentences (Q4 anchor score) | 0.661 | 0.673 | 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. **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. ## Usage ```python from datasets import load_dataset import numpy as np from sklearn.metrics.pairwise import cosine_similarity ds = load_dataset("Realmbird/nla-thought-anchors-rollouts", split="hash") # compute anchor scores for each example import pandas as pd df = ds.to_pandas() embs = np.stack(df["sentence_embedding"].values) anchor_scores = np.zeros(len(df)) for ex_idx, group in df.groupby("example_idx"): idx = group.index centroid = embs[idx].mean(axis=0) centroid /= np.linalg.norm(centroid) + 1e-12 sims = cosine_similarity(embs[idx], centroid.reshape(1, -1)).flatten() anchor_scores[idx] = sims df["anchor_score"] = anchor_scores ``` ## Related - Step 1 activations (#### token): `Realmbird/nla-thought-anchors-hash` - Step 1 activations (answer token): `Realmbird/nla-thought-anchors-answer` - Step 2 NLA descriptions: `Realmbird/nla-thought-anchors-hash-step2` - NLA actor: `kitft/nla-qwen2.5-7b-L20-av` - NLA critic: `kitft/nla-qwen2.5-7b-L20-ar`