Patch Flash Attention DN (SGLang)
Flash Attention for a model that isn't in your process
- model
- MODEL
0xDELUXA's Patch Flash Attention DN is a well-known speedup node: it swaps the attention in whatever model flows through it for a Flash Attention implementation. It works by patching attention callbacks in the ComfyUI process. Which, with this pack, is exactly the problem - your H3 model doesn't live in the ComfyUI process. It lives in SGLang workers, and a host-side callback never reaches it.
Patch Flash Attention DN (SGLang) is the worker-native replacement. Same MODEL in / MODEL out contract as the upstream node, same intent, but instead of shipping a patch callback across the process boundary, it tells the SGLang runtime to use its own Flash Attention backend inside the workers.
The input
It's about as simple as this pack gets. One required input:
model- an H3 SGLang model (from the pack's loader; anything else throws the usualTypeError).enabled- a boolean, default true, with the author's own description doing all the work: "Enable SGLang's Flash Attention backend. Set to False to pass the model through unchanged."
So the whole node is: enable Flash Attention inside the workers, or don't. The MODEL output wires to the sampler exactly where you'd have put the upstream patch node.
How it works
When enabled, the node flags the runtime to select SGLang's hardware-supported Flash backend for denoiser evaluations. On the validated SGLang 0.5.17 / A100 environment the README describes, that resolves to Flash Attention 3 - so on modern datacenter cards you're getting the current FA3 kernels, not the FA2 the stock DN node targets. That's the appeal: the worker's attention backend is picked by SGLang, which knows what hardware it's on.
One genuinely useful fact from the README: you don't actually need any attention patch. Omit it and SGLang chooses its dense backend automatically. The light-workload benchmark table shows automatic, Flash Attention, Sage Attention and Sol-Attn all landing within a couple seconds of each other on warm runs (35.8–37.5s end-to-end), so this node is a tuning knob, not a requirement.
Installing it
The pack install is the shared one - ComfyUI Manager, search "H3 SGLang Pack", or git clone https://github.com/TensorClay/ComfyUI-H3-SGLang-Pack.git into ComfyUI/custom_nodes, restart. No extra pip dependency here beyond SGLang Diffusion itself; the Flash backend ships with SGLang, so this is the least-deprecated attention node in the pack.
Where people get burned
The one gotcha worth knowing: switching attention settings restarts the worker pool. Flip enabled and your next generation is a cold run again - the loaded checkpoint and warm runtime get torn down and rebuilt. That also means don't chain this node after a different attention patch in the same graph and expect the last one to win cleanly; changing attention at all is a runtime-level event. The pack's worker-native nodes exist because ComfyUI's usual attention patch callbacks can't cross into the workers - so if you came here from a native workflow and "patched" but nothing changed, you were probably patching the host-side model. Use this node (or one of the pack's other two attention nodes) instead, and wire it directly to the sampler.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| model | MODEL | — | |
| enabled | BOOLEAN | true | Enable SGLang's Flash Attention backend. Set to False to pass the model through unchanged. |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| MODEL | MODEL | — |