experiment_0-stats
收藏资源简介:
该数据集是 SOAR I-6 项目“实现指标”实验(experiment_0)的预计算统计缓存,专注于 Matryoshka 稀疏自动编码器(SAE)的层次结构分析。数据通过将 google/gemma-2-2b 模型在 NeelNanda/pile-10k 子集(400 篇文档,上下文长度 128)上运行,并在残差流上应用 Matryoshka SAE 产生。数据集包含 5 个层(3、6、12、18、24)的统计文件,每个文件约 700 MB,总大小约 3.4 GB。每个文件是一个 torch.save 字典,存储了 SAE 的 32768 个特征的相关统计量,这些特征被划分为 5 个嵌套的 Matryoshka 块(前缀长度 [128, 512, 2048, 8192, 32768])。主要字段包括:fire_count(每个特征激活的 token 数)、total_tokens(排除 BOS 后的总 token 数)、token_counts 和 buckets(token 频率计数和三个频率桶)、cofire(相邻块对的联合激活计数)、cofire_by_bucket(按频率桶划分的联合激活)、g_parent_sum 和 g_child_sum(用于计算指标 2 的消融增益累积)、err_sum_c(基础重建误差)、fire_c_by_bucket(子块在每个频率桶中的激活计数)、within_cofire(块内联合激活,用于兄弟冗余指标 3)、energy_cofire 等(第二遍累积器,仅 v2 版本)。数据集提供 v1 和 v2 两个版本:v1 包含 BOS token 的联合激活计数,v2 排除了 BOS token 并增加了能量和联合累积器。注意事项:B3→B4 对因内存原因被排除;B4 子块的兄弟冗余指标不可用;在 Apple MPS 上累积器使用 float32 而非 float64。该数据集可直接用于在 CPU 上运行完整的层次指标分析,无需 GPU。
This dataset is a precomputed statistics cache for the Realization Metrics experiment (experiment_0) of the SOAR I-6 project, focusing on hierarchical analysis of Matryoshka Sparse Autoencoders (SAE). The data is generated by running the google/gemma-2-2b model on a subset of NeelNanda/pile-10k (400 documents, context length 128) and applying Matryoshka SAE on the residual stream. The dataset contains statistics files for 5 layers (3, 6, 12, 18, 24), each approximately 700 MB, totaling about 3.4 GB. Each file is a torch.save dictionary storing statistics for 32768 features of the SAE, which are partitioned into 5 nested Matryoshka blocks (prefix lengths [128, 512, 2048, 8192, 32768]). Key fields include: fire_count (number of tokens where the feature activates), total_tokens (total tokens excluding BOS), token_counts and buckets (token frequency counts and three frequency buckets), cofire (joint activation count for adjacent block pairs), cofire_by_bucket (joint activation partitioned by frequency buckets), g_parent_sum and g_child_sum (cumulative ablation gains for metric 2), err_sum_c (baseline reconstruction error), fire_c_by_bucket (activation counts of child blocks in each frequency bucket), within_cofire (intra-block joint activation for sibling redundancy metric 3), energy_cofire (second pass accumulators, v2 only). Two versions are provided: v1 includes joint activation counts with BOS tokens, v2 excludes BOS tokens and adds energy and joint accumulators. Notes: B3→B4 pairs are excluded due to memory constraints; sibling redundancy metric for B4 child blocks is unavailable; accumulators use float32 instead of float64 on Apple MPS. This dataset can be used directly on CPU for full hierarchical metric analysis without GPU.
数据集概述:SOAR I-6 experiment_0 — Matryoshka SAE 共激活统计
数据集简介
该数据集是 SOAR I-6 项目中“Implement Metrics”实验(soar-eleuther-i6-hierarchy/metrics)的 Stage-01 张量缓存,用于研究稀疏自编码器(SAE)中的层级结构。数据集提供了通过 google/gemma-2-2b 模型及其 Matryoshka SAE 对 NeelNand/pile-10k(400 篇文档,上下文长度 128)进行单次扫描后累积的所有统计量,使用户无需运行 GPU 密集型步骤 cache_stats.py,即可在 CPU 上完成整个分析流程。
文件内容
数据集包含五个层级的缓存文件,每个文件约 700 MB:
| 文件路径 | 层 | SAE 标识 | 大小 |
|---|---|---|---|
layer_03/exp0_stats.pt |
3 | gemma-2-2b/3-res-matryoshka-dc |
~700 MB |
layer_06/exp0_stats.pt |
6 | gemma-2-2b/6-res-matryoshka-dc |
~700 MB |
layer_12/exp0_stats.pt |
12 | gemma-2-2b/12-res-matryoshka-dc |
~700 MB |
layer_18/exp0_stats.pt |
18 | gemma-2-2b/18-res-matryoshka-dc |
~700 MB |
layer_24/exp0_stats.pt |
24 | gemma-2-2b/24-res-matryoshka-dc |
~700 MB |
所有五个层级文件总计约 3.4 GB。
文件内部结构
每个文件均为 torch.save 字典(加载时需要 weights_only=False)。SAE 的 32768 个特征按前缀长度 [128, 512, 2048, 8192, 32768] 划分为 5 个嵌套 Matryoshka 块:B0=[0,128)、B1=[128,512)、B2=[512,2048)、B3=[2048,8192)、B4=[8192,32768)。块对条目以 "0->1"、"1->2" 等键值存储,矩阵内的特征索引为块局部索引。
主要字段说明
| 键名 | 形状/类型 | 含义 |
|---|---|---|
schema_version |
int(2) |
v2 = 排除 BOS 标记,并包含二次扫描附加项 |
fire_count |
[32768] |
每个特征激活的 token 数(激活值 > 1e-3) |
total_tokens |
int | 扫描中 token 总数(不含 BOS) |
token_counts, buckets |
张量 | token 频率计数及 3 个频率桶(0 = 质量前 50%,1 = 接下来 40%,2 = 其余) |
pairs |
list | 存在的相邻块对 |
cofire |
{pair: [P, C]} |
父块与子块同时激活的 token 数 |
cofire_by_bucket |
{pair: [3, P, C]} |
按频率桶分类的共激活计数(指标 5) |
g_parent_sum |
{pair: [P, C]} |
子块 token 上的消融增益 Σ(指标 2) |
g_child_sum, err_sum_c |
{block: [C]} |
子块自身的增益和基础重建误差(指标 2 的分母) |
fire_c_by_bucket |
{block: [3, C]} |
每个频率桶的子块激活次数 |
within_cofire |
{block: [C, C]} |
块内共激活(用于兄弟冗余,指标 3);仅块 1–3 可用 |
energy_cofire, union_count, union_energy, energy_total |
{pair: ...} |
二次扫描(run_second_pass.py)的累加器 |
config |
dict | 层、SAE ID、块范围、fire_threshold、n_docs、上下文大小等完整运行来源信息 |
技术说明
- 在 Apple MPS 上,累加器为 float32 而非 float64(MPS 不支持 float64),但不影响结果(计数保持在 float32 的精确整数范围内,重建和仅作为比率读取)。
版本差异(v1 vs v2)
- v1(
layer_NN/):原始缓存,包含 BOS 标记在共激活计数中。所有已发布数据和在线站点均由 v1 生成。 - v2(
v2/layer_NN/):于 2026-08-06 重新生成,排除 BOS 标记,并新增 v1 完全缺失的能量和并集累加器(指标 1c、8、9)。
重要差异:BOS 标记是注意力汇聚点(attention sink),每个特征都会在 BOS 上激活。在 400 篇文档中,每个块对都会获得 400 次联合激活,而 MIN_JOINT 设为 30,使得字典中所有对都满足联合支持保护条件。排除 BOS 后,候选数量最多可减少 6,173 倍,所有读取共激活矩阵的指标都会随之变化。官方建议使用 v2,v1 仅保留以确保已发布数据的可复现性。
使用限制
B3→B4块对因内存原因(6144 × 24576)从对累加器中排除。- 兄弟冗余(指标 3)对 B4 子块不可用,原因相同。
相关资源




