Skip to content

Dflash integration#36767

Open
StanislavII wants to merge 38 commits intovllm-project:mainfrom
StanislavII:dflash-changer
Open

Dflash integration#36767
StanislavII wants to merge 38 commits intovllm-project:mainfrom
StanislavII:dflash-changer

Conversation

@StanislavII
Copy link

@StanislavII StanislavII commented Mar 11, 2026

Purpose

DFlash integration in the speculative decoding pipeline related to the PRs #32206, #34014

This PR adds working DFlash support in the proposer path by handling DFlash-specific attention metadata and slot mapping correctly during the first drafting pass with supported batch size

Main changes:

  • add a DFlash branch in set_inputs_first_pass()
  • build DFlash query inputs as [next, mask, mask, ...]
  • preserve the original packed context slot mapping from CommonAttentionMetadata

This change restores correct DFlash behavior for both single-request and batched proposer execution.

Test Result

Verified with Sglang version of Qwen3-8B-DFlash-b16 in GSM8K dataset.

Throughput / acceptance comparison

T=0 Draft Tokens = 16, Max Tokens = 2048

Batch size Framework tokens/s Mean acceptance length
4 vLLM 1091 6.08
4 SGLang 1024 6.07
8 vLLM 1799 6.08
8 SGLang 1738 6.07
16 vLLM 2428 6.08
16 SGLang 2360 6.08
32 vLLM 2741 6.09
32 SGLang 2540 6.08

add dflash prepare inputs logic and dummy run logic

Signed-off-by: Stanislav <60266193+StanislavII@users.noreply.github.com>
original qwen3_dflash from PR

Signed-off-by: Stanislav <60266193+StanislavII@users.noreply.github.com>
Signed-off-by: Stanislav <60266193+StanislavII@users.noreply.github.com>
Signed-off-by: Stanislav <60266193+StanislavII@users.noreply.github.com>
return corresponding dflash layers 

Signed-off-by: Stanislav <60266193+StanislavII@users.noreply.github.com>
Signed-off-by: Stanislav <60266193+StanislavII@users.noreply.github.com>
Signed-off-by: Stanislav <60266193+StanislavII@users.noreply.github.com>
Signed-off-by: Stanislav <60266193+StanislavII@users.noreply.github.com>
Signed-off-by: Stanislav <60266193+StanislavII@users.noreply.github.com>
Signed-off-by: Stanislav <60266193+StanislavII@users.noreply.github.com>
Signed-off-by: Stanislav <60266193+StanislavII@users.noreply.github.com>
@github-actions
Copy link

👋 Hi! Thank you for contributing to the vLLM project.

💬 Join our developer Slack at https://slack.vllm.ai to discuss your PR in #pr-reviews, coordinate on features in #feat- channels, or join special interest groups in #sig- channels.

Just a reminder: PRs would not trigger full CI run by default. Instead, it would only run fastcheck CI which starts running only a small and essential subset of CI tests to quickly catch errors.

You ask your reviewers to trigger select CI tests on top of fastcheck CI.

Once the PR is approved and ready to go, your PR reviewer(s) can run CI to test the changes comprehensively before merging.

To run CI, PR reviewers can either: Add ready label to the PR or enable auto-merge.

If you have any questions, please reach out to us on Slack at https://slack.vllm.ai.

🚀

@mergify mergify bot added new-model Requests to new models qwen Related to Qwen models speculative-decoding labels Mar 11, 2026
@mergify
Copy link

mergify bot commented Mar 11, 2026

Hi @StanislavII, the pre-commit checks have failed. Please run:

uv pip install pre-commit
pre-commit install
pre-commit run --all-files

Then, commit the changes and push to your branch.

For future commits, pre-commit will run automatically on changed files before each commit.

Tip

Is mypy failing?
mypy is run differently in CI. If the failure is related to this check, please use the following command to run it locally:
# For mypy (substitute "3.10" with the failing version if needed)
pre-commit run --hook-stage manual mypy-3.10

Signed-off-by: Stanislav <60266193+StanislavII@users.noreply.github.com>
@mergify
Copy link

mergify bot commented Mar 11, 2026

Hi @StanislavII, the pre-commit checks have failed. Please run:

uv pip install pre-commit
pre-commit install
pre-commit run --all-files

Then, commit the changes and push to your branch.

For future commits, pre-commit will run automatically on changed files before each commit.

Tip

Is mypy failing?
mypy is run differently in CI. If the failure is related to this check, please use the following command to run it locally:
# For mypy (substitute "3.10" with the failing version if needed)
pre-commit run --hook-stage manual mypy-3.10

Signed-off-by: Stanislav <60266193+StanislavII@users.noreply.github.com>
@mergify
Copy link

mergify bot commented Mar 11, 2026

Hi @StanislavII, the pre-commit checks have failed. Please run:

uv pip install pre-commit
pre-commit install
pre-commit run --all-files

Then, commit the changes and push to your branch.

For future commits, pre-commit will run automatically on changed files before each commit.

Tip

Is mypy failing?
mypy is run differently in CI. If the failure is related to this check, please use the following command to run it locally:
# For mypy (substitute "3.10" with the failing version if needed)
pre-commit run --hook-stage manual mypy-3.10

@mergify
Copy link

mergify bot commented Mar 11, 2026

Hi @StanislavII, the pre-commit checks have failed. Please run:

uv pip install pre-commit
pre-commit install
pre-commit run --all-files

Then, commit the changes and push to your branch.

For future commits, pre-commit will run automatically on changed files before each commit.

Tip

Is mypy failing?
mypy is run differently in CI. If the failure is related to this check, please use the following command to run it locally:
# For mypy (substitute "3.10" with the failing version if needed)
pre-commit run --hook-stage manual mypy-3.10

@mergify
Copy link

mergify bot commented Mar 11, 2026

Hi @StanislavII, the pre-commit checks have failed. Please run:

uv pip install pre-commit
pre-commit install
pre-commit run --all-files

Then, commit the changes and push to your branch.

For future commits, pre-commit will run automatically on changed files before each commit.

Tip

Is mypy failing?
mypy is run differently in CI. If the failure is related to this check, please use the following command to run it locally:
# For mypy (substitute "3.10" with the failing version if needed)
pre-commit run --hook-stage manual mypy-3.10

@mergify
Copy link

mergify bot commented Mar 11, 2026

Hi @StanislavII, the pre-commit checks have failed. Please run:

uv pip install pre-commit
pre-commit install
pre-commit run --all-files

Then, commit the changes and push to your branch.

For future commits, pre-commit will run automatically on changed files before each commit.

Tip

Is mypy failing?
mypy is run differently in CI. If the failure is related to this check, please use the following command to run it locally:
# For mypy (substitute "3.10" with the failing version if needed)
pre-commit run --hook-stage manual mypy-3.10

Signed-off-by: Stanislav <60266193+StanislavII@users.noreply.github.com>
@mergify
Copy link

mergify bot commented Mar 11, 2026

Hi @StanislavII, the pre-commit checks have failed. Please run:

uv pip install pre-commit
pre-commit install
pre-commit run --all-files

Then, commit the changes and push to your branch.

For future commits, pre-commit will run automatically on changed files before each commit.

Tip

Is mypy failing?
mypy is run differently in CI. If the failure is related to this check, please use the following command to run it locally:
# For mypy (substitute "3.10" with the failing version if needed)
pre-commit run --hook-stage manual mypy-3.10

Signed-off-by: Stanislav <60266193+StanislavII@users.noreply.github.com>
@mergify
Copy link

mergify bot commented Mar 11, 2026

Hi @StanislavII, the pre-commit checks have failed. Please run:

uv pip install pre-commit
pre-commit install
pre-commit run --all-files

Then, commit the changes and push to your branch.

For future commits, pre-commit will run automatically on changed files before each commit.

Tip

Is mypy failing?
mypy is run differently in CI. If the failure is related to this check, please use the following command to run it locally:
# For mypy (substitute "3.10" with the failing version if needed)
pre-commit run --hook-stage manual mypy-3.10

Signed-off-by: Stanislav <60266193+StanislavII@users.noreply.github.com>
@StanislavII
Copy link
Author

@benchislett could you please take a look when you have a moment?

@mergify
Copy link

mergify bot commented Mar 11, 2026

This pull request has merge conflicts that must be resolved before it can be
merged. Please rebase the PR, @StanislavII.

https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/working-with-forks/syncing-a-fork

@mergify mergify bot added the needs-rebase label Mar 11, 2026
Signed-off-by: Stanislav <60266193+StanislavII@users.noreply.github.com>
@mergify mergify bot removed the needs-rebase label Mar 11, 2026
@mergify
Copy link

mergify bot commented Mar 11, 2026

Hi @StanislavII, the pre-commit checks have failed. Please run:

uv pip install pre-commit
pre-commit install
pre-commit run --all-files

Then, commit the changes and push to your branch.

For future commits, pre-commit will run automatically on changed files before each commit.

Tip

Is mypy failing?
mypy is run differently in CI. If the failure is related to this check, please use the following command to run it locally:
# For mypy (substitute "3.10" with the failing version if needed)
pre-commit run --hook-stage manual mypy-3.10

Signed-off-by: Stanislav <60266193+StanislavII@users.noreply.github.com>
@mergify
Copy link

mergify bot commented Mar 11, 2026

Hi @StanislavII, the pre-commit checks have failed. Please run:

uv pip install pre-commit
pre-commit install
pre-commit run --all-files

Then, commit the changes and push to your branch.

For future commits, pre-commit will run automatically on changed files before each commit.

Tip

Is mypy failing?
mypy is run differently in CI. If the failure is related to this check, please use the following command to run it locally:
# For mypy (substitute "3.10" with the failing version if needed)
pre-commit run --hook-stage manual mypy-3.10

Signed-off-by: Stanislav <60266193+StanislavII@users.noreply.github.com>
@benchislett
Copy link
Collaborator

Hi @StanislavII, thank you for the contribution. I've had a look through the PR and it seems reasonably well implemented.

I have been tinkering with DFlash and have opened a full-support PR today, here: #36847. I intend to solicit reviews and gather opinions based on that PR.

Please consider both PRs and give a cursory review of my work, if you are available. If you feel that your implementation has certain advantages and we should move forward with this branch, please let me know as I am open to this possibility. Otherwise, please close the PR or change to a draft, and if you can leave a detailed review of my PR.

Thanks again.

@mergify
Copy link

mergify bot commented Mar 13, 2026

This pull request has merge conflicts that must be resolved before it can be
merged. Please rebase the PR, @StanislavII.

https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/working-with-forks/syncing-a-fork

@mergify mergify bot added the needs-rebase label Mar 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs-rebase new-model Requests to new models qwen Related to Qwen models speculative-decoding v1

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants