High-precision model and CLIP tuning suite for Krea-2 models in ComfyUI
Python
8
56 commits
updated Sep 15, 2026
Zero-retraining weight steering, geometric subspace rotations, channel profiling, and 5D LoRA compaction for Krea-2 and modern diffusion models in ComfyUI.
🚀 Version 2.0 Release: A major evolution featuring zero-retraining Lie Algebra subspace rotations ($SO(n)$), residual channel magnitude profiling, 5D LoRA compression with scoped self-contained presets, native memory safety for
ModelPatcherDynamic, and an offline automated test suite.
Edit a Krea-2 model and its Qwen3 text encoder by modulating internal weights, rotating singular subspaces, and profiling residual streams live in memory — no training and no datasets required. Move a dial, generate, and observe immediate stylistic and semantic shifts. When you land on a result you like, export it as a lightweight preset or bake it into a standalone .safetensors checkpoint.
How different prompts behave under varying tuning configurations.
ModelPatcherDynamic assertion failures.In ComfyUI Manager, click Install via Git URL, paste:
https://github.com/aledelpho/comfyui-arthemy-krea2-tuner.git
and click Install.
Navigate to your ComfyUI custom_nodes folder:
cd ComfyUI/custom_nodes
git clone https://github.com/aledelpho/comfyui-arthemy-krea2-tuner.git
Dependencies (torch, safetensors, numpy, Pillow) are bundled by default with modern ComfyUI installations. If needed:
pip install -r comfyui-arthemy-krea2-tuner/requirements.txt
Restart ComfyUI completely afterward.
The suite includes a ready-to-run, modular reference workflow located in example_workflows/Arthemy_Krea2_Tuner_Workflow.json:
example_workflows/Arthemy_Krea2_Tuner_Workflow.json onto the ComfyUI canvas.Every node clones the ComfyUI patcher and attaches patches in-place. They can be chained in any sequence. Each node outputs an info string ending in Patches: N confirming the exact count of modified tensors.
Provides one scalar multiplier per major section: Text_Fusion, Time_Embed, Projection, and Block_1 through Block_6 (blocks 0-4, 5-9, 10-14, 15-19, 20-23, 24-27). Moving a slider scales every tensor inside that group uniformly.
MODEL → Model Tuner → KSampler.
Block Tuning — Modulating an entire block (Block_3) across different values (-2.0 to +2.0) demonstrates how group-level tuning shapes visual structures and features.
Narrows target execution: select a block group or a single block (target_block), then adjust fine-grained sliders for internal tensor families: ATTN_wq_query, ATTN_wk_key, ATTN_wv_value, ATTN_wo_out, ATTN_q_norm, MLP_gate_swiglu, MLP_up_proj, MLP_down_proj, NORMS_block_scales, etc.
Sub-Block Tuning — Modulating specific sub-blocks within Block 3 influences fine details and layer-level characteristics.
Stochastic perturbation of chosen tensor families: each matched tensor is perturbed with probability chance by chaos_strength. Seeded with a 32-bit CRC seed to ensure identical reproductions across restarts.
Chaos Tuning — Seeded stochastic perturbations applied across sub-blocks introduce controlled stylistic variations.
A vertical rather than horizontal cut: profiles the residual stream ($d_{model} = 6144$ on Krea-2), ranks channels logarithmically by energy, cuts them into 12 logarithmic frequency bands, and applies direction-aware scaling.
channel_scope: targets MLP or Attention sub-networks.channel_path: applies gains where the network reads from residual, writes back, or both.models/arthemy_profiles/.
Tuning applied to the Qwen3-VL text encoder provides fine-grained steering over prompt comprehension and linguistic interpretation:
Embedding and Layer_1 through Layer_7 (text layers 0-4 through 30-35).ATTN_q_proj, k_proj, v_proj, o_proj, query norms, and MLP projections inside specific layers.
Traditional weight tuning multiplies tensors by scalars:
Provides four independent rotation dials (ranging ±180°) inside the dominant SVD subspaces of the target weights:
depth_reach: Sets the active rotated rank (8, 16, or 32).Applies pseudo-random orthogonal rotations across subspace planes:
chaos_strength: Caps maximum rotation angle as a fraction of 90°.harmonic_coherence: Snaps rotation angles toward musical/harmonic multiples of 45°, maintaining visual cohesion.seed: Fully deterministic CRC32 seed.Rotates weights along a continuous spherical bearing:
style_direction (0–360°): Blends smoothly between local and long-range geometric planes. Moving along the compass dial shifts aesthetic flavor gradually like turning a map dial.rotation_angle (-90° to +90°): Distance traveled along that specific bearing.manifold: Chooses between the input manifold (what the layer listens to) or output manifold (what it emits).rotation_angle or axis dials between 10° and 30°. You will notice immediate alterations in style, shading, and anatomical structure with zero loss of dynamic range.
.safetensors files.num_dimensions = 1..8, default 5)..json modifier into models/arthemy_modifiers/.storage: auto measures compression fidelity and automatically selects DCT compaction or raw factor fallback.Ctrl+B so it doesn't recalculate on every generation.modifier_name to your extracted .json modifier (or let it read from an embedded preset).Dir_01 through Dir_08).Block_3), a component (ATTN), or a single layer (ATTN_wq_query), completely eliminating unwanted character or style bleed.prune_5d_to_target)When saving a preset with embedded 5D modifiers using Preset Saver:
prune_5d_to_target enabled, the saver automatically detects which exact layers your 5D Tuner nodes target.
custom_nodes/Arthemy_Krea2_Tuner/presets/.
embed_5d_modifiers: Embeds 5D payloads directly into the JSON so presets are portable across machines.prune_5d_to_target: Strips unreachable layers from embedded modifiers, keeping file size minimal.strength_model and strength_clip multipliers. Safely skips incompatible scaled-FP8 companion scales.presets/Arthemy_Comics_Preset.json, delivering the complete Arthemy Comics aesthetic with embedded self-contained 5D payloads.
.safetensors checkpoints in BF16 or FP8_E4M3 without requiring pre-baking. Correctly fuses FP8 companion scales into quantized tensors.object_patches (FreeU, AuraFlow) completely intact.| Category | Domain | Group Level | Granular / Sub-Block | Geometric / SVD | Stochastic Discovery |
|---|---|---|---|---|---|
| Magnitude Tuning | Diffusion Model | Model Tuner | Model Sub-Block Tuner Channel Magnitude Tuner | — | Model Sub-Block Chaos |
| Magnitude Tuning | Qwen3 CLIP | CLIP Tuner | CLIP Sub-Block Tuner | — | CLIP Sub-Block Chaos |
| Subspace Rotators | Model & CLIP | — | — | Model / CLIP Axis Rotator Model / CLIP Compass Rotator | Model / CLIP Chaos Rotator |
| 5D Compaction | Model, CLIP & LoRA | — | — | 5D Model Tuner 5D CLIP Tuner | LoRA-to-5D Extractor |
| LoRA Filtering | External LoRA | LoRA Block Loader | Load Sub-Block LoRA | — | Load Sub-Block Chaos LoRA |
| Memory & Storage | System & Disk | Preset Loader | Preset Saver | Reset Patcher | Model Baker (RAM) Savers (Disk) |
Slider controls represent offsets relative to base weights (0.00 = neutral/unmodified):
| Mode | Formula | Application |
|---|---|---|
| Soft Value | 1.0 + (slider × 0.10) | Delicate calibration — slider 1.0 applies +10% gain (Recommended default). |
| Real Value | 1.0 + slider | Direct multiplier — slider 1.0 doubles weight (+100%). For bold stylistic interventions. |
Visual reference gallery demonstrating how modulating individual Model blocks and CLIP layers steers generation outputs in isolation.
Western comics style, bold ink outlines, hatched shadows, eerie detached calm, seen from a dutch high angle close-up, upper body portrait, dynamic pose, dramatic angle, strong perspective. male human plague doctor, thinning gray hair slicked back, thin sparse eyebrows, pale sickly skin gradient, gaunt older adult, long thin gloved fingers, a wispy gray goatee, deep tired wrinkles, dull green eyes. narrow jaw, tall lanky frame, eerie detached calm stare. a long black waxed-leather coat with a high collar, a satchel of glass vials strapped across his chest. holding a bubbling green potion vial up to the light. Background: a dim candle-lit apothecary shop cluttered with shelves of jars and dried herbs. Lighting: flickering warm candlelight from below mixing with cool teal moonlight through a fogged window, creating dramatic contrast across his face.
Here you can see how feature isolation works in practice: By identifying and amplifying only the specific Model blocks and CLIP layers responsible for generating the plague doctor's beak mask, the feature persists robustly and deterministically across completely different generation seeds.
The repository comes equipped with an extensive 11-suite automated test suite located in tests/:
test_node_contracts.py).test_reset_patcher.py, test_prune.py).test_channel_profile.py, test_channel_roundtrip.py).test_savers_patching.py, test_saver_e2e.py).Run the automated suite using ComfyUI's Python runtime:
Get-ChildItem -Path tests -Filter "test_*.py" | ForEach-Object {
& "path/to/comfyui/python.exe" $_.FullName
}
For complete architectural notes, memory management invariants, and custom node extensions, refer to ARCHITECTURE.md.
ComfyUI/custom_nodes/Arthemy_Krea2_Tuner without nested folders.Patches: 0 will be returned in the node info string.scale_weight companions are automatically protected from double-scaling during tuning and correctly folded during checkpoint export.Arthemy · @aledelpho
Distributed under the MIT License — see LICENSE for details.
High-precision model and CLIP tuning suite for Krea-2 models in ComfyUI
Python
8
56 commits
updated Sep 15, 2026
Zero-retraining weight steering, geometric subspace rotations, channel profiling, and 5D LoRA compaction for Krea-2 and modern diffusion models in ComfyUI.
🚀 Version 2.0 Release: A major evolution featuring zero-retraining Lie Algebra subspace rotations ($SO(n)$), residual channel magnitude profiling, 5D LoRA compression with scoped self-contained presets, native memory safety for
ModelPatcherDynamic, and an offline automated test suite.
Edit a Krea-2 model and its Qwen3 text encoder by modulating internal weights, rotating singular subspaces, and profiling residual streams live in memory — no training and no datasets required. Move a dial, generate, and observe immediate stylistic and semantic shifts. When you land on a result you like, export it as a lightweight preset or bake it into a standalone .safetensors checkpoint.
How different prompts behave under varying tuning configurations.
ModelPatcherDynamic assertion failures.In ComfyUI Manager, click Install via Git URL, paste:
https://github.com/aledelpho/comfyui-arthemy-krea2-tuner.git
and click Install.
Navigate to your ComfyUI custom_nodes folder:
cd ComfyUI/custom_nodes
git clone https://github.com/aledelpho/comfyui-arthemy-krea2-tuner.git
Dependencies (torch, safetensors, numpy, Pillow) are bundled by default with modern ComfyUI installations. If needed:
pip install -r comfyui-arthemy-krea2-tuner/requirements.txt
Restart ComfyUI completely afterward.
The suite includes a ready-to-run, modular reference workflow located in example_workflows/Arthemy_Krea2_Tuner_Workflow.json:
example_workflows/Arthemy_Krea2_Tuner_Workflow.json onto the ComfyUI canvas.Every node clones the ComfyUI patcher and attaches patches in-place. They can be chained in any sequence. Each node outputs an info string ending in Patches: N confirming the exact count of modified tensors.
Provides one scalar multiplier per major section: Text_Fusion, Time_Embed, Projection, and Block_1 through Block_6 (blocks 0-4, 5-9, 10-14, 15-19, 20-23, 24-27). Moving a slider scales every tensor inside that group uniformly.
MODEL → Model Tuner → KSampler.
Block Tuning — Modulating an entire block (Block_3) across different values (-2.0 to +2.0) demonstrates how group-level tuning shapes visual structures and features.
Narrows target execution: select a block group or a single block (target_block), then adjust fine-grained sliders for internal tensor families: ATTN_wq_query, ATTN_wk_key, ATTN_wv_value, ATTN_wo_out, ATTN_q_norm, MLP_gate_swiglu, MLP_up_proj, MLP_down_proj, NORMS_block_scales, etc.
Sub-Block Tuning — Modulating specific sub-blocks within Block 3 influences fine details and layer-level characteristics.
Stochastic perturbation of chosen tensor families: each matched tensor is perturbed with probability chance by chaos_strength. Seeded with a 32-bit CRC seed to ensure identical reproductions across restarts.
Chaos Tuning — Seeded stochastic perturbations applied across sub-blocks introduce controlled stylistic variations.
A vertical rather than horizontal cut: profiles the residual stream ($d_{model} = 6144$ on Krea-2), ranks channels logarithmically by energy, cuts them into 12 logarithmic frequency bands, and applies direction-aware scaling.
channel_scope: targets MLP or Attention sub-networks.channel_path: applies gains where the network reads from residual, writes back, or both.models/arthemy_profiles/.
Tuning applied to the Qwen3-VL text encoder provides fine-grained steering over prompt comprehension and linguistic interpretation:
Embedding and Layer_1 through Layer_7 (text layers 0-4 through 30-35).ATTN_q_proj, k_proj, v_proj, o_proj, query norms, and MLP projections inside specific layers.
Traditional weight tuning multiplies tensors by scalars:
Provides four independent rotation dials (ranging ±180°) inside the dominant SVD subspaces of the target weights:
depth_reach: Sets the active rotated rank (8, 16, or 32).Applies pseudo-random orthogonal rotations across subspace planes:
chaos_strength: Caps maximum rotation angle as a fraction of 90°.harmonic_coherence: Snaps rotation angles toward musical/harmonic multiples of 45°, maintaining visual cohesion.seed: Fully deterministic CRC32 seed.Rotates weights along a continuous spherical bearing:
style_direction (0–360°): Blends smoothly between local and long-range geometric planes. Moving along the compass dial shifts aesthetic flavor gradually like turning a map dial.rotation_angle (-90° to +90°): Distance traveled along that specific bearing.manifold: Chooses between the input manifold (what the layer listens to) or output manifold (what it emits).rotation_angle or axis dials between 10° and 30°. You will notice immediate alterations in style, shading, and anatomical structure with zero loss of dynamic range.
.safetensors files.num_dimensions = 1..8, default 5)..json modifier into models/arthemy_modifiers/.storage: auto measures compression fidelity and automatically selects DCT compaction or raw factor fallback.Ctrl+B so it doesn't recalculate on every generation.modifier_name to your extracted .json modifier (or let it read from an embedded preset).Dir_01 through Dir_08).Block_3), a component (ATTN), or a single layer (ATTN_wq_query), completely eliminating unwanted character or style bleed.prune_5d_to_target)When saving a preset with embedded 5D modifiers using Preset Saver:
prune_5d_to_target enabled, the saver automatically detects which exact layers your 5D Tuner nodes target.
custom_nodes/Arthemy_Krea2_Tuner/presets/.
embed_5d_modifiers: Embeds 5D payloads directly into the JSON so presets are portable across machines.prune_5d_to_target: Strips unreachable layers from embedded modifiers, keeping file size minimal.strength_model and strength_clip multipliers. Safely skips incompatible scaled-FP8 companion scales.presets/Arthemy_Comics_Preset.json, delivering the complete Arthemy Comics aesthetic with embedded self-contained 5D payloads.
.safetensors checkpoints in BF16 or FP8_E4M3 without requiring pre-baking. Correctly fuses FP8 companion scales into quantized tensors.object_patches (FreeU, AuraFlow) completely intact.| Category | Domain | Group Level | Granular / Sub-Block | Geometric / SVD | Stochastic Discovery |
|---|---|---|---|---|---|
| Magnitude Tuning | Diffusion Model | Model Tuner | Model Sub-Block Tuner Channel Magnitude Tuner | — | Model Sub-Block Chaos |
| Magnitude Tuning | Qwen3 CLIP | CLIP Tuner | CLIP Sub-Block Tuner | — | CLIP Sub-Block Chaos |
| Subspace Rotators | Model & CLIP | — | — | Model / CLIP Axis Rotator Model / CLIP Compass Rotator | Model / CLIP Chaos Rotator |
| 5D Compaction | Model, CLIP & LoRA | — | — | 5D Model Tuner 5D CLIP Tuner | LoRA-to-5D Extractor |
| LoRA Filtering | External LoRA | LoRA Block Loader | Load Sub-Block LoRA | — | Load Sub-Block Chaos LoRA |
| Memory & Storage | System & Disk | Preset Loader | Preset Saver | Reset Patcher | Model Baker (RAM) Savers (Disk) |
Slider controls represent offsets relative to base weights (0.00 = neutral/unmodified):
| Mode | Formula | Application |
|---|---|---|
| Soft Value | 1.0 + (slider × 0.10) | Delicate calibration — slider 1.0 applies +10% gain (Recommended default). |
| Real Value | 1.0 + slider | Direct multiplier — slider 1.0 doubles weight (+100%). For bold stylistic interventions. |
Visual reference gallery demonstrating how modulating individual Model blocks and CLIP layers steers generation outputs in isolation.
Western comics style, bold ink outlines, hatched shadows, eerie detached calm, seen from a dutch high angle close-up, upper body portrait, dynamic pose, dramatic angle, strong perspective. male human plague doctor, thinning gray hair slicked back, thin sparse eyebrows, pale sickly skin gradient, gaunt older adult, long thin gloved fingers, a wispy gray goatee, deep tired wrinkles, dull green eyes. narrow jaw, tall lanky frame, eerie detached calm stare. a long black waxed-leather coat with a high collar, a satchel of glass vials strapped across his chest. holding a bubbling green potion vial up to the light. Background: a dim candle-lit apothecary shop cluttered with shelves of jars and dried herbs. Lighting: flickering warm candlelight from below mixing with cool teal moonlight through a fogged window, creating dramatic contrast across his face.
Here you can see how feature isolation works in practice: By identifying and amplifying only the specific Model blocks and CLIP layers responsible for generating the plague doctor's beak mask, the feature persists robustly and deterministically across completely different generation seeds.
The repository comes equipped with an extensive 11-suite automated test suite located in tests/:
test_node_contracts.py).test_reset_patcher.py, test_prune.py).test_channel_profile.py, test_channel_roundtrip.py).test_savers_patching.py, test_saver_e2e.py).Run the automated suite using ComfyUI's Python runtime:
Get-ChildItem -Path tests -Filter "test_*.py" | ForEach-Object {
& "path/to/comfyui/python.exe" $_.FullName
}
For complete architectural notes, memory management invariants, and custom node extensions, refer to ARCHITECTURE.md.
ComfyUI/custom_nodes/Arthemy_Krea2_Tuner without nested folders.Patches: 0 will be returned in the node info string.scale_weight companions are automatically protected from double-scaling during tuning and correctly folded during checkpoint export.Arthemy · @aledelpho
Distributed under the MIT License — see LICENSE for details.