Skip to content

support dflash2 - #772

Open
jiapingW wants to merge 1 commit into
mainfrom
dflash2
Open

support dflash2#772
jiapingW wants to merge 1 commit into
mainfrom
dflash2

Conversation

@jiapingW

Copy link
Copy Markdown
Collaborator

Motivation

Add end-to-end support for training DFlash 2 draft models in SpecForge.

DFlash 2 reuses the existing DFlash capture and training pipeline while extending the draft architecture with grouped dynamic convolutions and candidate-path selection. This PR
also ensures that exported checkpoints follow the public SGLang DFlash 2 parameter and configuration contract.

  • Add and register DFlash2DraftModel as a DFlash-compatible architecture.
  • Add grouped dynamic depthwise convolutions around each attention and MLP sublayer.
  • Add a low-rank candidate selector for reranking top-k token candidates using predecessor-token transitions.
  • Support DFlash 2 unary-logit transformations, including output_multiplier and final_logit_softcapping.
  • Extend the DFlash objective with a configurable selector loss:
    • add training.dflash2_selector_loss_alpha;
    • insert the gold token during training when it is missing from the top-k candidates;
    • report selector loss, accuracy, and original top-k coverage.
  • Persist DFlash 2 architecture and selector settings in the resume contract.
  • Allow the DFlash provider and draft registry to load both DFlashDraftModel and DFlash2DraftModel.
  • Support block_size from either the top-level draft config or dflash_config, with conflict validation during export.
  • Preserve the DFlash2DraftModel architecture during Hugging Face export and validate all required DFlash 2 fields.
  • Add a Qwen3.6-27B DFlash 2 draft config and a managed two-GPU disaggregated training recipe.
  • Document DFlash 2 training, configuration, export, and serving behavior.
  • Add unit tests covering:
    • model registration and construction;
    • grouped-convolution behavior and gradients;
    • candidate scoring and lattice construction;
    • selector supervision and gradient propagation;
    • resume metadata;
    • export normalization and validation;
    • configuration schema and example topology.

Modifications

Related Issues

Accuracy Test

Benchmark & Profiling

{
  "passed": true,
  "input_format": "training_jsonl",
  "spec_accept_length": 8.0,
  "target_prefix_match_tokens": 24,
  "generated_tokens": 24,
  "target_tokens": 3785,
  "clean_block_tokens": 8,
  "errors": [],
  "result_path": "/disk3/wjp/projects/codex-run/SpecForge/outputs/Qwen3.6-27B-Dflash-overfit/serving-gate.json"
}

Checklist

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant