efficient-cot
收藏资源简介:
该数据集是 Efficient CoT 项目的一部分,用于训练激活探针以预测补丁修复成功。数据来源于 Llama-3.1-8B-Instruct 模型在贪婪解码链式思维(CoT)生成过程中收集的隐藏状态,覆盖 26 个推理任务(24 个 BIG-Bench-Hard 任务、GSM8K 和 StrategyQA)。每个存储的状态都带有因果标签:将该状态激活修补到同一问题的直接答案(无 CoT)运行中,是否能够恢复正确答案。数据集包含 9,370 个 HDF5 文件,总计约 176 GiB,每个文件对应一个问题,存储在 `llama8B/<dataset>/sample_<idx>.h5` 路径下。涵盖了 17 个层(0, 2, 4, …, 30, 31),每个层组包含三个行对齐的数据集:`hidden_states`(形状为 (N, 4096) 的 float16 残差流状态)、`source_positions`(形状为 (N,) 的 int32 轨迹 token 索引)和 `labels`(形状为 (N,) 的 bool 标签)。标签为 True 表示该状态是“拯救性”的。文件根属性还包含完整的出处信息,如 CoT 文本、数据集名称、样本索引、正确答案等。注意:`bbh_salient_translation_error_detection` 任务虽然包含在内,但被排除在所有探针训练和报告结果之外。该数据集适用于机械可解释性研究,特别是分析残差流中成功推理信号的位置和形式。
This dataset is part of the Efficient CoT project, used to train activation probes to predict patch repair success. The data comes from hidden states collected during greedy decoding chain-of-thought (CoT) generation by the Llama-3.1-8B-Instruct model, covering 26 reasoning tasks (24 BIG-Bench-Hard tasks, GSM8K, and StrategyQA). Each stored state has a causal label: whether patching that state activation into the direct answer (no CoT) run of the same question can recover the correct answer. The dataset contains 9,370 HDF5 files totaling about 176 GiB, each corresponding to one question, stored under the path `llama8B/<dataset>/sample_<idx>.h5`. It covers 17 layers (0, 2, 4, …, 30, 31), and each layer group contains three row-aligned datasets: `hidden_states` (float16 residual stream states of shape (N, 4096)), `source_positions` (int32 trajectory token indices of shape (N,)), and `labels` (bool labels of shape (N,)). A label of True indicates that the state is salvaging. The file root attributes also contain complete provenance information, such as CoT text, dataset name, sample index, correct answer, etc. Note: The `bbh_salient_translation_error_detection` task is included but excluded from all probe training and reported results. This dataset is suitable for mechanistic interpretability research, particularly for analyzing the location and form of successful reasoning signals in the residual stream.
数据集概述
该数据集是 Efficient CoT 项目的训练语料,用于研究大语言模型在链式思维(Chain-of-Thought, CoT)推理过程中的内部状态与推理成功之间的关系。
核心内容
- 基础模型:
meta-llama/Llama-3.1-8B-Instruct,隐藏层维度为 4096。 - 数据来源:在 26 个推理任务上通过贪心解码生成的 CoT 轨迹。
- 24 个 BIG-Bench-Hard 任务(每个任务最多 250 个测试问题)
- GSM8K(全部 1,319 个测试问题)
- StrategyQA(全部 2,290 个问题)
- 核心特征:每一个存储的隐藏状态都带有因果标签,即通过激活修补(activation patching)将该状态注入同一问题的无 CoT 直接回答运行中,是否能恢复正确答案。标签为
True表示该状态具有“拯救”能力。
文件结构
- 存储格式:每个问题对应一个 HDF5 文件,路径为
llama8B/<dataset>/sample_<idx>.h5。 - 规模:共 9,370 个 HDF5 文件,总大小约 176 GiB(float16,gzip 压缩)。
- 覆盖层:包含 0, 2, 4, …, 30, 31 共 17 个 Transformer 层。
每个文件中,根属性存储完整的来源信息(如 CoT 文本、数据集名称、样本索引、正确答案、模型名称、种子等)。每个层组 layers/<L> 包含三个行对齐的数据集:
| 数据集 | 形状 | 数据类型 | 含义 |
|---|---|---|---|
hidden_states |
(N, 4096) | float16 | 层 L、位置 p 的残差流状态 |
source_positions |
(N,) | int32 | 每个行对应的 token 索引 |
labels |
(N,) | bool | 修补结果(是否恢复正确答案) |
标签语义
对于每个存储的源位置,将 CoT 轨迹中该位置的层 L 隐藏状态,修补到同一问题的直接回答运行(无 CoT)的固定目标位置,并重新生成。若修补后的运行产生正确答案,则标签为 True(即拯救状态)。
使用说明
- 加载方式:可通过
huggingface_hub的snapshot_download下载,并配合h5py读取。 - 缓存后端:该仓库可直接作为缓存后端,设置
hs_cache_dir=hf://hoomeh/efficient-cot后可按需增量下载。 - 数据划分:问题级别的训练/验证/测试集划分(75/5/20)不存储在此,而是通过
seed=42和固定的 26 任务码本确定性生成,确保所有已发表的划分可精确复现。
注意事项
bbh_salient_translation_error_detection任务虽包含在内,但其轨迹退化(多数坍缩为 5-token 片段),在所有探针训练和报告结果中均被排除。实验使用其余 25 个任务。
许可证与来源
- 激活数据:源自 Llama-3.1-8B-Instruct(Llama 3.1 社区许可)。
- 源问题:来自 BIG-Bench-Hard(MIT)、GSM8K(MIT)和 StrategyQA(MIT)。
- CoT 生成:使用贪心解码,
max_gen_len通常为 400。
引用
引用条目将在代码发布时一并添加。




