Runtime Draft Weight Update for Speculative Decoding (#46725)

Signed-off-by: vx120 <893600387@qq.com>
Signed-off-by: vx120 <57470515+vx120@users.noreply.github.com>
Signed-off-by: aoshen02 <aoshen@inferact.ai>
Co-authored-by: crp0128 <191679376@qq.com>
Co-authored-by: aoshen02 <aoshen@inferact.ai>
Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
vx120
2026-07-11 22:51:53 -07:00
committed by GitHub
co-authored by crp0128 aoshen02 Claude Opus 4.8
parent 481e481be7
commit fc1c548093
12 changed files with 129 additions and 1 deletions
@@ -145,6 +145,7 @@ def test_openapi_stateless(case: schemathesis.Case):
if case.operation.path in (
"/init_weight_transfer_engine",
"/start_weight_update",
"/start_draft_weight_update",
"/update_weights",
"/finish_weight_update",
):
@@ -19,6 +19,7 @@ class _RecordingEngine:
self.raise_on_update = raise_on_update
self.started = False
self.finished = False
self.reset_count = 0
self.update_calls: list[dict] = []
def start_weight_update(self) -> None:
@@ -32,6 +33,9 @@ class _RecordingEngine:
def finish_weight_update(self) -> None:
self.finished = True
def reset_weight_update_target(self) -> None:
self.reset_count += 1
def _make_worker(engine: _RecordingEngine | None) -> Worker:
worker = object.__new__(Worker)
@@ -54,6 +58,7 @@ def test_start_update_finish_delegates_to_engine():
Worker.finish_weight_update(worker)
assert engine.finished is True
assert engine.reset_count == 1
assert worker._weight_update_active is False
@@ -85,6 +90,7 @@ def test_update_resets_active_on_error():
Worker.update_weights(worker, {"names": ["w"]})
# A failed update ends the session so the next start is clean.
assert engine.reset_count == 1
assert worker._weight_update_active is False