sgl-project / sgl-project/SpecForge

[Feature] Support image-text multimodal input for DFlash training, similar to Eagle3

Open
#583 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
1.2k
Forks
347
Avg merge
4d 1h
Merged PRs (30d)
41

Description

Checklist
Motivation
Checklist
Motivation

Currently, the DFlash training pipeline in scripts/train_dflash.py is designed for text-only data. However, many real-world speculative decoding scenarios involve multimodal content (e.g., image + text). Eagle3 has demonstrated support for multimodal inputs, and it would be valuable for SpecForge's DFlash implementation to support image-text inputs as well.

Specifically, we would like to train DFlash draft models for vision-language models such as Qwen3.5/Qwen3.6, where the target model processes both images and text, and the draft model accelerates token generation by predicting future text tokens conditioned on the multimodal context.

Related resources
  • Eagle3 (supports multimodal speculative decoding): https://github.com/NVlabs/Eagle
  • Qwen3.5 model family (potential target models)
  • Existing flexible embedding key in SpecForge: --embedding-key (e.g., model.language_model.embed_tokens.weight)
Proposed scope
  1. Data pipeline: Support loading image-text paired data in build_eagle3_dataset or a dedicated DFlash multimodal dataset builder.
  2. Model inputs: Allow the target model to accept pixel values / image embeddings alongside input_ids and attention_mask.
  3. Hidden-state capture: Correctly capture hidden states from the target multimodal language model at the specified target_layer_ids, taking into account vision-language fusion.
  4. Draft model alignment: Ensure the DFlash draft model can consume the multimodal context and produce block-level draft predictions.
  5. Example script & config: Provide an example training script and a reference config for a multimodal DFlash draft model.
Related resources

No response

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with scripts/train_dflash.py and the existing build_eagle3_dataset path, then inspect how --embedding-key and target_layer_ids are used. Compare the proposed image-text flow with Eagle3's multimodal support and determine the required target-model inputs, hidden-state capture, and draft-model handling. Done means an example script and reference config can train a DFlash draft model from image-text data.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, pytorch
Domain
machine-learning
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.