Repository navigation
fix(server): enable concurrent Tinker and Twinkle sampling - #303
Merged
Yunnglin merged 5 commits intoOct 14, 2026
Merged
Conversation
Yunnglin
marked this pull request as draft
October 13, 2026 00:39
Yunnglin
force-pushed
the
fix/297-concurrent-tinker-sample
branch
from
October 13, 2026 13:11
858be8c to
c84e633
Compare
There was a problem hiding this comment.
🟡 Changes recommended
A cancellation race can execute an already-cancelled task, and an E2E actor lookup uses the obsolete class name.
2 open findings
What changed in this PR
Enables concurrent Tinker and Twinkle sampling while coordinating sampler mutations and checkpoint loads.
Changes:
- Adds concurrent compute admission, lifecycle tracking, and sampler read/write coordination.
- Adds token-only sampling, safer checkpoint loading, and server-specific vLLM concurrency.
- Expands unit and E2E concurrency, timeout, cancellation, and recovery coverage.
| File | Description |
|---|---|
tests/twinkle_agentic/test_vllm_sampler_tq_generation.py |
Updates generation timeout tests. |
tests/server/utils/test_task_queue_mixin.py |
Tests concurrent task lifecycle and capacity. |
tests/server/sampler/test_twinkle_async_rows.py |
Adapts DataPlane tests to concurrent submission. |
tests/server/sampler/test_tinker_handlers.py |
Tests token-only concurrent Tinker sampling. |
tests/server/sampler/test_stream_guarantees.py |
Moves timeout enforcement to the caller. |
tests/server/sampler/test_sampling_concurrency.py |
Covers locking, isolation, timeout, and recovery. |
tests/server/sampler/test_resolve_sampler_weights.py |
Updates checkpoint validation coverage. |
tests/server/sampler/test_mock_sampler.py |
Verifies server-specific actor concurrency. |
tests/server/integration/test_sampler_concurrency_e2e.py |
Adds real concurrent sampling E2E coverage. |
tests/sampler/test_vllm_sampling.py |
Tests token-only sampling and checkpoint safety. |
src/twinkle/server/task_queue/worker.py |
Adds detached concurrent compute execution. |
src/twinkle/server/task_queue/types.py |
Centralizes backend timeout exceptions. |
src/twinkle/server/task_queue/mixin.py |
Exposes concurrent scheduling APIs. |
src/twinkle/server/task_queue/config.py |
Adds concurrent-task capacity configuration. |
src/twinkle/server/sampler/weights.py |
Coordinates checkpoint loading and generation. |
src/twinkle/server/sampler/twinkle_handlers.py |
Routes Twinkle sampling concurrently. |
src/twinkle/server/sampler/tinker_handlers.py |
Routes Tinker sampling concurrently. |
src/twinkle/server/sampler/concurrency.py |
Implements sampler reader/writer coordination. |
src/twinkle/server/sampler/backends/vllm_async.py |
Adds the server-specific concurrent sampler. |
src/twinkle/server/sampler/app.py |
Initializes concurrency and template state. |
src/twinkle/sampler/vllm_sampler/vllm_sampler.py |
Adds token-only mode and safer batch cleanup. |
src/twinkle/exceptions.py |
Defines partial weight-load failure signaling. |
src/twinkle_agentic/async_rl/vllm_sampler_tq.py |
Reuses sibling-cleanup gathering. |
🧠 Review effort: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
tastelikefeet
approved these changes
Oct 14, 2026
A client cancel can win the race against the running status write. The terminal record is kept, but the task still started and held detached capacity. Re-read the record after the write and return before starting work. Also default the E2E sampler actor lookup to ServerVLLMSampler.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Summary
Fixes #297: ordinary Tinker and Twinkle sampling requests reach vLLM concurrently instead of waiting in the serial training compute queue.
Scope
Based on main
ec8fd1f0. Streaming lifecycle cleanup and LoRA-enabled full-weight reload compatibility remain local and unpushed. The stream engine, full-weight worker extension and streaming bridge match main. Same-checkpoint shared generation remains a separate optimization.No documentation changes. Coverage is grouped into queue, sampler behavior, HTTP route and real E2E tests. The latest cleanup reduces the PR from 31 to 23 files and removes one obsolete access-context test plus one duplicate pre-start shutdown test; all other moved assertions and parameterization are preserved. This cleanup does not change runtime source.
concurrent_task_limit=128bounds admitted unfinished requests, not simultaneous engine execution, which also depends on executor, actor and vLLM configuration. Training remains serial.Validation
Current head:
addab02051e8cf55faa849e2a86145cfb2892e7e.e39acd6266e7ba5c958784471d502e824204710f, which has 22 real PPU E2E passes across both SDKs, 1/8/32 concurrency, mapping, mixed clients, LoRA isolation, full-checkpoint isolation, invalid checkpoint recovery, timeout ownership and DataPlane. A separate real Serve replacement/recovery test passed. Actor SHA/source hashes and zero generation/job counters were verified; owned services and ports were cleaned.citestand lint passed.citest-npuremains queued; its result is still unverified.Benchmark
Qwen3-1.7B, 128 tokens/request, PPU ZW810, DP=2 / TP=1, vLLM 0.20.1+PPU:
The issue's single RTX 4090 measurements (24/27/26 tok/s, vLLM 0.20.2) use a different environment. Absolute throughput is not directly comparable; these workload-specific results show scaling with concurrent requests.