Skip to content

Recipe rocm-dflash-p-min-0.4: DFlash2 short answers +24%, prose +8%, code unchanged - #238

Merged
bong-water-water-bong merged 1 commit into
mainfrom
dflash-pmin
Sep 29, 2026
Merged

bong-water-water-bong merged 1 commit into
mainfrom
dflash-pmin

Conversation

@bong-water-water-bong

Copy link
Copy Markdown
Collaborator

This PR adds a recipe that sets the DFlash2 confidence cutoff (--spec-draft-p-min) to 0.4 on the lean ROCm route. Short answers get 24% faster, prose 8%, and code is unchanged.

Measurement

tools/bench.py, Qwen3.8-27B-H32 + DFlash2 Q8_0, 2 interleaved rounds. Decode medians in tok/s:

p-min code prose short
0 41.9 24.8 13.4
0.2 42.0 25.7 13.7
0.4 41.9 26.8 16.7
0.6 39.7 24.1 15.5

Changes

  • New recipe: rocm-dflash-p-min-0.4, listed before dflash-p-min-0. Recipes apply in file order and the first one to add a flag wins, so the new recipe wins on rocm. Other devices keep 0; this was measured on rocm only.
  • Tests: recipes_route covers both devices; hadamard_route expects 0.4.
  • Docs: docs/recipes.md notes that file order matters; docs/lean.md records the sweep.

🤖 Generated with Claude Code

…code unchanged

tools/bench.py p-min sweep, Qwen3.8-27B-H32 + DFlash2 Q8_0 on the lean ROCm
route, 2 rounds, decode median code / prose / short: p-min 0 41.9 / 24.8 /
13.4, 0.2 42.0 / 25.7 / 13.7, 0.4 41.9 / 26.8 / 16.7, 0.6 39.7 / 24.1 / 15.5.
The rocm recipe is listed before dflash-p-min-0 and wins there; other devices
keep 0 (not measured). recipes_route and hadamard_route cover both;
docs/recipes.md notes that recipes apply in file order.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@context7

context7 Bot commented Sep 29, 2026

Copy link
Copy Markdown

Docs7 for 1bit-monster/engine

Result Status Action
Deployment ➖ Not used —
Content review ➖ Did not run. This site has no agent runs available this month. Wait for the monthly reset or check your Docs7 plan. —

Commit eaee36c

@github-actions

Copy link
Copy Markdown

PR Reviewer Guide 🔍

Here are some key observations to aid the review process:

⏱️ Estimated effort to review: 3 🔵🔵🔵⚪⚪
🧪 PR contains tests
🔒 No security concerns identified
⚡ Recommended focus areas for review

Recipe Order Dependency

The new recipe rocm-dflash-p-min-0.4 must appear before dflash-p-min-0 in the recipes list to take effect on ROCm devices. This dependency on file order is fragile and could lead to incorrect behavior if the order is accidentally changed in the future. The documentation in docs/recipes.md already notes this behavior, but the implementation relies on the specific ordering which is not enforced by the code.

{
  "id": "rocm-dflash-p-min-0.4",
  "match": {"device": ["rocm"], "drafter": ["dflash"]},
  "args": ["--spec-draft-p-min", "0.4"],
  "why": "Stops a DFlash2 block at the first candidate the selector is less than 40% sure of: code keeps its full blocks, prose and short answers stop paying to verify guesses that fail. Listed before dflash-p-min-0, so it wins on rocm.",
  "measured": "Qwen3.8-27B-H32 + DFlash2 Q8_0 on the lean ROCm route, tools/bench.py 2 rounds, decode median code / prose / short: p-min 0 41.9 / 24.8 / 13.4, 0.2 42.0 / 25.7 / 13.7, 0.4 41.9 / 26.8 / 16.7, 0.6 39.7 / 24.1 / 15.5 tok/s.",
  "source": "engine #238"
},
Test Assertion Update

The test assertion in hadamard_route.sh has been updated to expect --spec-draft-p-min to be 0.4 instead of 0. This change correctly reflects the new behavior of the rocm-dflash-p-min-0.4 recipe, but it's important to ensure that this change is consistent with the intended behavior and that all related tests are updated accordingly.

check "  n-max 16 without a block size, p-min 0.4" '[ "$(after --spec-draft-n-max)" = 16 ] && [ "$(after --spec-draft-p-min)" = 0.4 ]'
Test Assertion Update

The test assertion in recipes_route.sh has been updated to expect --spec-draft-p-min to be 0.4 for ROCm devices when using --dflash, and 0 for Vulkan devices. This change correctly reflects the new behavior of the rocm-dflash-p-min-0.4 recipe and ensures that the recipe selection logic works as intended.

check "--dflash on rocm gets --spec-draft-p-min 0.4 from rocm-dflash-p-min-0.4" '[ "$(after "$scratch/df.json" --spec-draft-p-min)" = 0.4 ] && [ "$(count "$scratch/df.json" --spec-draft-p-min)" = 1 ]'

run "$scratch/plain.gguf" "$scratch/dfv.json" --dflash "$scratch/draft.gguf"
check "--dflash on vulkan gets --spec-draft-p-min 0 from dflash-p-min-0" '[ "$(after "$scratch/dfv.json" --spec-draft-p-min)" = 0 ]'

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant