sgl-project / sgl-project/SpecForge

[Bug] There is a gap between the acceptance rates of training and inference

Open
#533 3 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Checklist
  • 1. I have searched related issues but cannot get the expected help.
  • 2. The bug has not been fixed in the latest version.
  • 3. Please note that if the bug-related issue you submitted lacks corresponding environment info and a minimal reproducible demo, it will be challenging for us to reproduce and resolve the issue, reducing the likelihood of receiving feedback.
  • 4. If the issue you raised is not a bug but a question, please raise a discussion at https://github.com/sgl-project/SpecForge/discussions/new/choose Otherwise, it will be closed.
  • 5. Please use English, otherwise it will be closed.
Describe the bug

I trained a Dflash application using the latest training code for Qwen3.5-4B. The draft configuration for 4B is from the official documentation, while Qwen3.5-4B is a version I fine-tuned using internal data. The task was OCR. This training used 70,000 data points, achieving a 98% acceptance rate during training.

Image

I used a version of VLLM that supports Dflash for inference, but the average acceptance rate was only 10%. I've already aligned the chat-template, and I haven't used <think> during either training or inference.

Image

Are there any gaps I might be overlooking?

Reproduction
BUILD_DATASET_NUM_PROC=64
ATTENTION_BACKEND=${2:-flex_attention}
NUM_GPUS=4
# Use patched specforge (fixes circular import in original)
CUDA_VISIBLE_DEVICES=0,1,2,3 torchrun \
    --standalone \
    --nproc_per_node $NUM_GPUS \
    $ROOT_DIR/scripts/train_dflash.py \
    --target-model-path qwen3.5_4B\
    --draft-config-path Qwen3.5-4B-Dflash/config.json \
    --train-data-path data_filtered.jsonl\
    --output-dir deflash_outputs/qwen3.5-4b-dflash-opc \
    --num-epochs 10 \
    --batch-size 2 \
    --learning-rate 6e-4 \
    --warmup-ratio 0.04 \
    --max-grad-norm 1.0 \
    --max-length 4096 \
    --chat-template qwen3.5-nothink \
    --attention-backend $ATTENTION_BACKEND \
    --num-anchors 512 \
    --loss-decay-gamma 7.0 \
    --log-interval 50 \
    --save-interval 10000 \
    --target-model-backend hf \
    --block-size 16 \
Environment

specforge [latest]
vllm [0.19.1.rc.0] nightly

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 supplied Qwen3.5-4B-Dflash/config.json, then compare the training configuration and logged acceptance rate with the vLLM 0.19.1.rc.0 inference setup. Reproduce using the listed torchrun command, checking the chat template, attention backend, block size, and draft configuration. Done means identifying and documenting the cause of the training-versus-inference acceptance gap or confirming the missing reproduction detail.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, pytorch
Domain
backend, machine-learning
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Needs clarification
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.