DyPE for Qwen Image
Generate Qwen Image at 4K natively instead of praying the sampler holds together
- model
- model
Qwen Image is a flow-matching model, and like every model in that family it was trained on a fixed resolution map - roughly 1024×1024. Push past that and the model leaves its map, starts extrapolating positions it never saw in training, and you get the classic tell: repeated clones of the same object marching across the frame, or a wash of mush. The usual answer is to generate at native res and upscale. DyPE for Qwen Image is the alternative: patch the model so it can natively generate at 2K/4K.
DyPE is Dynamic Position Extrapolation, a trick borrowed straight from LLM context-extension (the YaRN/NTK family). The idea is that you don't need the model to understand the whole 4K canvas from step one. Early in sampling, keep the position coordinates pinned close to the native training size so composition locks in on solid ground. Then, as sampling progresses, exponentially ramp the grid outward. The model "sees" the full canvas exactly when it's painting high-frequency detail, instead of being forced off-map the entire time.
Where it sits in a workflow. This is a model patcher - category model_patches/unet - so it slots in exactly like ModelSamplingAuraFlow or a LoRA loader: model in, patched model out, wire that into your KSampler. It replaces the "generate small, then upscale" route with "generate big, directly." Both are legitimate; DyPE gives you true native-resolution composition rather than hallucinated detail on top of an upscaled base. This is the same approach the "4K with Flux DyPE nodes" tutorials in the community lean on, and it's the more detail-native of the two roads.
Inputs that matter:
model- your Qwen Image model (any checkpoint, since this patches the architecture).width/height- the target render size. Must match your latent; this isn't an auto-resizer.auto_detect- on by default, and it's good: it pulls patch size and base resolution off the model. If detection fails,base_width/base_height(default 1024) are the fallback.method-yarn(default),ntk, orbase. YaRN is the recommended default for images; it handles frequency bands separately and keeps texture. If your output looks jagged or over-sharpened, switch tontk, which scales uniformly and reads smoother.baseturns extrapolation off entirely - good for testing whether DyPE is what changed your output.enable_dype- master toggle.dype_exponent(default 2.0) controls how aggressively the ramp happens; higher keeps the model closer to base resolution longer.base_shift/max_shift- noise-schedule shifts (1.15 → 1.35 by default). This is the flow-model equivalent of the shift knob: it redistributes sampling effort between composition and detail as resolution grows.
If you're doing img2img or inpainting rather than text-to-image, lower editing_strength (1.0 default) to preserve the original structure - that's its entire job - and editing_mode (default adaptive) picks the tapering strategy.
Output. A single model, patched and ready for the KSampler. That's the whole thing: it returns a MODEL, not an image.
Install. Ships in ttulttul/ComfyUI-FlowMatching-Upscaler, alongside the pack's progressive upscaler. ComfyUI Manager, search "ComfyUI-FlowMatching-Upscaler", install, restart. Or:
cd ComfyUI/custom_nodes
git clone https://github.com/ttulttul/ComfyUI-FlowMatching-Upscaler
Dependencies are numpy, torch, einops, aiohttp - nothing exotic, no model downloads. Restart ComfyUI and it appears under model_patches/unet.
Gotchas. Width/height not matching your latent is the classic silent failure - the patch runs, the sampler runs, and the output is subtly off because the model was told 2048 while the latent was 1536. Also remember this is for Qwen Image: the Flux2 variant is a separate node with different defaults because Flux2 uses a 4-axis position scheme. And a 4K Qwen pass is a VRAM event; if you're on 8GB, generate at 2K or use the upscaler instead. Start with the defaults, try method=yarn, and only touch shifts once you've seen what the base settings do.
Inputs (13)
| Name | Type | Default | Description |
|---|---|---|---|
| model | MODEL | Qwen Image model to patch with DyPE. | |
| width | INT | 102416–16384 | Target output width in pixels. |
| height | INT | 102416–16384 | Target output height in pixels. |
| auto_detect | BOOLEAN | true | Automatically derive patch size and base resolution from the model when possible. |
| base_width | INT | 102416–16384 | Training width used by the base Qwen model when auto detection fails. |
| base_height | INT | 102416–16384 | Training height used by the base Qwen model when auto detection fails. |
| method | COMBO | yarn | Spatial RoPE extrapolation strategy. |
| enable_dype | BOOLEAN | true | Enable Dynamic Position Extrapolation scaling. |
| dype_exponent | FLOAT | 2.00–4 | Controls how strongly DyPE ramps across sampling timesteps. |
| base_shift | FLOAT | 1.150–10 | Baseline shift applied to the flow-matching noise schedule. |
| max_shift | FLOAT | 1.350–10 | Maximum shift applied when operating at the target resolution. |
| editing_strength | FLOAT | 1.000–1 | Scale DyPE while editing images (1.0 = full strength, 0.0 = disable DyPE scaling in edits). |
| editing_mode | COMBO | adaptive | Strategy for tapering DyPE during edits. |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| model | MODEL | — |