Eric Krea2 Reference Latents (Edit)
The pixel-level edit path — but only if you've got the right LoRA loaded
- krea2_pipeline
- image1
- image2
- image3
- ref_latents
Krea 2's base model cannot read reference images. That's the thing to internalize before you touch this node - its text encoder is a VLM, so it can understand a picture as conditioning (that's Vision Prompt's semantic path), but there is no reference-latent pathway in the base DiT. The exception is edit-trained LoRAs, which add one. Eric Krea2 Reference Latents is the node that feeds that pathway: it VAE-encodes 1–3 reference images into KREA2_REF_LATENTS, appended to the image token sequence, for the Ultra node's ref_latents input.
Mechanically, each reference is VAE-encoded and flow-packed like a generation latent, its tokens are appended to the image sequence and modulated at t=0 (clean data) - the ai-toolkit "index_timestep_zero" edit method, reimplemented diffusers-side. The velocity prediction is sliced back to the live image tokens, so references inform the denoise without being denoised themselves. That's real pixel/structure conditioning, distinct from Vision Prompt's semantic grounding - they're complementary channels, and the recommended wiring for the community's Style Reference LoRA uses both.
The catch is repeated twice in the tooltips because it's the whole game: a LoRA under the wrong recipe is the classic "never as good as the author's examples" failure. The edit_recipe dropdown has two options and they map to two different training recipes:
ostris_t0- references appended on their own grid with t=0 modulation. For style/reference LoRAs (the Krea 2 Style Reference type). Pair with Vision Prompt'spicture_ntemplate at ~0.15 MP.edit_frame- source prepended on the target grid at a shared timestep. For identity/instruction edit LoRAs (the Krea 2 Identity Edit type). Pair with Vision Prompt'sbare_edittemplate at ~0.30–0.45 MP.
Pick the wrong one and the reference tokens mean nothing useful - the model ignores what it can't read. Without any edit LoRA loaded, the base model ignores the tokens entirely and you just pay the compute (~2048 tokens per 1 MP ref, per denoise step - that's the cost of a silent no-op).
Other inputs: image1 (required), image2, image3 (published edit LoRAs are mostly trained for 1–2 refs), max_ref_megapixels (per-reference pixel cap before encode - community testing with the Style Reference LoRA found ~0.25 MP cleaner than the 1.0 MP training default), and krea2_pipeline. One output: ref_latents, into Multi-Stage Ultra's ref_latents input.
Two gotchas worth carrying in your head. First, the CFG caveat: with guidance enabled, the transformer-forward wrapper can't tell a positive pass from a negative one, so references condition both and partially cancel in the CFG delta - keep it on Turbo at guidance 0, which is what the published edit LoRAs target anyway. Second, ref_match_size on the Ultra node rescales references in latent token space to match the run's Stage 1 size; for the Style Reference LoRA the tooltip recommends trying it OFF first, since the training never matched refs to the target grid, and turning it ON deviates from the trained geometry.
How to install
Part of EricRollei/Krea2_ComfyUI_Advanced. ComfyUI Manager → search "Krea2_ComfyUI_Advanced", or:
cd ComfyUI/custom_nodes
git clone https://github.com/EricRollei/Krea2_ComfyUI_Advanced
Restart, plus pack-wide requirements (git diffusers with Krea2Pipeline, transformers>=4.57.0, Krea 2 weights). The edit LoRA itself is a download you supply - this node doesn't fetch it.
Common issues
- "Nothing happened, just slower" - no edit-trained LoRA loaded, or the recipe doesn't match the LoRA. Check
edit_recipeagainst what the LoRA was trained with. - Image fragments / breaks -
ostris_t0recipe at too-high LoRA strength (1.0 is reported to break the image; ~0.4–0.5 is the working band) orref_match_sizebehavior fighting your sizes. - Reference pasted in a shrunken corner - the corner-bias failure mode; the Ultra node's
ref_match_sizeON is the escape hatch for exactly this. - Edits that should remove content don't - removals want Raw at CFG ~3 with an empty negative prompt, per the edit_frame guidance.
Inputs (6)
| Name | Type | Default | Description |
|---|---|---|---|
| krea2_pipeline | KREA2_PIPELINE | — | |
| image1 | IMAGE | Reference image 1 (VAE-encoded, appended to the image token sequence at t=0). | |
| image2opt | IMAGE | Reference image 2 (optional). | |
| image3opt | IMAGE | Reference image 3 (optional; published edit LoRAs are mostly trained for 1-2 refs). | |
| max_ref_megapixelsopt | FLOAT | 0.250.1–4 | Per-reference pixel cap before VAE encode (downscale only, never upscale). ai-toolkit edit training uses 1.0 MP, but community testing with the Style Reference LoRA found ~0.25 MP gives cleaner style transfer with fewer artifacts than the training-time default - raise it only if you need more structural detail from the reference. Note the Ultra node's ref_match_size then rescales the encoded reference again (in token space) to match its resolved Stage 1 size, so this cap mostly just bounds the encode-time VAE cost/detail ceiling, not the final grid size actually used. Each 1 MP ref adds ~2048 tokens to every denoise step, so 2-3 refs at 1 MP is slow. |
| edit_recipeopt | COMBO | ostris_t0 | Which trained reference mechanism to run - the LoRA and the recipe MUST match (a LoRA under the wrong recipe = the classic 'never as good as the author's examples' failure). ostris_t0: refs appended at their own grid with t=0 modulation - for style/reference LoRAs (ai-toolkit reference method, e.g. Krea 2 Style Reference). Pair with Vision Prompt template picture_n at ~0.15 MP. edit_frame: source prepended on the target grid, shared timestep - for identity/instruction edit LoRAs (ai-toolkit predict_velocity_edit, e.g. Krea 2 Identity Edit at strength 1.0). The Ultra node pixel-fits and re-encodes the source at its resolved Stage 1 size automatically (match your target aspect ratio to the source; trained <=2MP, so it conditions Stage 1 only in a multistage run). Pair with Vision Prompt template bare_edit at ~0.30-0.45 MP. Turbo/CFG-1 for most edits; removals need Raw at CFG ~3 with an EMPTY negative prompt. |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| ref_latents | KREA2_REF_LATENTS | — |