Archive first GQA group diagnostics and define held-out group contrasts
This commit is contained in:
@@ -80,7 +80,8 @@ def main():
|
||||
return json.loads((args.directory/name).read_text())
|
||||
plan = read('protocol.json')
|
||||
questions = plan['holdout']
|
||||
modes = read('selection.json')['holdout_modes']
|
||||
selection = read('selection.json')
|
||||
modes = selection['holdout_modes']
|
||||
n = len(questions['swap']) // 2
|
||||
assert n >= 32 and len(questions['query']) == 2*n
|
||||
rng = random.Random(120204)
|
||||
@@ -115,13 +116,21 @@ def main():
|
||||
if 'send-permuted' in modes:
|
||||
contrasts['send-permuted-control'] = {'send': 1, 'send-permuted': -1}
|
||||
if 'read-group-0' in modes:
|
||||
selected = read('selection.json')['selected']
|
||||
selected = selection['selected']
|
||||
random_group = selection['random_group']
|
||||
other = next(m for m in modes if m.startswith('read-group-') and m != selected)
|
||||
# A uniform draw may select the same physical KV group.
|
||||
contrasts['selected-random'] = ({selected: 0} if selected == random_group
|
||||
else {selected: 1, random_group: -1})
|
||||
contrasts['selected-other'] = {selected: 1, other: -1}
|
||||
# Both groups are evaluated, so their mean is the exact expected
|
||||
# performance of a new uniform draw from this model's two groups.
|
||||
contrasts['selected-uniform-expectation'] = {selected: .5, other: -.5}
|
||||
contrasts['selected-full-read'] = {selected: 1, 'read': -1}
|
||||
summary[kind] = summarize_arms(arms, contrasts, resamples)
|
||||
isolation = {}
|
||||
layer_comparison = {}
|
||||
diagnostic_groups = {}
|
||||
for kind, prompts in plan['diagnostic'].items():
|
||||
arms = {}
|
||||
for mode in ('native', 'only-15', 'only-19', 'both-15-19'):
|
||||
@@ -149,10 +158,27 @@ def main():
|
||||
comparisons[f'{site}-interaction'] = {
|
||||
f'{site}-both': 1, 'baseline': 1, f'{site}-read': -1, f'{site}-send': -1}
|
||||
layer_comparison[kind] = summarize_arms(arms, comparisons, samples)
|
||||
if 'group_scores' in selection:
|
||||
groups = {'read': arms['19-read']}
|
||||
for mode in selection['group_scores']:
|
||||
rows = read(f'diagnostic-19-{mode}-{kind}.json')
|
||||
verify(tokenizer, protocol, prompts, rows, (mode,))
|
||||
groups[mode], _ = table_metrics(prompts, rows, mode)
|
||||
comparisons = {'group-0-minus-group-1': {'read-group-0': 1, 'read-group-1': -1}}
|
||||
comparisons.update({m+'-minus-full': {m: 1, 'read': -1}
|
||||
for m in selection['group_scores']})
|
||||
diagnostic_groups[kind] = summarize_arms(groups, comparisons, samples)
|
||||
for mode, score in selection.get('group_scores', {}).items():
|
||||
counts = [0, 0]
|
||||
for kind, prompts in plan['diagnostic'].items():
|
||||
result = diagnostic_groups[kind]['means'][mode]
|
||||
counts[0] += round(result['both_correct'] * (len(prompts)//2))
|
||||
counts[1] += round(result['correct'] * len(prompts))
|
||||
assert counts == score, (mode, counts, score)
|
||||
write_json(args.directory/'audit.json', dict(
|
||||
tables=n, bootstrap_seed=120204, bootstrap_replicates=len(resamples),
|
||||
tables=n, selection=selection, bootstrap_seed=120204, bootstrap_replicates=len(resamples),
|
||||
summary=summary, answers=detail, costs=costs, diagnostic_isolation=isolation,
|
||||
diagnostic_site_comparison=layer_comparison))
|
||||
diagnostic_site_comparison=layer_comparison, diagnostic_head_groups=diagnostic_groups))
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
||||
@@ -51,3 +51,9 @@
|
||||
第 15、19 层连续共享且第 23 层保持原生时,两种题型均降至 3/16,均为 0/8 对双正确。每种题型中 13 个错答有 12 个属于表内其他键。正确首位数字平均概率分别为 31.41% 和 32.71%。相对于两个单层条件,完整答案正确率的双层交互量在两种题型均为 −81.25 个百分点,按表配对重采样的 95% 区间均为 −93.75 至 −62.50 个百分点。两种题型共用 8 张表,区间分别报告。连续共享同时改变了第 19 层的供给分数和隐藏状态,这一反向对照本身无法分开两种影响。[双层共享换值答卷](../results/lisa-score-paths/diagnostic-isolation-both-15-19-swap.json) · [双层共享换键答卷](../results/lisa-score-paths/diagnostic-isolation-both-15-19-query.json)
|
||||
|
||||
双层共享与三层共享逐题的正误在两种题型中均为 16/16 相同,每种题型各有 13/16 份回答逐 token 相同。表 005 的换值题两次都问 dune,正确答案依次为 69、50。双层共享两次都读到 iris 的值,依次给出 50、69。再将第 23 层也共享,两次都读到 reed 的 99。因此双层共享已足以触发这批题上的严重错读,第 23 层仍可改变具体错读的键。
|
||||
|
||||
## 第 19 层按查询头组恢复本层读取
|
||||
|
||||
只对第 0 个 GQA 组的 4 个查询头恢复原生读取,向第 23 层传递的分数继续使用 LiSA,换值与换键各答对 16/16,均为 8/8 对双正确。换值表 004 第二问的正确答案是 68。恢复全部 8 个头回答 76,只恢复这 4 个头回答 68,给正确首位数字的概率分别为 46.26% 和 48.59%。不过在其余 15 道换值题以及全部 16 道换键题上,只恢复这 4 个头时该概率都更低,平均差分别为 −8.86 和 −12.62 个百分点。这是 8 张诊断表的逐题对照,头组的泛化效果要由冻结选择后的独立评估确定。实验先计算整层原生分数再按头混合,运行成本仍包含整层额外计算。[第 0 组换值答卷](../results/lisa-score-paths/diagnostic-19-read-group-0-swap.json) · [第 0 组换键答卷](../results/lisa-score-paths/diagnostic-19-read-group-0-query.json)
|
||||
|
||||
预注册种子 120203 的随机对照抽到第 0 组。由于两组都会在相同留出表上评估,另补充报告“选中组相对均匀随机选组的期望差”。在这两个可选组中各以一半概率选一组,该期望差恰好是选中组与另一组配对差的一半。此项描述性分析在查看留出答卷前补充,保留原定随机抽样对照;区间按表重采样,仅反映测试表的不确定性。
|
||||
|
||||
@@ -0,0 +1,306 @@
|
||||
[
|
||||
{
|
||||
"id": "paths-dev-000-0-query",
|
||||
"task": "lookup",
|
||||
"gold": 91,
|
||||
"first_digit_probability": 0.9845114350318909,
|
||||
"arms": {
|
||||
"read-group-0": {
|
||||
"tokens": [
|
||||
24,
|
||||
16,
|
||||
248046
|
||||
],
|
||||
"response": "91<|im_end|>",
|
||||
"stop": "eos",
|
||||
"answer": 91,
|
||||
"correct": true
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "paths-dev-000-1-query",
|
||||
"task": "lookup",
|
||||
"gold": 88,
|
||||
"first_digit_probability": 0.687419056892395,
|
||||
"arms": {
|
||||
"read-group-0": {
|
||||
"tokens": [
|
||||
23,
|
||||
23,
|
||||
248046
|
||||
],
|
||||
"response": "88<|im_end|>",
|
||||
"stop": "eos",
|
||||
"answer": 88,
|
||||
"correct": true
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "paths-dev-001-0-query",
|
||||
"task": "lookup",
|
||||
"gold": 34,
|
||||
"first_digit_probability": 0.6781959533691406,
|
||||
"arms": {
|
||||
"read-group-0": {
|
||||
"tokens": [
|
||||
18,
|
||||
19,
|
||||
248046
|
||||
],
|
||||
"response": "34<|im_end|>",
|
||||
"stop": "eos",
|
||||
"answer": 34,
|
||||
"correct": true
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "paths-dev-001-1-query",
|
||||
"task": "lookup",
|
||||
"gold": 56,
|
||||
"first_digit_probability": 0.9835748672485352,
|
||||
"arms": {
|
||||
"read-group-0": {
|
||||
"tokens": [
|
||||
20,
|
||||
21,
|
||||
248046
|
||||
],
|
||||
"response": "56<|im_end|>",
|
||||
"stop": "eos",
|
||||
"answer": 56,
|
||||
"correct": true
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "paths-dev-002-0-query",
|
||||
"task": "lookup",
|
||||
"gold": 26,
|
||||
"first_digit_probability": 0.8916571140289307,
|
||||
"arms": {
|
||||
"read-group-0": {
|
||||
"tokens": [
|
||||
17,
|
||||
21,
|
||||
248046
|
||||
],
|
||||
"response": "26<|im_end|>",
|
||||
"stop": "eos",
|
||||
"answer": 26,
|
||||
"correct": true
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "paths-dev-002-1-query",
|
||||
"task": "lookup",
|
||||
"gold": 98,
|
||||
"first_digit_probability": 0.97504061460495,
|
||||
"arms": {
|
||||
"read-group-0": {
|
||||
"tokens": [
|
||||
24,
|
||||
23,
|
||||
248046
|
||||
],
|
||||
"response": "98<|im_end|>",
|
||||
"stop": "eos",
|
||||
"answer": 98,
|
||||
"correct": true
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "paths-dev-003-0-query",
|
||||
"task": "lookup",
|
||||
"gold": 36,
|
||||
"first_digit_probability": 0.8805062174797058,
|
||||
"arms": {
|
||||
"read-group-0": {
|
||||
"tokens": [
|
||||
18,
|
||||
21,
|
||||
248046
|
||||
],
|
||||
"response": "36<|im_end|>",
|
||||
"stop": "eos",
|
||||
"answer": 36,
|
||||
"correct": true
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "paths-dev-003-1-query",
|
||||
"task": "lookup",
|
||||
"gold": 32,
|
||||
"first_digit_probability": 0.6238723993301392,
|
||||
"arms": {
|
||||
"read-group-0": {
|
||||
"tokens": [
|
||||
18,
|
||||
17,
|
||||
248046
|
||||
],
|
||||
"response": "32<|im_end|>",
|
||||
"stop": "eos",
|
||||
"answer": 32,
|
||||
"correct": true
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "paths-dev-004-0-query",
|
||||
"task": "lookup",
|
||||
"gold": 72,
|
||||
"first_digit_probability": 0.9260667562484741,
|
||||
"arms": {
|
||||
"read-group-0": {
|
||||
"tokens": [
|
||||
22,
|
||||
17,
|
||||
248046
|
||||
],
|
||||
"response": "72<|im_end|>",
|
||||
"stop": "eos",
|
||||
"answer": 72,
|
||||
"correct": true
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "paths-dev-004-1-query",
|
||||
"task": "lookup",
|
||||
"gold": 68,
|
||||
"first_digit_probability": 0.7214664220809937,
|
||||
"arms": {
|
||||
"read-group-0": {
|
||||
"tokens": [
|
||||
21,
|
||||
23,
|
||||
248046
|
||||
],
|
||||
"response": "68<|im_end|>",
|
||||
"stop": "eos",
|
||||
"answer": 68,
|
||||
"correct": true
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "paths-dev-005-0-query",
|
||||
"task": "lookup",
|
||||
"gold": 69,
|
||||
"first_digit_probability": 0.9121425747871399,
|
||||
"arms": {
|
||||
"read-group-0": {
|
||||
"tokens": [
|
||||
21,
|
||||
24,
|
||||
248046
|
||||
],
|
||||
"response": "69<|im_end|>",
|
||||
"stop": "eos",
|
||||
"answer": 69,
|
||||
"correct": true
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "paths-dev-005-1-query",
|
||||
"task": "lookup",
|
||||
"gold": 50,
|
||||
"first_digit_probability": 0.5593252182006836,
|
||||
"arms": {
|
||||
"read-group-0": {
|
||||
"tokens": [
|
||||
20,
|
||||
15,
|
||||
248046
|
||||
],
|
||||
"response": "50<|im_end|>",
|
||||
"stop": "eos",
|
||||
"answer": 50,
|
||||
"correct": true
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "paths-dev-006-0-query",
|
||||
"task": "lookup",
|
||||
"gold": 31,
|
||||
"first_digit_probability": 0.6581078767776489,
|
||||
"arms": {
|
||||
"read-group-0": {
|
||||
"tokens": [
|
||||
18,
|
||||
16,
|
||||
248046
|
||||
],
|
||||
"response": "31<|im_end|>",
|
||||
"stop": "eos",
|
||||
"answer": 31,
|
||||
"correct": true
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "paths-dev-006-1-query",
|
||||
"task": "lookup",
|
||||
"gold": 52,
|
||||
"first_digit_probability": 0.8840282559394836,
|
||||
"arms": {
|
||||
"read-group-0": {
|
||||
"tokens": [
|
||||
20,
|
||||
17,
|
||||
248046
|
||||
],
|
||||
"response": "52<|im_end|>",
|
||||
"stop": "eos",
|
||||
"answer": 52,
|
||||
"correct": true
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "paths-dev-007-0-query",
|
||||
"task": "lookup",
|
||||
"gold": 51,
|
||||
"first_digit_probability": 0.7561711072921753,
|
||||
"arms": {
|
||||
"read-group-0": {
|
||||
"tokens": [
|
||||
20,
|
||||
16,
|
||||
248046
|
||||
],
|
||||
"response": "51<|im_end|>",
|
||||
"stop": "eos",
|
||||
"answer": 51,
|
||||
"correct": true
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "paths-dev-007-1-query",
|
||||
"task": "lookup",
|
||||
"gold": 40,
|
||||
"first_digit_probability": 0.9014160633087158,
|
||||
"arms": {
|
||||
"read-group-0": {
|
||||
"tokens": [
|
||||
19,
|
||||
15,
|
||||
248046
|
||||
],
|
||||
"response": "40<|im_end|>",
|
||||
"stop": "eos",
|
||||
"answer": 40,
|
||||
"correct": true
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
@@ -0,0 +1,306 @@
|
||||
[
|
||||
{
|
||||
"id": "paths-dev-000-0",
|
||||
"task": "lookup",
|
||||
"gold": 91,
|
||||
"first_digit_probability": 0.9845114350318909,
|
||||
"arms": {
|
||||
"read-group-0": {
|
||||
"tokens": [
|
||||
24,
|
||||
16,
|
||||
248046
|
||||
],
|
||||
"response": "91<|im_end|>",
|
||||
"stop": "eos",
|
||||
"answer": 91,
|
||||
"correct": true
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "paths-dev-000-1",
|
||||
"task": "lookup",
|
||||
"gold": 88,
|
||||
"first_digit_probability": 0.6156299114227295,
|
||||
"arms": {
|
||||
"read-group-0": {
|
||||
"tokens": [
|
||||
23,
|
||||
23,
|
||||
248046
|
||||
],
|
||||
"response": "88<|im_end|>",
|
||||
"stop": "eos",
|
||||
"answer": 88,
|
||||
"correct": true
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "paths-dev-001-0",
|
||||
"task": "lookup",
|
||||
"gold": 34,
|
||||
"first_digit_probability": 0.6781959533691406,
|
||||
"arms": {
|
||||
"read-group-0": {
|
||||
"tokens": [
|
||||
18,
|
||||
19,
|
||||
248046
|
||||
],
|
||||
"response": "34<|im_end|>",
|
||||
"stop": "eos",
|
||||
"answer": 34,
|
||||
"correct": true
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "paths-dev-001-1",
|
||||
"task": "lookup",
|
||||
"gold": 56,
|
||||
"first_digit_probability": 0.9181733131408691,
|
||||
"arms": {
|
||||
"read-group-0": {
|
||||
"tokens": [
|
||||
20,
|
||||
21,
|
||||
248046
|
||||
],
|
||||
"response": "56<|im_end|>",
|
||||
"stop": "eos",
|
||||
"answer": 56,
|
||||
"correct": true
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "paths-dev-002-0",
|
||||
"task": "lookup",
|
||||
"gold": 26,
|
||||
"first_digit_probability": 0.8916571140289307,
|
||||
"arms": {
|
||||
"read-group-0": {
|
||||
"tokens": [
|
||||
17,
|
||||
21,
|
||||
248046
|
||||
],
|
||||
"response": "26<|im_end|>",
|
||||
"stop": "eos",
|
||||
"answer": 26,
|
||||
"correct": true
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "paths-dev-002-1",
|
||||
"task": "lookup",
|
||||
"gold": 98,
|
||||
"first_digit_probability": 0.9667057394981384,
|
||||
"arms": {
|
||||
"read-group-0": {
|
||||
"tokens": [
|
||||
24,
|
||||
23,
|
||||
248046
|
||||
],
|
||||
"response": "98<|im_end|>",
|
||||
"stop": "eos",
|
||||
"answer": 98,
|
||||
"correct": true
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "paths-dev-003-0",
|
||||
"task": "lookup",
|
||||
"gold": 36,
|
||||
"first_digit_probability": 0.8805062174797058,
|
||||
"arms": {
|
||||
"read-group-0": {
|
||||
"tokens": [
|
||||
18,
|
||||
21,
|
||||
248046
|
||||
],
|
||||
"response": "36<|im_end|>",
|
||||
"stop": "eos",
|
||||
"answer": 36,
|
||||
"correct": true
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "paths-dev-003-1",
|
||||
"task": "lookup",
|
||||
"gold": 32,
|
||||
"first_digit_probability": 0.8522821068763733,
|
||||
"arms": {
|
||||
"read-group-0": {
|
||||
"tokens": [
|
||||
18,
|
||||
17,
|
||||
248046
|
||||
],
|
||||
"response": "32<|im_end|>",
|
||||
"stop": "eos",
|
||||
"answer": 32,
|
||||
"correct": true
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "paths-dev-004-0",
|
||||
"task": "lookup",
|
||||
"gold": 72,
|
||||
"first_digit_probability": 0.9260667562484741,
|
||||
"arms": {
|
||||
"read-group-0": {
|
||||
"tokens": [
|
||||
22,
|
||||
17,
|
||||
248046
|
||||
],
|
||||
"response": "72<|im_end|>",
|
||||
"stop": "eos",
|
||||
"answer": 72,
|
||||
"correct": true
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "paths-dev-004-1",
|
||||
"task": "lookup",
|
||||
"gold": 68,
|
||||
"first_digit_probability": 0.4858723282814026,
|
||||
"arms": {
|
||||
"read-group-0": {
|
||||
"tokens": [
|
||||
21,
|
||||
23,
|
||||
248046
|
||||
],
|
||||
"response": "68<|im_end|>",
|
||||
"stop": "eos",
|
||||
"answer": 68,
|
||||
"correct": true
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "paths-dev-005-0",
|
||||
"task": "lookup",
|
||||
"gold": 69,
|
||||
"first_digit_probability": 0.9121425747871399,
|
||||
"arms": {
|
||||
"read-group-0": {
|
||||
"tokens": [
|
||||
21,
|
||||
24,
|
||||
248046
|
||||
],
|
||||
"response": "69<|im_end|>",
|
||||
"stop": "eos",
|
||||
"answer": 69,
|
||||
"correct": true
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "paths-dev-005-1",
|
||||
"task": "lookup",
|
||||
"gold": 50,
|
||||
"first_digit_probability": 0.9103696942329407,
|
||||
"arms": {
|
||||
"read-group-0": {
|
||||
"tokens": [
|
||||
20,
|
||||
15,
|
||||
248046
|
||||
],
|
||||
"response": "50<|im_end|>",
|
||||
"stop": "eos",
|
||||
"answer": 50,
|
||||
"correct": true
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "paths-dev-006-0",
|
||||
"task": "lookup",
|
||||
"gold": 31,
|
||||
"first_digit_probability": 0.6581078767776489,
|
||||
"arms": {
|
||||
"read-group-0": {
|
||||
"tokens": [
|
||||
18,
|
||||
16,
|
||||
248046
|
||||
],
|
||||
"response": "31<|im_end|>",
|
||||
"stop": "eos",
|
||||
"answer": 31,
|
||||
"correct": true
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "paths-dev-006-1",
|
||||
"task": "lookup",
|
||||
"gold": 52,
|
||||
"first_digit_probability": 0.8522105813026428,
|
||||
"arms": {
|
||||
"read-group-0": {
|
||||
"tokens": [
|
||||
20,
|
||||
17,
|
||||
248046
|
||||
],
|
||||
"response": "52<|im_end|>",
|
||||
"stop": "eos",
|
||||
"answer": 52,
|
||||
"correct": true
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "paths-dev-007-0",
|
||||
"task": "lookup",
|
||||
"gold": 51,
|
||||
"first_digit_probability": 0.7561711072921753,
|
||||
"arms": {
|
||||
"read-group-0": {
|
||||
"tokens": [
|
||||
20,
|
||||
16,
|
||||
248046
|
||||
],
|
||||
"response": "51<|im_end|>",
|
||||
"stop": "eos",
|
||||
"answer": 51,
|
||||
"correct": true
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "paths-dev-007-1",
|
||||
"task": "lookup",
|
||||
"gold": 40,
|
||||
"first_digit_probability": 0.8314186334609985,
|
||||
"arms": {
|
||||
"read-group-0": {
|
||||
"tokens": [
|
||||
19,
|
||||
15,
|
||||
248046
|
||||
],
|
||||
"response": "40<|im_end|>",
|
||||
"stop": "eos",
|
||||
"answer": 40,
|
||||
"correct": true
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
Reference in New Issue
Block a user