14 KiB
K3 Attention Residuals 训练期前向干预协议
协议 ID:llm-atlas-k3-attnres-forward-training-v1
冻结日期:2026-07-30
协议状态:结果前预注册 frozen;任何语义变更必须更换 protocol ID
父协议:llm-atlas-k3-attnres-gradient-scale-v1
0. 研究身份
这是 Round 07 定向线索之后的训练期架构消融。选中 depth mixer 在每一次 train / eval /
diagnostic forward 都用 source states 的算术平均,完全绕过该 mixer 的
query + key_norm + softmax 路径。
允许回答:
- 固定 groups 6+7 的 uniform forward 训练变体,能否在不触发预注册 BPC 失败护栏时, material 地降低最终固定 activation-gradient spike?
- group 6、group 7 与 joint 的训练轨迹呈现什么非加性关系?
- Round 07 指向的 group 7 MLP-only 路径能否独立产生 material response?
不允许回答:
- 真实 Kimi K3 2.8T checkpoint 的梯度或训练动力学;
- 论文 Figure 5(c) 未公开 telemetry 的复现;
- “forward effect” 与 natural backward/update effect 的分离;
- selected query/key 参数如果继续训练会怎样;
- 三 seed 外的总体显著性、置信区间或 p-value;
- 下游能力保持、通用质量等价或最优 AttnRes 设计;
- 单组 effects 的可加性、Shapley value、方差贡献或因果交互;
- 与 Round 07 value-coefficient intervention 同构的“纯 forward”因果复制;
- K3
A_log的官方修复裁决。
1. 冻结训练与数据合同
| 字段 | 固定值 |
|---|---|
| architecture | Block AttnRes |
| Transformer depth | 32 |
| aggregation groups | 8 |
| blocks / group | 4 |
| depth / output mixers | 64 / 1 |
| width / heads / FFN | 192 / 6 / 768 |
| context / vocabulary | 256 / byte-256 |
| seeds | 2026073001 / 2026073002 / 2026073003 |
| steps / batch | 8,000 / 32 |
| target bytes / new formal cell | 65,536,000 |
| optimizer | AdamW |
| peak / min LR | 3e-4 / 3e-5 |
| warmup | 400 |
| weight decay | 0.1 for ndim ≥ 2 |
| betas / epsilon | 0.9, 0.95 / 1e-8 |
| clip | global norm 1.0 |
| forward | CUDA BF16 autocast |
| residual accumulation | explicit FP32 |
| validation | fixed 64 × 256-byte windows |
| diagnostic | fixed 16 × 256-byte windows |
| checkpoints | 0 / 100 / 500 / 2,000 / 4,000 / 8,000 |
| concurrency | at most two independent processes |
训练输入 schedule 逐 step 复用父协议。window_start 使用父
llm-atlas-k3-attnres-gradient-scale-v1 的 salt;新 protocol ID 只写入 wrapper output
和 study manifest,绝不能进入 round04.PROTOCOL_ID 或训练窗口散列。父 manifest
负责 bytes / windows / schedule,新 manifest 只负责 variants / selector / thresholds。
每个 variant / seed 的初始化、optimizer input、validation 与 diagnostic tensors 必须
exact 相同。
runner 必须继承 Round 05 GradientLanguageModel 的 explicit FP32 Block residual
accumulation;不得退回 Round 04 的旧累加路径。
新正式处理量:
4 variants × 3 seeds × 65,536,000 = 786,432,000 target bytes
1 primary replay 65,536,000 target bytes
total newly processed 851,968,000 target bytes
historical learned reference 196,608,000 target bytes(不重跑)
每格必须使用全新 Python process。最多并行两个;不能共享 model、optimizer、RNG、 CUDA graph 或 output file。
2. 冻结正式矩阵
正式 variants:
| variant | exact selected depth indices | layers / branch |
|---|---|---|
uniform_group_6_forward |
40–47 | 21–24 / both |
uniform_group_7_forward |
48–55 | 25–28 / both |
uniform_groups_6_7_forward |
40–55 | 21–28 / both |
uniform_group_7_mlp_forward |
49, 51, 53, 55 | 25–28 / MLP |
learned_reference 只允许 smoke,不进入新正式矩阵。output mixer index 64 永远 learned。
正式运行 12 格;另从初始化 replay:
replay / uniform_groups_6_7_forward / seed 2026073001
3. 唯一 selector 与 forward 语义
runner 必须只有一个 machine-readable selector:
selected(variant, depth_mixer_index) -> bool
不得把四个 variant 分叉成四份 model forward。
对未选中 depth mixer 和 output mixer,逐调用父 DepthMixer.forward。对选中 mixer,
为了让初始化负控制复用相同浮点归约顺序,使用参数无关的零 logits,但仍走父
softmax + einsum 数值 kernel:
values = stack(sources, dim=0)
logits = zeros([N, batch, tokens], dtype=FP32)
weights = softmax(logits, dim=0)
output = einsum("nbt,nbtd->btd", weights, values.float()).to(values.dtype)
capture summary 必须仍使用父 schema:
mean_weights = [1 / N] × N
entropy_mean = ln(N)
sources = N
选中路径不得调用 query、key_norm 或 source-dependent logits,也不得用
stop-gradient trick 让这些参数看似参与。这里保留的 softmax 只把常数零 logits 变成
1/N,目的是与父路径保持同一 arithmetic kernel;它没有可训练参数。自然结果是选中
mixer 的 query 和 key_norm.weight:
- gradient hook call count 必须为 0;
- optimizer state entry 必须不存在;
- final tensor 必须与 initial tensor byte-exact。
所有未选中 depth mixer 和 output mixer 的两个参数都必须有正的 gradient hook call count;这只证明图可达,不要求它们的梯度非零或最终 tensor 一定变化。hook census 从 model 构造后开始,覆盖所有 training backward 与 diagnostic backward;eval forward 不计 hook。selected 参数允许保留在原 AdamW param groups,但 state entry 必须 不存在,不能表述为“训练了但没有移动”。
4. 结果前实现闸门
4.1 empty-selector 父等价
learned_reference smoke 必须直接走父 forward,不得走常数 uniform 分支;它与父
Round 05 runner 在相同 seed / 20 steps 下必须:
- initial/final model hashes exact;
- final optimizer hash exact;
- evaluations、diagnostics 与 training history exact;
- gradient gate exact;
- input tensor hashes exact。
允许不同字段只限 protocol wrapper identity、study-manifest wrapper、timing、规范化 后的 manifest path、output path 与 self-hash。AdamW 参数分组必须保持父语义; empty-selector 不能删除任何 mixer 参数。
4.2 step-0 identity negative control
父模型所有 depth mixer query 初始化为 0,因此 learned softmax 在 step 0 是 exact
uniform。选中分支用同 dtype 的 constant-zero logits 和同一个
softmax + einsum kernel。四个 variant 与 learned reference 在固定 input 上必须:
- logits byte-exact;
- CE byte-exact;
- activation-gradient spectrum byte-exact;
- validation metrics byte-exact;
- selected 的归约前 weight tensor 等于 FP32
1/N,max absolute error≤ 1e-12;capture 的mean_weights因 FP32 大规模 mean 可有约1e-8的归约舍入, 但必须与父 learned capture summary byte-exact; - 若任何跨 variant byte-exact 比较失败,hard-fail;不得在结果后改成容差 gate。
这个负控制只约束初始化;训练开始后 forward 必须允许分化。
4.3 selector census
每个 forward 的 64 个 depth index 必须各访问一次,output 访问一次且保持 learned。 每个 variant 的 selected set 必须与第 2 节 exact。group 内 source counts 必须满足:
group 6: index 40 has N=6; indices 41..47 have N=7
group 7: index 48 has N=7; indices 49..55 have N=8
推导前提是 completed 含 embedding,且每 8 个 depth mixer 才把 partial 聚合为一个
completed group。
正式 output 保存 exact selected indices、实际 visit census、source counts 与 uniform-weight max error。任何漏访、重访、越界或 output 被选中都失败。
4.4 数据、有限性与梯度尺度
- 父 manifest、train/validation/diagnostic bytes 与 schedule hashes exact;
- step 0 / 1 / 7,999 optimizer input gate hashes exact;
- loss、logits、所有主 activation gradients 全部 finite;
- global clip 后每一步都执行 optimizer update,不允许 skip;
- smoke 的 diagnostic loss
×2时,每层 activation-gradient RMS 比值在2 ± 1e-5,normalized spectrum max delta≤ 1e-6。
5. 历史 reference 配对合同
reference 固定为:
experiments/k3/attnres_gradient/results/raw/
formal-depth-32-block-seed-{seed}.json
analyzer 的 pairing hard gates:
protocol_id = llm-atlas-k3-attnres-gradient-scale-v1;- formal / block / depth 32 / 8,000 steps / batch 32;
- seed exact;
- initial public 与 mixer hashes 跟对应新 variant exact;
- formal schedule、validation tensor、diagnostic tensor 和三个 input gate hashes exact;
- model topology、optimizer hyperparameters、CUBLAS workspace、deterministic flags 与 autocast 语义 exact。
以下字段明确不参与 pairing equality:
- 所有 final hashes、evaluations、diagnostics、training history 与 gradient gate;
- timing、run kind、self-hash、output path 与 manifest path 字符串;
- GPU 名称、driver / CUDA / torch version 的 minor 差异。
环境完整记录;若数值栈变化,aggregate 给出 metadata warning,但只要上述确定性与 autocast 合同相同就不将其误判为 pairing failure。父 JSON 没有 initial full-state 字段, 不得假定它存在;public ∪ mixer 的完整性只用结构/元素 census 自洽。
reference 是历史配对基线,不得写成同期随机对照。若任何合同不等,整轮 aggregate 失败,而不是降级为“近似比较”。
6. 固定主对象与公式
每个 diagnostic checkpoint 从:
activation_grad_rms_by_block = [g1, ..., g32]
layer_id ∈ {1,...,32}
g[layer_id] = activation_grad_rms_by_block[layer_id - 1]
S = {21,22,23,24,25} # 1-based
R = {1,...,32} \ S
计算:
C = mean(g[S]) / mean(g[R]) # spike contrast
P = max(g) / mean(g) # peak normalized
所有 g、C、P 必须 finite 且严格大于 1e-30。groups 6+7 还改写落在 R
中的 layers 26–28,所以 analyzer 同时报告 mean(g[S]) 与 mean(g[R]),但不把它们
加入主 status。
对同 seed reference X_ref 与 variant X_v:
D_X(v) = (X_ref - X_v) / X_ref
D>0 表示 attenuation,D<0 表示 amplification。不得取绝对值,不得更换分母。
7. 预注册判定
7.1 主判定
uniform_groups_6_7_forward 的主 attenuation gate 只读取 step=8,000:
D_C >= 0.20 AND D_P >= 0.20
for all 3 seeds
质量 gate 也只读取 evaluations[step=8000].bits_per_byte:
delta_bpc(seed) = final_bpc_variant - final_bpc_reference
delta_bpc(seed) <= 0.05 for all 3 seeds
mean(delta_bpc) <= 0.03
只有 attenuation 6/6 与 quality 4/4 同时通过,正式 status 才是:
forward_training_attenuation_established_within_reduced_protocol
否则按失败位置使用:
attenuation_not_established
quality_guard_failed
attenuation_and_quality_failed
不能用次级变体补救主判定。任何 step 8,000 缺失/重复、数组长度错误、hash 不配对、
selector / reachability 失败、g/C/P/BPC/D/log 缺失或非 finite 都是
contract_failed 并让 analyzer non-zero exit;不能把结构失败包装成上面的科学状态。
7.2 次级 material response
group 6、group 7、group 7 MLP-only 各自使用同一 20% / 3-seed / 2-metric attenuation
threshold 和同一 quality guard,分别报告:
secondary_material_response / secondary_response_not_established
它们不改变主 status,也不升级成 localization。
7.3 BPC 护栏的解释
+0.05 per seed / +0.03 mean 是预注册的 catastrophic-degradation screen:
- 失败说明不能把 spike 下降当成健康训练的证据;
- 通过不说明能力、校准或下游任务等价;
- BPC 改善也不说明总体架构更优。
8. 非加性交互与轨迹
对 X ∈ {C,P}、每个 seed、每个 checkpoint:
E6 = ln(X_ref / X_group6)
E7 = ln(X_ref / X_group7)
E67 = ln(X_ref / X_groups6+7)
I67 = E67 - E6 - E7
保存 E6/E7/E67/I67 原值、对应 D_C/D_P 和三 seed mean/range。没有通过阈值、
p-value 或 CI。它是三套独立训练在相同 checkpoint 的跨-run log residual;
I67 不能写成可加贡献、独立作用、Shapley value 或因果 interaction estimate。
同时全量保存:
- 六 checkpoints 的 32-layer raw / normalized spectra;
- peak layer、top-five layers;
- validation BPC 与 train-loss trajectory;
- selected/unselected mixer weight summaries;
- selected-parameter reachability audit;
- per-cell timing 与显存(不进入数值结论)。
9. replay 与 analyzer 合同
primary seed-1 replay 使用 analyzer 定义的 scientific canonical payload。先删除:
run_kind
timing
canonical_sha256_without_self
manifest.path
study_manifest.path
再比较以下固定字段 exact:protocol / variant / architecture / depth / seed / steps / batch / target bytes、manifest scientific hashes、model、optimizer、initial/final hashes、 evaluations、diagnostics、training history、selector 与 reachability audits,以及 environment 中 deterministic / autocast scientific subset。GPU/版本 metadata 保留在 两份文件中单独展示,不进入 canonical equality。
所有主指标、阈值、status、interaction map 与 compact website artifact 只能由单一
experiments/k3/attnres_forward/analyze.py 生成。网站不能在 TypeScript 中重新计算
另一套结论。
analyzer 在任何结构、hash、selector、reachability、finite、reference pairing、 replay 或 threshold contract 失败时必须 non-zero exit,不得输出部分通过结论。
10. 报告语言红线
允许:
- “在这个固定缩小模型与训练协议内,局部 uniform-forward 变体……”
- “selected mixer 参数在此架构消融中结构性不可达……”
- “joint log effect 呈现正/负 interaction residual……”
禁止:
- “证明 K3 的训练尖峰来自 group 6/7”
- “只改变 forward,所以这是纯 forward 因果效应”
- “BPC gate 通过,所以能力不受影响”
- “interaction residual 是两个 group 的真实贡献”
- “contrast 下降证明尖峰层本身下降”(未同时检查
S/R分拆) - “step-0 exact 说明训练期始终与 learned forward 恒等”
- “复现了 K3 Figure 5(c)”
- “已经验证官方 2.8T checkpoint”