Compare holdout gains directly to the verified original LiSA baseline
This commit is contained in:
@@ -16,6 +16,26 @@ from functional.model import StreamingLM
|
||||
from functional.run import write_json
|
||||
|
||||
|
||||
def score_differences(scores):
|
||||
"""Per-question accuracy changes under each matched or original LiSA comparison."""
|
||||
shared = scores['shared-allocated']
|
||||
uniform = scores['shared-uniform']
|
||||
local = scores['local-allocated']
|
||||
prior = scores['prior-lisa']
|
||||
student = scores['trajectory-student']
|
||||
reference = scores['trajectory-reference']
|
||||
return {
|
||||
'rank-vs-uniform': shared - uniform,
|
||||
'rank-vs-prior': shared - prior,
|
||||
'rank-vs-reversed': shared - scores['shared-reversed'],
|
||||
'rank-vs-local': shared - local,
|
||||
'rank-interaction': (shared - uniform) - (local - scores['local-uniform']),
|
||||
'student-vs-prior': student - prior,
|
||||
'reference-vs-prior': reference - prior,
|
||||
'student-vs-reference': student - reference,
|
||||
}
|
||||
|
||||
|
||||
def changed_answers(questions, comparisons, local_uniform):
|
||||
"""Identify net gains that hide different sets of corrected and lost answers."""
|
||||
ids = np.array([item['id'] for item in questions]).reshape(local_uniform.shape)
|
||||
@@ -98,13 +118,7 @@ def main():
|
||||
scores[arm] = np.array([x['arms'][arm]['correct'] for x in rows],dtype=int).reshape(-1,2)
|
||||
generation[arm] = {'generated_tokens':sum(len(row['arms'][arm]['tokens']) for row in rows),
|
||||
'seconds':sum(row['batch_seconds'] for row in rows[::2])}
|
||||
comparisons = {'rank-vs-uniform':scores['shared-allocated']-scores['shared-uniform'],
|
||||
'rank-vs-reversed':scores['shared-allocated']-scores['shared-reversed'],
|
||||
'rank-vs-local':scores['shared-allocated']-scores['local-allocated'],
|
||||
'rank-interaction':scores['shared-allocated']-scores['shared-uniform']
|
||||
-scores['local-allocated']+scores['local-uniform'],
|
||||
'student-vs-prior':scores['trajectory-student']-scores['prior-lisa'],
|
||||
'student-vs-reference':scores['trajectory-student']-scores['trajectory-reference']}
|
||||
comparisons = score_differences(scores)
|
||||
rng = np.random.default_rng(72505)
|
||||
sample = rng.integers(0,len(questions)//2,size=(10000,len(questions)//2))
|
||||
audit = {'questions':len(questions),
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
分秩实验沿用上一轮教师分数与训练题的缓存。五组从固定种子初始化,各做两轮、每轮 24 步。按验证正确数选择检查点,同分取较早轮次。四组交互项为共享时分秩相对均匀秩的增益,减去关闭共享输入时的同一增益。反向分配用于检验高秩是否确实给对了层。
|
||||
|
||||
留出答卷还会列出每项两组比较中从错变对、从对变错的题号。对跨层共享与分秩的组合,单列两个单项均答错而组合答对的题,以及两单项均答对而组合答错的题,同时附上关闭共享且使用均匀秩时的结果。这些题号解释净正确数的来源,四组交互项衡量两种改动的增益是否相互影响。
|
||||
留出答卷还会列出每项两组比较中从错变对、从对变错的题号。对跨层共享与分秩的组合,单列两个单项均答错而组合答对的题,以及两单项均答对而组合答错的题,同时附上关闭共享且使用均匀秩时的结果。这些题号解释净正确数的来源,四组交互项衡量两种改动的增益是否相互影响。另将敏感度分秩、学生前缀蒸馏和标准答案前缀蒸馏分别与上一轮实际使用的 LiSA 检查点逐题比较,报告净正确率差、按题对重采样的区间以及得失题号。均匀秩组使用本轮验证集选择检查点,因此与上一轮的 LiSA 分别列出。
|
||||
|
||||
## 学生轨迹蒸馏
|
||||
|
||||
@@ -39,4 +39,6 @@
|
||||
|
||||
留出评估按每批两题记录生成耗时,从提示词编码前计时到回答解析结束,同时汇总生成 token 数。远程 CPU 在多个作业间共享,这些运行记录用于解释实际开销。要验证部署加速,还需要在受控负载下重复测量。
|
||||
|
||||
标准答案前缀组运行期间,逐字节读取远程底座权重,核对 4,548,221,488 字节权重分片的 SHA-256 与冻结清单及上游摘要相同,并复核分词器和配置。[底座文件核验](../results/lisa-combinations/native-files.json)
|
||||
|
||||
已记录远程部署的 13 个实现与测试文件摘要。部署目录中的 `crossqkv/lisa_full_answer.py` 来自提交 `c53d78b`。它与本轮主线版本的差异限于该模块自身的筛选命令行入口,本轮调用的 `evaluate`、`prompt`、`grade` 等函数一致。 [远程代码摘要](../results/lisa-combinations/execution.sha256)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
024720e9eae7556e4d5ca2ca1d71dd544815c79ed2c51b113564d5a6fb4ad004 crossqkv/lisa_combination_screen.py
|
||||
663d4dad556f08b69521543e73d67362d46dc694c747e72b6cb786da7484e090 crossqkv/lisa_rank_compare.py
|
||||
f212bd1b17b38d995060fc04b20a77b4e572cffc9b3776dc16ef7cf012ee89a3 crossqkv/lisa_trajectory_train.py
|
||||
0a91cc8b446165dfd33cd3e30e9fdeb5082202c4183eba9918404e01e30cb4b7 crossqkv/lisa_combination_eval.py
|
||||
e03e7edf719026ffd99bfc99a539ee22c71884baa5cdaf629d8f4e44e1565c41 crossqkv/lisa_combination_eval.py
|
||||
519e0a031efcfb69c9b86fca1cb649fe8bb93d799401c8023ff7b6549cded448 crossqkv/lisa_full_answer.py
|
||||
1a1a4cbc8e3c5b97accfe2d0ba18a21c9e2ebfa25d66561d7ef9c59668049efa crossqkv/lisa_full_answer_train.py
|
||||
57e73f1e30c8db8daec7b13d6455af2822b2db3e600531f8a60e2381d093ad91 crossqkv/lisa_full_answer_verify.py
|
||||
@@ -9,5 +9,5 @@ f212bd1b17b38d995060fc04b20a77b4e572cffc9b3776dc16ef7cf012ee89a3 crossqkv/lisa_
|
||||
d47b4c9cc34082e9b356e745821298a43981e4cd18ed55a3f59b4b6fe7cc46e3 crossqkv/lisa_tail.py
|
||||
9f0b6a53f107950661e91c16f03b49440708b3936120e2f84ef1d66f185257b6 crossqkv/lisa_train.py
|
||||
94437e0138c54ec34b1beaaa0e08a334ce0822f60af598a5a896459b778a3a1c functional/model.py
|
||||
a2585456d6e6093c8af7976ac26c37033d7352c4753991218ad64305827a7c23 tests/test_lisa_combinations.py
|
||||
e5953ed7e4cc58c49290bf768c173828ce1c29f36795f5c657ed0f1d76f0a371 tests/test_lisa_combinations.py
|
||||
e1d70b10863dab1e13dfa9573c0d87fc6ca017039c3cf9b90f7628f3e7fe5664 crossqkv/lisa_effect_answer_audit.py
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
{
|
||||
"revision": "15852e8c16360a2fea060d615a32b45270f8a8fc",
|
||||
"inputs": {
|
||||
"manifest.json": "28efbaf94a5034333339a35f08ead151459a7d20c6c2d2f07a451e7f3bf154de",
|
||||
"model_config.json": "ed1c1723241f23f7f4e23430759cbd7dcfb4103cbdfe052bfe7626b57c2615b4",
|
||||
"tokenizer.json": "5f9e4d4901a92b997e463c1f46055088b6cca5ca61a6522d1b9f64c4bb81cb42"
|
||||
},
|
||||
"shards": [
|
||||
{
|
||||
"name": "model.safetensors-00001-of-00001.safetensors",
|
||||
"bytes": 4548221488,
|
||||
"sha256": "aa33250c4fc64891ddfaba3a314fd9542ea371843c387178b425fbcc5ed680b1"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -7,7 +7,7 @@ from pathlib import Path
|
||||
import numpy as np
|
||||
import torch
|
||||
|
||||
from crossqkv.lisa_combination_eval import changed_answers
|
||||
from crossqkv.lisa_combination_eval import changed_answers, score_differences
|
||||
from crossqkv.lisa_combination_screen import SITES, paired_questions
|
||||
from crossqkv.lisa_rank_compare import assignments, make_adapters, score_gold_answers
|
||||
from crossqkv.lisa_trajectory_train import replay_teacher_inputs, reverse_kl
|
||||
@@ -36,6 +36,22 @@ class CombinationTests(unittest.TestCase):
|
||||
with self.assertRaises(ValueError):
|
||||
replay_teacher_inputs(native_tail, path, wrong_ids, start, lengths)
|
||||
|
||||
def test_combinations_compare_to_the_original_and_matched_controls(self):
|
||||
scores = {
|
||||
'prior-lisa': np.array([[0, 1]]), 'shared-uniform': np.array([[1, 0]]),
|
||||
'shared-allocated': np.array([[1, 1]]), 'shared-reversed': np.array([[0, 0]]),
|
||||
'local-allocated': np.array([[1, 0]]), 'local-uniform': np.array([[0, 0]]),
|
||||
'trajectory-student': np.array([[1, 0]]), 'trajectory-reference': np.array([[0, 0]]),
|
||||
}
|
||||
differences = score_differences(scores)
|
||||
for name, expected in {
|
||||
'rank-vs-prior': [[1, 0]], 'rank-vs-uniform': [[0, 1]],
|
||||
'rank-vs-reversed': [[1, 1]], 'rank-vs-local': [[0, 1]],
|
||||
'rank-interaction': [[-1, 1]], 'student-vs-prior': [[1, -1]],
|
||||
'reference-vs-prior': [[0, -1]], 'student-vs-reference': [[1, 0]],
|
||||
}.items():
|
||||
np.testing.assert_array_equal(differences[name], expected, err_msg=name)
|
||||
|
||||
def test_joint_recoveries_require_beating_both_single_methods_on_one_item(self):
|
||||
items = [{'id': name} for name in ['a', 'b', 'c', 'd']]
|
||||
diffs = {'rank-vs-uniform': np.array([[1, -1], [1, 0]]),
|
||||
|
||||
Reference in New Issue
Block a user