Record LiSA task and CPU performance results
This commit is contained in:
@@ -12,10 +12,17 @@ At the same 22 layers, direct score sharing retained 46.76% and the direct
|
|||||||
sharing plus LoRA baseline retained 65.95%. The published main uptraining
|
sharing plus LoRA baseline retained 65.95%. The published main uptraining
|
||||||
used 4.2 billion sampled RedPajama tokens on eight A800 GPUs. This experiment
|
used 4.2 billion sampled RedPajama tokens on eight A800 GPUs. This experiment
|
||||||
uses a frozen Qwen3.5-2B backbone, two recipient layers, 12 synthetic fit
|
uses a frozen Qwen3.5-2B backbone, two recipient layers, 12 synthetic fit
|
||||||
prompts and a single CPU runner. The comparable effect is an improvement
|
prompts and a single CPU runner. Each epoch of the trainable variants sees
|
||||||
over direct sharing under a fixed layer schedule. The magnitude on a
|
1,874 next-token targets drawn from those same 12 prompts. The comparable
|
||||||
32-item lookup test and the timing of CPU attention should be interpreted
|
effect is an improvement over direct sharing under a fixed layer schedule.
|
||||||
within those settings. [Mu et al., Table 2 and Appendix C.1](https://aclanthology.org/2026.tacl-1.30.pdf)
|
The magnitude on a 32-item lookup test and the timing of CPU attention should
|
||||||
|
be interpreted within those settings. [Mu et al., Table 2 and Appendix C.1](https://aclanthology.org/2026.tacl-1.30.pdf)
|
||||||
|
|
||||||
|
Qwen's text decoder has six full-attention layers and 18 linear-attention
|
||||||
|
layers. The chained configuration modifies two of the six full-attention
|
||||||
|
layers and two of the 24 decoder layers overall. Layer numbers are zero-based.
|
||||||
|
The source record in `results/lisa-effect-reproduction/runtime.json` pins
|
||||||
|
the original model revision, the checkpoint shard and its download-manifest hash.
|
||||||
|
|
||||||
## Task and layer screening
|
## Task and layer screening
|
||||||
|
|
||||||
@@ -140,6 +147,10 @@ four-choice correctness in the primary test and the full-vocabulary pass.
|
|||||||
Training scores *all* valid shifted tokens with exact full-vocabulary CE
|
Training scores *all* valid shifted tokens with exact full-vocabulary CE
|
||||||
and uses the validation four-option answer loss to freeze checkpoints. The
|
and uses the validation four-option answer loss to freeze checkpoints. The
|
||||||
answer audit scores only the answer position over the whole vocabulary.
|
answer audit scores only the answer position over the whole vocabulary.
|
||||||
|
The answer is one token per prompt. In the fit set, it accounts for about
|
||||||
|
0.64% of the unweighted CE target mass and about 9.35% with the 16-fold answer
|
||||||
|
weight. The objective applies the same 0.75 coefficient to the resulting
|
||||||
|
mean CE in both trainable variants.
|
||||||
It does not report whole-prompt CE for the held-out items or free-form
|
It does not report whole-prompt CE for the held-out items or free-form
|
||||||
multi-token answer accuracy. That distinction is important for interpreting
|
multi-token answer accuracy. That distinction is important for interpreting
|
||||||
the previous experiment, in which those two losses moved in opposite
|
the previous experiment, in which those two losses moved in opposite
|
||||||
|
|||||||
@@ -0,0 +1,31 @@
|
|||||||
|
# Qwen3.5-2B 双层 LiSA 复现实验
|
||||||
|
|
||||||
|
在固定的 32 道查找题上,原模型、直接共享、线性修正和两版 LiSA 都答对 32 道。原版 LiSA 降低了接收层 K/V 缓存,并在投影权重常驻内存时缩短了两个接收层的单步解码时间。按本次 CPU 权重流式读取方式测量,第 19 层单步解码更快,第 23 层略慢,双层共享的预填充更慢。全词表答案复核正在运行。
|
||||||
|
|
||||||
|
## 四选一任务表现
|
||||||
|
|
||||||
|
开发筛选中,原模型和单层直接共享各答对 8/8,双层直接共享答对 7/8。以此冻结 16 条目查找任务,测试使用独立题目。共享链为 15→19→23,层号从 0 起算。第 19、23 层占 6 个全注意力层的三分之一,占 24 个解码层的十二分之一。
|
||||||
|
|
||||||
|
| 方法 | 留出正确数 | 四选一答案 NLL ↓ |
|
||||||
|
| --- | ---: | ---: |
|
||||||
|
| 原模型 | 32/32 | 0.1341 |
|
||||||
|
| 双层直接共享 | 32/32 | 0.0728 |
|
||||||
|
| 双层线性修正 | 32/32 | 0.0720 |
|
||||||
|
| 双层 LiSA | 32/32 | 0.1846 |
|
||||||
|
| 双层 LiSA,答案损失加权 | 32/32 | 0.1260 |
|
||||||
|
|
||||||
|
直接共享在留出集上丢失 0 道原模型答对的题,因此无法估计 LiSA 对这类错题的恢复率。答案加权把 LiSA 的四选一 NLL 降低了 0.0586,仍高于直接共享。三种训练方法各用 12 道拟合题跑两轮,并由另外 12 道验证题选择检查点。所选检查点都是第 2 轮。逐题 logits、训练轨迹及检查点哈希随结果归档。
|
||||||
|
|
||||||
|
## CPU 计时和缓存
|
||||||
|
|
||||||
|
| 测量范围 | 原模型 | LiSA |
|
||||||
|
| --- | ---: | ---: |
|
||||||
|
| 缓存前缀后的尾部预填充,157 tokens | 12.37 s | 16.31 s |
|
||||||
|
| 第 19 层单步,流式读取权重 | 136.15 ms | 96.32 ms |
|
||||||
|
| 第 23 层单步,流式读取权重 | 136.39 ms | 138.80 ms |
|
||||||
|
| 第 19 层单步,投影权重常驻 | 42.57 ms | 32.09 ms |
|
||||||
|
| 第 23 层单步,投影权重常驻 | 44.80 ms | 22.79 ms |
|
||||||
|
|
||||||
|
每个接收层的 FP32 K/V 实际分配从 643,072 降到 371,776 字节,下降 42.2%。计入该层所用的 5,024 字节上游分数行后,单层合计下降 41.4%。V 缓存为 321,536 字节。解码计时的单位是单个接收层的一步,计时范围从接收现成分数行开始,至该层注意力输出结束。预填充用 3 次计时的中位数,单层解码每个配置用 9 步计时的中位数。
|
||||||
|
|
||||||
|
论文表 2 的 96.44% 衡量 LLaMA2-13B 在共享 22 层时多个基准上的平均性能保留率。这里每轮只有 1,874 个训练目标 token,测到的是单一查找任务的表现和 CPU 组件耗时。 [论文表 2、表 3 和附录 C.1](https://aclanthology.org/2026.tacl-1.30.pdf)
|
||||||
@@ -0,0 +1,141 @@
|
|||||||
|
{
|
||||||
|
"scope": "isolated full-attention recipient, FP32, frozen true activations; excludes donor generation and full-model decode",
|
||||||
|
"sites": {
|
||||||
|
"19": {
|
||||||
|
"seconds_per_token": {
|
||||||
|
"native": [
|
||||||
|
0.13286287058144808,
|
||||||
|
0.1361464262008667,
|
||||||
|
0.12924433965235949,
|
||||||
|
0.1288278056308627,
|
||||||
|
0.13502545654773712,
|
||||||
|
0.14447933342307806,
|
||||||
|
0.21267611254006624,
|
||||||
|
0.19696053490042686,
|
||||||
|
0.17250606417655945
|
||||||
|
],
|
||||||
|
"lisa": [
|
||||||
|
0.0882081063464284,
|
||||||
|
0.0963163236156106,
|
||||||
|
0.0912644388154149,
|
||||||
|
0.09147092420607805,
|
||||||
|
0.09272865019738674,
|
||||||
|
0.11763023491948843,
|
||||||
|
0.09996491950005293,
|
||||||
|
0.11747161205857992,
|
||||||
|
0.11429349146783352
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"resident_seconds_per_token": {
|
||||||
|
"native": [
|
||||||
|
0.03415969293564558,
|
||||||
|
0.030925235711038113,
|
||||||
|
0.03575391788035631,
|
||||||
|
0.04256666451692581,
|
||||||
|
0.04327994678169489,
|
||||||
|
0.0476421257480979,
|
||||||
|
0.04229569900780916,
|
||||||
|
0.04316695313900709,
|
||||||
|
0.04567800182849169
|
||||||
|
],
|
||||||
|
"lisa": [
|
||||||
|
0.041921489872038364,
|
||||||
|
0.04422656074166298,
|
||||||
|
0.03127973526716232,
|
||||||
|
0.03182042483240366,
|
||||||
|
0.03665950056165457,
|
||||||
|
0.03138743154704571,
|
||||||
|
0.028396621346473694,
|
||||||
|
0.037525477819144726,
|
||||||
|
0.03209121432155371
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"resident_median_s_per_token": {
|
||||||
|
"native": 0.04256666451692581,
|
||||||
|
"lisa": 0.03209121432155371
|
||||||
|
},
|
||||||
|
"resident_matches_streamed": true,
|
||||||
|
"allocated_bytes": {
|
||||||
|
"native": {
|
||||||
|
"k": 321536,
|
||||||
|
"v": 321536
|
||||||
|
},
|
||||||
|
"lisa": {
|
||||||
|
"k": 50240,
|
||||||
|
"v": 321536
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"lisa_input_score_row_bytes": 5024,
|
||||||
|
"sequence_length": 157
|
||||||
|
},
|
||||||
|
"23": {
|
||||||
|
"seconds_per_token": {
|
||||||
|
"native": [
|
||||||
|
0.1291032126173377,
|
||||||
|
0.12674292363226414,
|
||||||
|
0.1282597053796053,
|
||||||
|
0.13638535235077143,
|
||||||
|
0.1298640752211213,
|
||||||
|
0.1457589939236641,
|
||||||
|
0.20920543558895588,
|
||||||
|
0.20562185905873775,
|
||||||
|
0.19381640758365393
|
||||||
|
],
|
||||||
|
"lisa": [
|
||||||
|
0.14143545273691416,
|
||||||
|
0.08705597650259733,
|
||||||
|
0.08696427289396524,
|
||||||
|
0.1120216203853488,
|
||||||
|
0.1387955490499735,
|
||||||
|
0.13695972133427858,
|
||||||
|
0.14612034149467945,
|
||||||
|
0.1524249343201518,
|
||||||
|
0.1556852562353015
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"resident_seconds_per_token": {
|
||||||
|
"native": [
|
||||||
|
0.04479535948485136,
|
||||||
|
0.04507693089544773,
|
||||||
|
0.04067131970077753,
|
||||||
|
0.04552943166345358,
|
||||||
|
0.05950945522636175,
|
||||||
|
0.05104204546660185,
|
||||||
|
0.03087245672941208,
|
||||||
|
0.03152573574334383,
|
||||||
|
0.03583979792892933
|
||||||
|
],
|
||||||
|
"lisa": [
|
||||||
|
0.022208196111023426,
|
||||||
|
0.021793252788484097,
|
||||||
|
0.03165019955486059,
|
||||||
|
0.025800297036767006,
|
||||||
|
0.022528269328176975,
|
||||||
|
0.022276684641838074,
|
||||||
|
0.02320440299808979,
|
||||||
|
0.0227946899831295,
|
||||||
|
0.024175109341740608
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"resident_median_s_per_token": {
|
||||||
|
"native": 0.04479535948485136,
|
||||||
|
"lisa": 0.0227946899831295
|
||||||
|
},
|
||||||
|
"resident_matches_streamed": true,
|
||||||
|
"allocated_bytes": {
|
||||||
|
"native": {
|
||||||
|
"k": 321536,
|
||||||
|
"v": 321536
|
||||||
|
},
|
||||||
|
"lisa": {
|
||||||
|
"k": 50240,
|
||||||
|
"v": 321536
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"lisa_input_score_row_bytes": 5024,
|
||||||
|
"sequence_length": 157
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"streamed_timings_include_weight_reads": true,
|
||||||
|
"resident_timings_exclude_projection_load": true
|
||||||
|
}
|
||||||
@@ -0,0 +1,28 @@
|
|||||||
|
{
|
||||||
|
"scope": "cached-prefix last layers, prefill",
|
||||||
|
"seconds": {
|
||||||
|
"native": [
|
||||||
|
11.3411781527102,
|
||||||
|
12.700857263058424,
|
||||||
|
12.369724708609283
|
||||||
|
],
|
||||||
|
"direct": [
|
||||||
|
11.017615622840822,
|
||||||
|
10.737364768981934,
|
||||||
|
11.625513913109899
|
||||||
|
],
|
||||||
|
"lisa": [
|
||||||
|
15.469715679064393,
|
||||||
|
16.857490073889494,
|
||||||
|
16.311319678090513
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"real_tokens": 157,
|
||||||
|
"cache_estimate": {
|
||||||
|
"scope": "formula for one sequence, BF16 keys and score buffers",
|
||||||
|
"native_recipient_key_bytes": 321536,
|
||||||
|
"lisa_recipient_key_bytes": 50240,
|
||||||
|
"one_shared_decode_score_row_bytes": 2512,
|
||||||
|
"one_full_prefill_score_matrix_bytes": 394384
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -7,6 +7,35 @@
|
|||||||
"numpy": "2.5.4",
|
"numpy": "2.5.4",
|
||||||
"torch": "2.15.0+cpu",
|
"torch": "2.15.0+cpu",
|
||||||
"tokenizers": "0.23.3",
|
"tokenizers": "0.23.3",
|
||||||
|
"model_source": {
|
||||||
|
"repository": "Qwen/Qwen3.5-2B",
|
||||||
|
"revision": "15852e8c16360a2fea060d615a32b45270f8a8fc",
|
||||||
|
"manifest_sha256": "28efbaf94a5034333339a35f08ead151459a7d20c6c2d2f07a451e7f3bf154de",
|
||||||
|
"weight_shard": {
|
||||||
|
"name": "model.safetensors-00001-of-00001.safetensors",
|
||||||
|
"bytes": 4548221488,
|
||||||
|
"sha256_in_download_manifest": "aa33250c4fc64891ddfaba3a314fd9542ea371843c387178b425fbcc5ed680b1"
|
||||||
|
},
|
||||||
|
"decoder_layers": 24,
|
||||||
|
"linear_attention_layers": 18,
|
||||||
|
"full_attention_layers_zero_based": [3, 7, 11, 15, 19, 23],
|
||||||
|
"query_heads": 8,
|
||||||
|
"key_value_heads": 2,
|
||||||
|
"native_head_dimension": 256,
|
||||||
|
"hidden_size": 2048,
|
||||||
|
"vocabulary_size": 248320
|
||||||
|
},
|
||||||
|
"capture_sizes": {
|
||||||
|
"fit": {"prompts": 12, "input_tokens": 1886, "shifted_target_tokens": 1874, "min_input_tokens": 155, "median_input_tokens": 157.5, "max_input_tokens": 158},
|
||||||
|
"validation": {"prompts": 12, "input_tokens": 1882, "shifted_target_tokens": 1870, "min_input_tokens": 154, "median_input_tokens": 157.0, "max_input_tokens": 160},
|
||||||
|
"test": {"prompts": 32, "input_tokens": 5017, "shifted_target_tokens": 4985, "min_input_tokens": 153, "median_input_tokens": 157.0, "max_input_tokens": 159}
|
||||||
|
},
|
||||||
|
"validation_selected_checkpoints": {
|
||||||
|
"trace_sha256": "b432fba669d45c09634e96498a15f9d93f971d1ee2b67a826d6f8bc979525866",
|
||||||
|
"linear.pt": {"epoch": 2, "sha256": "cf204dc784a925de69faa8bed0789ef42877204edb9537d914486d39518fe8ce"},
|
||||||
|
"lisa.pt": {"epoch": 2, "sha256": "358272c5eb90cea9e3ed006b2c75a4bcd7f5db4f857982e078dd7f71c6c46c5b"},
|
||||||
|
"lisa_answer_weighted.pt": {"epoch": 2, "sha256": "2b384d5618c190b29bdbb1bc0151c1eb64e1699e209a50ed8171a2d"}
|
||||||
|
},
|
||||||
"main_code_sha256": {
|
"main_code_sha256": {
|
||||||
"lisa_effect.py": "8a3ecad71f23e3e8b8faf4a7c21c0c93f00fd0bffe14bdee6117921b548dce8a",
|
"lisa_effect.py": "8a3ecad71f23e3e8b8faf4a7c21c0c93f00fd0bffe14bdee6117921b548dce8a",
|
||||||
"lisa_tail.py": "4bd2c3c8690a8ae30cc1a9573ec17b7bbe25edf43a33507482719dc03cfeb9af",
|
"lisa_tail.py": "4bd2c3c8690a8ae30cc1a9573ec17b7bbe25edf43a33507482719dc03cfeb9af",
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,38 @@
|
|||||||
|
{
|
||||||
|
"linear": [
|
||||||
|
{
|
||||||
|
"epoch": 1,
|
||||||
|
"fit_loss": 1.528187096118927,
|
||||||
|
"validation_answer_nll": 0.08188676834106445
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"epoch": 2,
|
||||||
|
"fit_loss": 1.4630066951115925,
|
||||||
|
"validation_answer_nll": 0.08137226104736328
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"lisa": [
|
||||||
|
{
|
||||||
|
"epoch": 1,
|
||||||
|
"fit_loss": 2.8282371163368225,
|
||||||
|
"validation_answer_nll": 0.21536986033121744
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"epoch": 2,
|
||||||
|
"fit_loss": 2.06735689441363,
|
||||||
|
"validation_answer_nll": 0.18566656112670898
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"lisa_answer_weighted": [
|
||||||
|
{
|
||||||
|
"epoch": 1,
|
||||||
|
"fit_loss": 2.752801299095154,
|
||||||
|
"validation_answer_nll": 0.23118178049723306
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"epoch": 2,
|
||||||
|
"fit_loss": 1.9780630469322205,
|
||||||
|
"validation_answer_nll": 0.1396172841389974
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
{
|
||||||
|
"epochs": 2,
|
||||||
|
"selection": {
|
||||||
|
"task": "lookup16",
|
||||||
|
"sites": [
|
||||||
|
19,
|
||||||
|
23
|
||||||
|
],
|
||||||
|
"fixed_problems_sha256": "34252a9e02e79c0e0d786ee8b90bb0c5a4fe22e97852929fedf73db7b6dc7826",
|
||||||
|
"source_sha256": {
|
||||||
|
"manifest.json": "28efbaf94a5034333339a35f08ead151459a7d20c6c2d2f07a451e7f3bf154de",
|
||||||
|
"model_config.json": "ed1c1723241f23f7f4e23430759cbd7dcfb4103cbdfe052bfe7626b57c2615b4",
|
||||||
|
"tokenizer.json": "5f9e4d4901a92b997e463c1f46055088b6cca5ca61a6522d1b9f64c4bb81cb42"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"optimizer": "AdamW",
|
||||||
|
"lr": 0.0003,
|
||||||
|
"weight_decay": 0.1,
|
||||||
|
"answer_weight": 16.0,
|
||||||
|
"seed": 415005
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user