Update logbook: Repro - KnapSpec: Self-Speculative Decoding via Adaptive Layer Selection as a Knapsack Problem
Browse files
logbook.json
CHANGED
|
@@ -11,7 +11,7 @@
|
|
| 11 |
"icml2026-repro",
|
| 12 |
"paper-k5nKHWp9VC"
|
| 13 |
],
|
| 14 |
-
"updated_at": "2026-07-16T15:
|
| 15 |
"root": {
|
| 16 |
"slug": "index",
|
| 17 |
"title": "Repro - KnapSpec: Self-Speculative Decoding via Adaptive Layer Selection as a Knapsack Problem",
|
|
@@ -55,6 +55,6 @@
|
|
| 55 |
}
|
| 56 |
]
|
| 57 |
},
|
| 58 |
-
"agent_view_tokens":
|
| 59 |
-
"revision": "
|
| 60 |
}
|
|
|
|
| 11 |
"icml2026-repro",
|
| 12 |
"paper-k5nKHWp9VC"
|
| 13 |
],
|
| 14 |
+
"updated_at": "2026-07-16T15:59:06+00:00",
|
| 15 |
"root": {
|
| 16 |
"slug": "index",
|
| 17 |
"title": "Repro - KnapSpec: Self-Speculative Decoding via Adaptive Layer Selection as a Knapsack Problem",
|
|
|
|
| 55 |
}
|
| 56 |
]
|
| 57 |
},
|
| 58 |
+
"agent_view_tokens": 7827,
|
| 59 |
+
"revision": "1784217546867069398"
|
| 60 |
}
|
pages/claim-3-tpt-and-two-stage-optimization/page.md
CHANGED
|
@@ -1659,3 +1659,55 @@ Loading weights: 100%|ββββββββββ| 146/146 [00:00<00:00, 374.
|
|
| 1659 |
{"type": "markdown", "id": "cell_4f7ec612d20f", "created_at": "2026-07-16T15:56:54+00:00", "title": "This benchmark separates algorithmic correctness from systems performance: DP-sβ¦"}
|
| 1660 |
-->
|
| 1661 |
This benchmark separates algorithmic correctness from systems performance: DP-selected masks preserve output and acceptance, but direct Python sublayer dispatch, per-round cache cloning, and non-fused verification dominate wall time. A real speedup now requires fused/compiled kernels or an inference runtime implementation, not further DP tuning alone.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1659 |
{"type": "markdown", "id": "cell_4f7ec612d20f", "created_at": "2026-07-16T15:56:54+00:00", "title": "This benchmark separates algorithmic correctness from systems performance: DP-sβ¦"}
|
| 1660 |
-->
|
| 1661 |
This benchmark separates algorithmic correctness from systems performance: DP-selected masks preserve output and acceptance, but direct Python sublayer dispatch, per-round cache cloning, and non-fused verification dominate wall time. A real speedup now requires fused/compiled kernels or an inference runtime implementation, not further DP tuning alone.
|
| 1662 |
+
|
| 1663 |
+
|
| 1664 |
+
---
|
| 1665 |
+
<!-- trackio-cell
|
| 1666 |
+
{"type": "code", "id": "cell_c73b29783712", "created_at": "2026-07-16T15:59:03+00:00", "title": "Run: uv focused_timing.py (exit 1)", "command": ["uv", "run", "python", "repro_knapspec/focused_timing.py"], "exit_code": 1, "duration_s": 21.075}
|
| 1667 |
+
-->
|
| 1668 |
+
````bash
|
| 1669 |
+
$ uv run python repro_knapspec/focused_timing.py
|
| 1670 |
+
````
|
| 1671 |
+
|
| 1672 |
+
exit 1 Β· 21.1s
|
| 1673 |
+
|
| 1674 |
+
|
| 1675 |
+
````python title=focused_timing.py
|
| 1676 |
+
#!/usr/bin/env/env -S uv run --script
|
| 1677 |
+
# /// script
|
| 1678 |
+
# dependencies = ["torch", "transformers==5.14.1", "huggingface-hub>=1.23"]
|
| 1679 |
+
# ///
|
| 1680 |
+
import statistics,torch
|
| 1681 |
+
from transformers import AutoTokenizer,AutoModelForCausalLM
|
| 1682 |
+
from ssd_benchmark import MODEL,install_switches,greedy,spec_decode
|
| 1683 |
+
text='The committee reviewed the proposal and requested a detailed analysis of the expected costs, benefits, risks, and implementation timeline.'
|
| 1684 |
+
tok=AutoTokenizer.from_pretrained(MODEL); m=AutoModelForCausalLM.from_pretrained(MODEL,dtype=torch.float16).cuda().eval(); sw=install_switches(m); seed=tok(text,return_tensors='pt').input_ids.cuda(); p=seed.repeat(1,(512+seed.shape[1]-1)//seed.shape[1])[:,:512]; mask={16,22}; greedy(m,p,64); spec_decode(m,sw,p,64,8,skip_mask=mask); bt=[];st=[]
|
| 1685 |
+
for _ in range(2):
|
| 1686 |
+
b,t=greedy(m,p,64); bt.append(64/t); _,s=spec_decode(m,sw,p,64,8,skip_mask=mask); st.append(64/s['elapsed_s']); print(s)
|
| 1687 |
+
print({'baseline_tps':statistics.median(bt),'spec_tps':statistics.median(st),'speedup':statistics.median(bt)/statistics.median(st)})
|
| 1688 |
+
|
| 1689 |
+
````
|
| 1690 |
+
|
| 1691 |
+
|
| 1692 |
+
````output
|
| 1693 |
+
|
| 1694 |
+
Loading weights: 0%| | 0/146 [00:00<?, ?it/s]
|
| 1695 |
+
Loading weights: 1%| | 1/146 [00:00<00:35, 4.09it/s]
|
| 1696 |
+
Loading weights: 47%|βββββ | 68/146 [00:00<00:00, 235.01it/s]
|
| 1697 |
+
Loading weights: 70%|βββββββ | 102/146 [00:00<00:00, 170.09it/s]
|
| 1698 |
+
Loading weights: 86%|βββββββββ | 126/146 [00:00<00:00, 150.04it/s]
|
| 1699 |
+
Loading weights: 100%|ββββββββββ| 146/146 [00:01<00:00, 138.56it/s]
|
| 1700 |
+
Loading weights: 100%|ββββββββββ| 146/146 [00:01<00:00, 143.29it/s]
|
| 1701 |
+
Traceback (most recent call last):
|
| 1702 |
+
File "/home/nick/workspace/icml26-hf-challenge-knapspec/repro_knapspec/focused_timing.py", line 9, in <module>
|
| 1703 |
+
tok=AutoTokenizer.from_pretrained(MODEL); m=AutoModelForCausalLM.from_pretrained(MODEL,dtype=torch.float16).cuda().eval(); sw=install_switches(m); seed=tok(text,return_tensors='pt').input_ids.cuda(); p=seed.repeat(1,(512+seed.shape[1]-1)//seed.shape[1])[:,:512]; mask={16,22}; greedy(m,p,64); spec_decode(m,sw,p,64,8,skip_mask=mask); bt=[];st=[]
|
| 1704 |
+
~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
| 1705 |
+
File "/home/nick/workspace/icml26-hf-challenge-knapspec/repro_knapspec/ssd_benchmark.py", line 109, in spec_decode
|
| 1706 |
+
past=clone_cache(target_past) if skip_mask is not None else None
|
| 1707 |
+
~~~~~~~~~~~^^^^^^^^^^^^^
|
| 1708 |
+
File "/home/nick/workspace/icml26-hf-challenge-knapspec/repro_knapspec/ssd_benchmark.py", line 68, in clone_cache
|
| 1709 |
+
return DynamicCache.from_legacy_cache(tuple((k.clone(),v.clone()) for k,v in legacy))
|
| 1710 |
+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
| 1711 |
+
AttributeError: type object 'DynamicCache' has no attribute 'from_legacy_cache'
|
| 1712 |
+
|
| 1713 |
+
````
|