Repository navigation
feat(training): train several drafters from one capture stack - #1216
Draft
aaronlinear wants to merge 5 commits into
Draft
aaronlinear wants to merge 5 commits into
aaronlinear wants to merge 5 commits into
Conversation
A recipe can now list several drafters that train from one capture stack. `flatten_drafter` turns each one into a plain single-draft `Config`, so the trainer and checkpoint code keep seeing the old shape. It only merges, derives names from the drafter's name, or raises. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
A spec can now carry `outputs`, one per drafter, each with its own sample id, features and `layer_ids`. The sink cuts each output's layers from the captured ones and writes them all in the same batch put, so a prompt is still one target pass. The plugin advertises `spec_capture_outputs` in `/server_info`; a spec without `outputs` works as before. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
The producer now takes a list of drafters. Each prompt is one capture request, and the adapter returns one ref per drafter, all or nothing. The drive loop publishes each ref to its drafter's channel, pauses on the fullest channel, and drops a drafter once its trainer has stopped. Any failure fails every channel, and cleanup scans all of them. A single-draft run is a list of one and sends the same request as before. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
`specforge train` on a config with `drafters` now plans one producer and one trainer per drafter. Each trainer gets `--drafter <name>`, its own GPUs and `control_dir/<name>/logs/trainer.log`, and flattens the recipe itself, so it runs as a plain single-draft trainer. The capture servers get the sorted union of the drafters' layers, and `--plan` lists what each drafter resolved to. `--drafter` without a role runs that drafter alone. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
The new recipe trains DFlash and DSpark on Qwen3-8B from one capture server. The recipe tests now check each drafter as the single-draft run it flattens to, and the defaults fixture has one record per drafter. Both resolve to the same defaults as their single-draft recipes. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This branch has not been deployed
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.
Motivation
Training two drafters on the same target takes two capture stacks today, so the target forward runs twice for every prompt. With this PR one recipe can train several drafters from one capture stack: the target runs once per prompt and the plugin writes one sample per drafter.
Modifications
A recipe gets an optional
drafterslist. Each entry is a plain single-draft run;model,data,runtimeand the capture servers stay shared.draftersandflatten_drafter, which turns a drafter into a single-draftConfig(qwen3-dflash,output_dir/dflash,control_dir/dflash, shared store id). It only merges, derives names or raises, so the trainer, checkpoint and export code keep seeing the old shape.outputs, one per drafter, each with its own sample id, features andlayer_ids. The sink cuts each drafter's layers from the captured ones and writes everything in the same batch put. It advertisesspec_capture_outputsin/server_info, and the producer refuses a server without it.--drafter <name>, its own GPUs andcontrol_dir/<name>/logs/trainer.log. The capture servers get the sorted union of the drafters' layers, and--planlists what each drafter resolved to.disaggregated_training.md, the field reference inexamples/configs/README.md, and the recipemanaged-local/qwen3-8b-dflash-dspark-1server.yaml.Without
draftersnothing should change. A single-draft run is a list of one in the same code path, sends the same request bytes, and its--planoutput matchesmainfor all 80 checked-in recipes in three roles. Single-draft runs also keep working with the plugin that is installed today; only multi-drafter runs need the updated one.It is five commits, one per row above, and each passes its tests on its own.
Some limits I'm not sure are fine for a first version. EAGLE3 or P-EAGLE can't share a recipe with DFlash or DSpark family drafters yet:
modelis shared, andmodel.vocab_mapping_pathis required by one side and rejected by the other, so it raises at plan time. I think per-draftermodelkeys for the draft-side fields would fix it. A drafter that finishes early keeps its unread samples, at most one high watermark, in the store until the run ends.trainer.cuda_visible_devicesonly works withmanaged_local; with external servers the CLI warns that the trainers it starts share GPUs. Resume, NVLink andinbox_server_urlare rejected withdraftersfor now.Related Issues
None.
Accuracy Test
Not run yet, which is why this is a draft. The plan is to train DFlash and DSpark on Qwen3-8B from one capture server and compare each against its solo run (
--drafter <name>runs one drafter alone).On CPU (macOS) there are 27 new tests: a table of config conflicts, the plugin's layer cut, the real adapter against the real plugin sink over a fake Mooncake store, the pause and failure rules of the drive loop, and the launch plan.
tests/test_runtime,tests/test_config,tests/test_applicationandtests/test_algorithmspass, with the SGLang-dependent modules run in an SGLang env. I couldn't runtest_sglang_capture_plugin_integration.pybecause my local SGLang is not the pinned commit, so CI is its first run.Benchmark & Profiling
Not measured yet. The plugin writes more bytes per request on its single writer thread, so capture speed with
SGLANG_SPEC_CAPTURE_TIMING=1is the first thing I want to look at in the GPU run. Store memory roughly doubles with two drafters at the same watermark.Checklist
🤖 Generated with Claude Code