Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
53 commits
Select commit Hold shift + click to select a range
139be2f
docs(flux3): FLUX 3 Image Klein audit and catalog design
dkackman Oct 16, 2026
67ab2a0
docs(flux3): Klein catalog implementation plan
dkackman Oct 16, 2026
86459df
feat(text_generation): chat_template_kwargs, revision and a list of i…
dkackman Oct 16, 2026
a213781
feat(text_generation): system_prompt from a Hub repo file at a pinned…
dkackman Oct 16, 2026
4c6adb3
fix(text_generation): refuse structural keys and non-scalars in chat_…
dkackman Oct 16, 2026
643227f
fix(text_generation): from_hub validates repo/file/key, public files …
dkackman Oct 16, 2026
66314b6
feat(flux3): Klein prompt-upsampler builtins on the pinned pup
dkackman Oct 16, 2026
c7ca24b
fix(text_generation): from_hub fails closed unless the Hub serves the…
dkackman Oct 16, 2026
68adce1
feat(flux3): Klein text-to-image template and model entry
dkackman Oct 16, 2026
c4d0fad
feat(flux3): upsample-then-generate template
dkackman Oct 16, 2026
d377e72
feat(flux3): image-edit and multi-reference templates
dkackman Oct 16, 2026
8a62a7e
feat(flux3): layout-with-boxes template
dkackman Oct 16, 2026
803203c
docs(flux3): Klein templates README
dkackman Oct 16, 2026
c3690b4
feat(plugin): flux3-klein composition skill
dkackman Oct 16, 2026
81069fc
fix(plugin): flux3-klein skill's reference-detail failure mode
dkackman Oct 16, 2026
f77e09c
fix(text_generation): gate and filter generate_kwargs; fail closed on…
dkackman Oct 16, 2026
e6baee5
fix(flux3): state the 4096 side as unchecked, the edit upsampler's im…
dkackman Oct 16, 2026
181554d
docs: the generate_kwargs gate, the from_hub fetch, and what the spec…
dkackman Oct 16, 2026
cd5e60f
chore: open 0.15.0-alpha.1 on develop
dkackman Oct 16, 2026
b9b997f
test(catalog): raise compact listing budget 10_850 -> 11_400 for FLUX…
dkackman Oct 16, 2026
ad23a85
test(text_generation): patch hf_pipeline and hub download once via fi…
dkackman Oct 16, 2026
f4f49e6
Merge pull request #930 from dkackman/feat/flux3-klein
dkackman Oct 16, 2026
2554436
chore: lower test_dw_patch_targets 327 -> 309; plan the post-#930 fol…
dkackman Oct 16, 2026
f3e945d
docs: #931 - H3 sparse attention (comfy-kitchen Sol-Attn) design
dkackman Oct 17, 2026
a99952f
docs: #931 - H3 sparse attention implementation plan, with the protot…
dkackman Oct 17, 2026
93d5043
build: comfy-kitchen dependency for H3 sparse attention (#931)
dkackman Oct 17, 2026
8daf05e
feat(attention): H3 sparse tile map (#931)
dkackman Oct 17, 2026
8005459
feat(attention): sparse H3 processor, install, per-call decision (#931)
dkackman Oct 17, 2026
0f2712a
fix(attention): exact layout match, decision-time errors fall back (#…
dkackman Oct 17, 2026
caac23f
feat(attention): 'sparse' attention_backend at component and pipeline…
dkackman Oct 17, 2026
3973c07
feat(validate): sparse_attention_fallback warning (#931)
dkackman Oct 17, 2026
f81a713
feat(server): health reports available attention backends (#931)
dkackman Oct 17, 2026
6bebccd
feat(ui): attention backend dropdowns from the server's list (#931)
dkackman Oct 17, 2026
28eb0d7
fix(ui): define-mode default (none) writes null for the attention bac…
dkackman Oct 17, 2026
4be316a
feat(templates): H3 defaults to sparse attention, tau 0.5 (#931)
dkackman Oct 17, 2026
01ab845
fix(sparse): kernel-failure fallback, tau validation, safe components…
dkackman Oct 17, 2026
f3a60e8
build: cap comfy-kitchen below 0.3 (#931)
dkackman Oct 17, 2026
e132349
docs: sparse attention in the guide, acceleration notes and seam map …
dkackman Oct 17, 2026
2d1ea00
Merge feat/931-sparse-attention (#931 H3 sparse attention, Tasks 1-8)
dkackman Oct 17, 2026
5d01904
docs: #931 - sparse against sage_hub, not only native; the default's …
dkackman Oct 17, 2026
95a875d
docs(plugin): #931 stage 3 - cinema ramp gains a sparse pair (B3s -> …
dkackman Oct 17, 2026
2aab86f
docs: #931 stage 3 - TV ramp moves to sparse; sparse vs sage_hub tabl…
dkackman Oct 18, 2026
9ea9b0f
fix(attention): #931 - a component's backend pin beats pipeline-level…
dkackman Oct 18, 2026
3a070f4
feat(attention): #932 - sparse_topk, sol_attn's top-k routing beside …
dkackman Oct 18, 2026
180a976
fix(attention): #932 - the component backend log names sparse's routi…
dkackman Oct 18, 2026
bb80ff8
fix(tests): ensure kernel probe counts imports accurately in test_ker…
dkackman Oct 18, 2026
5b2c088
feat(templates): #932 - H3 sparse defaults to top-k 0.15 routing
dkackman Oct 18, 2026
03a3b1f
fix(speech_generation): gate forward_params and generate_kwargs on trust
dkackman Oct 18, 2026
0c4ed5e
refactor: clear #931's architecture-ratchet regressions
dkackman Oct 18, 2026
512d938
docs(release): 0.15.0 notes - H3 sparse attention, FLUX 3 Klein, the …
dkackman Oct 18, 2026
298293e
chore(ratchet): modules 219 -> 220 for dw/sparse_attention.py (#931)
dkackman Oct 18, 2026
1f261f0
docs(mcp): #933 - list_assets/list_workspaces descriptions name the n…
dkackman Oct 18, 2026
5d52d85
fix(sparse): a pin on a non-H3 component is no conflict; 0.15.0 revie…
dkackman Oct 18, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,8 @@ The guides in `docs/`, by topic:

`.claude-plugin/marketplace.json` publishes the `dw` plugin in `plugins/dw/`: one
composition skill per model family (`minimax-h3`, `minimax-music3`, `ltx-2.5`,
`kandinsky-6`) that chooses a template for a request's shape and states the family's
hard rules, plus
`kandinsky-6`, `flux3-klein`) that chooses a template for a request's shape and
states the family's hard rules, plus
cross-cutting composition skills (`script-to-video`, `series-episodes`) - shapes above
the families that orchestrate the decision trees and cast consistency across multiple
generations. Every skill the directory holds is named in `plugins/dw/README.md` and here,
Expand Down
48 changes: 43 additions & 5 deletions docs/ACCELERATION.md
Original file line number Diff line number Diff line change
Expand Up @@ -159,20 +159,58 @@ Select the attention implementation diffusers uses for the duration of each pipe
}
```

Common values: `"flash"`, `"flash_hub"`, `"sage"`, `"sage_hub"`, `"native"`, `"flex"`. The full set is diffusers' `AttentionBackendName` enum - availability depends on what's installed (`flash-attn`, `sageattention`, etc.) and the platform. `_hub`-suffixed backends are fetched from the Hugging Face Hub kernel registry on first use, which needs the `kernels` package installed (`pip install kernels`) - it is not a dw dependency, and no bundled workflow sets a backend, so each runs on a plain install. diffusers also refuses a Hub kernel whose publisher it does not list as trusted - `sage_hub` among them, since SageAttention 2 comes from `SageAttention/sage-attention` - until `DIFFUSERS_TRUST_REMOTE_KERNELS=true`, which allows remote code from any such publisher. On an RTX 3090 `sage_hub` measured about 30% faster per MiniMax-H3 step (13.8 s against 19.2 s at 960x544x124, 54.7 s against 81.2 s at 345 frames); the local `sage` backend needs `sageattention>=2.1.1`, which PyPI does not carry.
Common values: `"flash"`, `"flash_hub"`, `"sage"`, `"sage_hub"`, `"native"`, `"flex"`. The full set is diffusers' `AttentionBackendName` enum - availability depends on what's installed (`flash-attn`, `sageattention`, etc.) and the platform. `_hub`-suffixed backends are fetched from the Hugging Face Hub kernel registry on first use, which needs the `kernels` package installed (`pip install kernels`) - it is not a dw dependency. The only backend a bundled workflow sets is `sparse`, the default on every MiniMax-H3 template, and it needs no `kernels` install (comfy-kitchen is a core dependency), so each bundled workflow runs on a plain install. diffusers also refuses a Hub kernel whose publisher it does not list as trusted - `sage_hub` among them, since SageAttention 2 comes from `SageAttention/sage-attention` - until `DIFFUSERS_TRUST_REMOTE_KERNELS=true`, which allows remote code from any such publisher. On an RTX 3090 `sage_hub` measured about 30% faster per MiniMax-H3 step (13.8 s against 19.2 s at 960x544x124, 54.7 s against 81.2 s at 345 frames); the local `sage` backend needs `sageattention>=2.1.1`, which PyPI does not carry.

Every MiniMax-H3 template in [templates/minimax/](../workflows/templates/minimax/)
exposes this as a variable: `attention_backend`, pinned on the H3 step's transformer
(`components.transformer`, or `components.transformer_ref` for a ref2va workflow) and
`null` by default. That covers the shots, chains and episodes - `dialogue-short`,
`"sparse"` by default (with `sparse_tau`, below). That covers the shots, chains and episodes - `dialogue-short`,
`shots-batch`, `music-video` and `storyboard` among them - and only their H3 steps: a
Z-Image still or Music3 song beside an H3 shot keeps the process default. Pass
`attention_backend=sage_hub` to a box with the `kernels` package and
`DIFFUSERS_TRUST_REMOTE_KERNELS=true` in its `.env`; on MPS leave it null, since a
CUDA-only kernel fails there at load (validation warns, below). LTX-2.5 cannot use it: its transformer
`attention_backend=sage_hub` (or `native`) to override the default; `sage_hub` needs a box with the `kernels` package and
`DIFFUSERS_TRUST_REMOTE_KERNELS=true` in its `.env`; on MPS the default falls back to dense, but a CUDA-only kernel such as `sage_hub` fails there at load (validation warns, below). LTX-2.5 cannot use it: its transformer
passes an attention mask, and sage attention refuses one ("`attn_mask` is not supported
for sage attention", measured 2026-10-10), so the LTX templates expose no backend.

### `sparse` (MiniMax-H3)

`attention_backend: "sparse"` runs H3's attention through comfy-kitchen's block-sparse kernel: each query tile attends only to the key tiles that matter, so the cost of the long video-token sequence falls. It applies to the H3 transformer only, at pipeline or component level, and is the default on every H3 template (#931). Set at both levels, the component's own `attention_backend` wins, as it does for every backend: a pipeline-level `sparse` skips a component pinned to `sage_hub` (or anything else) and warns `attention_backend 'sparse' at pipeline level skips '<component>', which pins '<backend>'`. When it does install, the run logs `Using attention backend: sparse (tau <tau>) on <components>`, or `(topk <k>)` with top-k routing. `sparse_tau` (number, minimum 0, default 0.5; anything else, such as a `variable:` that resolves to a string or a bool, fails the step rather than running dense) sets how much of the attention mass a tile may drop; 0 keeps the most. Observed at Ref2VA 1344x768, seed 42: tau 1.0 ran 42.1 s/forward against 44.8 s at 0.5, and by Don's eye 1.0 gave smoother skin while 0.5 matched dense (the table below). That is one shape and one seed, not a rule that higher is always faster or smoother.

`sparse_topk` (a number strictly between 0 and 1; the H3 templates set 0.15, and a workflow that sets none routes by `sparse_tau`) switches the kernel to top-k routing: each query tile keeps that fraction of key tiles and drops the rest outright, with `sparse_tau` ignored. It is the selection lightx2v's Turbo-SLA LoRAs were trained against (85% sparsity, so `0.15`). Measured on `video-with-audio-768p`, seed 42 (#932): top-k 0.15 ran 21.1 s/forward against 23.6 s at tau 0.5, about 11% faster, and Don saw no difference on that clip, with either the Turbo-SLA LoRA or the default v1.2 turbo (so dw does not adopt the SLA LoRA). That clip has no faces, so it was checked on the H3 quality ramp's 4-reference sitcom shot at seeds 42, 7 and 1234 against tau 0.5. Don judged top-k equal or better: on the turbo L7 rung tau showed blue ghosting at seed 7 and slight smearing at all three, and on the 30-step base-model L5 rung the skin held. Top-k 0.15 is therefore the H3 templates' default; pass `sparse_topk=null` to route by `sparse_tau` instead.

| rung (minutes per job, seeds 42 / 7 / 1234) | tau 0.5 | top-k 0.15 |
|---|---|---|
| L7: ref2v 4-step turbo, int8 | 6.5 / 6.5 / 6.5 | 6.1 / 6.2 / 5.8 |
| L5: base model, int8, 30 steps | 26.8 / 26.6 / 26.4 | 23.9 / 25.5 / 23.9 |

**What the default buys depends on what it replaces.** Against `native` attention, which is what an H3 template ran before #931 unless `attention_backend` was set, sparse is 2.2-4.4x faster per step. Against `sage_hub`, the gain is much smaller: 6-16% depending on the shape (the second table). So sparse's main win is for a run that set no backend, and it needs no `kernels` package or `DIFFUSERS_TRUST_REMOTE_KERNELS`. A box already on `sage_hub` gains a little, at equal quality: on the H3 skill's quality-ramp rungs, Don judged faces, skin and draft-to-final staging equal under both backends across three seeds (#931 stage 3).

Measured on an RTX 3090, seed 42, s per transformer forward (one per denoise step), lower is faster:

| shape | native | `sage_hub` | sparse | sparse vs native | sparse vs `sage_hub` |
|---|---|---|---|---|---|
| T2VA 960x544, 4-step turbo, tau 1.0 | 24.3 | - | 10.8 | 2.25x | - |
| T2VA 1344x768, 4-step turbo, tau 1.0 | 96.1 | - | 21.9 | 4.38x | - |
| Ref2VA 1344x768, 8-step ref2v turbo, tau 1.0 | 108.4 | - | 42.1 | 2.58x | - |
| Ref2VA 1344x768, 8-step ref2v turbo, tau 0.5 (the default) | 108.4 | 51.0 | 44.1-44.8 | 2.42x | 1.16x |

Wall time, same order: 150 -> 95 s, 457 -> 158 s, 965 -> 430 s, and for the last row 965 s native, 489 s `sage_hub`, 442-450 s sparse.

Against `sage_hub` on the H3 skill's quality-ramp rungs (ep 6 cold open, 4 references, 1344x768, 124 frames; minutes per job, seeds 42 / 7 / 1234, all on the same diffusers):

| rung | `sage_hub` | sparse | sparse vs `sage_hub` |
|---|---|---|---|
| L1: ref2v 4-step turbo, int4, 5 steps | 5.5 / 5.5 / 5.5 | 5.2 / 5.2 / 5.1 | 1.06-1.08x |
| L7: ref2v 4-step turbo, int8, 5 steps | 7.1 / 6.9 / 7.1 | 6.5 / 6.5 / 6.5 | 1.06-1.09x |
| B3: base model, int8, 12 steps | 13.0 / 12.9 / 12.9 | 12.3 / 12.0 / 12.1 | 1.06-1.07x |
| L5: base model, int8, 30 steps | 29.7 / 29.7 / 29.7 | 26.8 / 26.6 / 26.4 | 1.11-1.12x |

The `first_block` cache on `sage_hub` (23.1 min at L5's settings) is still faster than sparse alone there; sparse with that cache is not measured. The native and tau 1.0 figures come from the #931 prototype. The `sage_hub` figure and the 44.1 s come from the engine on lem after the deploy, with a newer diffusers (jobs 94c04976d21d and 593131ca713f), so the sage comparison is between those two jobs only. The T2VA rows have no `sage_hub` run. Peak VRAM did not change. Judged by eye, tau 0.5 matched dense; tau 1.0 was smoother in skin.

It needs CUDA with compute capability 8.0 or higher. Anywhere else (MPS, CPU, an older card, an unsupported dtype or head size) the run goes dense instead of failing, and says so twice: `validate_workflow` warns `sparse_attention_fallback` when the server's device is not CUDA, and the run reports `<label>: sparse attention ran dense - <reason>` once per pipeline call. A job of one call warns once; a chained, `shots-batch` or `dialogue-short` job calls the pipeline once per segment or shot, so it warns once for each, under that segment's or shot's label. A comfy-kitchen kernel that fails on its first invocation in a call also runs that call dense, with `sparse kernel failed: <error>` as the reason; one that fails after it has run in the call fails the run, since some blocks have already run sparse.

Unlike sage, sparse **moves composition** relative to dense: the same subject, story and cuts, but different framing and set dressing. A draft and its final must therefore use the same backend; mixing `sparse` and `sage_hub` between tiers means the draft no longer predicts the final.

A component can also pin its backend persistently instead, via `set_attention_backend`:

```json
Expand Down
Loading
Loading