r/StableDiffusion • u/ninjazombiemaster • 4d ago
No Workflow Self-Refining Sampler+
https://github.com/Alex240z/ComfyUI-SelfRefiningSamplerPlus



Based on: https://arxiv.org/html/2601.18577v1 and builds on pre-existing work by Kijai (The SamplerSelfRefineVideo Node).
I have found that Minimax H3-Image loves the Self-Refining Sampler. Seeing this, I spun up an improved version (SRS+) that is compatible with sampling methods besides Euler, has more easily adjustable sub-step and perturb amounts per step.
It seems to significantly improve the model's ability to resolve fine details, especially when combined with the "Empty-Image Trick" I shared previously (if using T2V). One place this is evident are patterns like fishnet, lace, sequins and other challenging fabrics/textiles. It seems to improve line-art for anime/illustration styles, and can often fix self-correct body-horror deformities.
As a starting point, try running it from steps 2-4 with 3 sub-steps and an uncertainty threshold of 0.03. But I'm much more curious what settings you try and results you get with them. Since it does sub-step, it increases gen time but I think it is well worth it.
I've tested it less with video, but it has shown promise there, too.
Just socket this chungus into a SamplerCustomAdvanced like any other sampler. Let me know if you have any issues, or what kind of results you get.
18
u/ninjazombiemaster 4d ago
Video example of it fixing a Pika H3 gen using the paper's preset:
https://imglink.cc/cdn/8oCs6N3f93.mp4
7
u/VasaFromParadise 4d ago edited 4d ago
threshold of 0.03
My image changes dramatically after this method. Has anyone figured out why yet? Or is it just me?
PS. perturb_strength_scale - must be less than 1, otherwise the image changes significantly.
12
u/Dante_77A 4d ago edited 4d ago
Interestingly, these fishnet outfits usually glitch on most models if the character isn’t close to the camera.
But note that the girl’s face has been drastically altered
9
u/YeahlDid 4d ago
Pretty neat stuff, thank you. About how much does this add to generate time?
6
u/JorG941 4d ago
Is this aplicable on other models?
3
u/alwaysbeblepping 4d ago edited 3d ago
This sounds like a very similar concept to restart sampling, although generally restart run multiple steps before jumping back to a previous sigma and wasn't used near max sigma. I actually have a node in my Overly Complicated Sampling node pack (
SimpleRestartSchedule) that lets you define a schedule like run a step, jump back a step, run a step, jump back a step however many times you want. (It does require a restart-aware sampler to actually consume the schedule.)(1.0 - sigma) * denoised + sigma * eps_mix- Idea for a drinking game. Take a shot whenever you find a manual implementation oftorch.lerpin a custom node or ComfyUI source. Make sure your will is in order because you are definitely dying of alcohol poisoning before you get past a few modules.2
u/ninjazombiemaster 3d ago
The node is now live on the Comfy Registry for easier access.
2
u/Entrypointjip 2d ago
I been using it with MOSS SFT with turbo LoRA 8 steps, when you use this you can lower the steps to 6 to recover some of the lost speed.
2
u/Rude-Advantage-22 2d ago
Man, am I just stupid, or how the heck do you wire this thing up? Does it go in front of the KSamper? None of the sockets seem to line up unless I add another SamplerCustomAdvanced, but then I've no clue what to do with that node's required Guide/Sigma/Noise/etc. Any more documentation I'm missing, u/ninjazombiemaster ?
3
u/nixudos 4d ago
I tried it on a 9 step Ref2video Minimax H3 workflow.
Just the default settings, as I have no idea what to tweak.
It seemed to improve the audio noticeably, but there was one artifact in it. I'm trying to make another test and see if it was just a fluke.
Are there any recommended settings for Minimax video generations?
2
u/mac404 4d ago edited 4d ago
Interesting, definitely going to try it out!
Loading it up, seems like the defaults baked into the node are different from what you're suggesting to start with in the post here? Any reason why you're setting uncertainty threshold so much lower than the 0.25 node default and running it on one fewer step? And which metric is being used (mean or norm) related to your 0.03 suggestion?
Edit: Okay, a few dumb questions as I try to make sense of the settings:
1
u/Fantastic-Client-257 3d ago
This is absolutely brilliant (still testing/tweaking). Huge props.
1
u/Apprehensive_Sky892 3d ago
In the second comparison with the woman wearing the fishnet stocking, her right-hand fingers are complete fixed 😅
1
u/PantInTheCountry 3d ago
Ran into an issue installing this from the ComfyUI Manager.
The node will not install unless explicitly set
allow_git_url_install = truein config.ini and ComfyUI launched with a loopback--listen(any127.x.x.xaddress, or ::1), ornetwork_mode = personal_cloudin config.ini. (my settings have the more restrictiveallow_git_url_install = trueandnetwork_mode = publicoptions selected)Not sure if this is a configuration issue when the node was published or a configuration issue with Comfy/Stability Matrix. No other node has this problem (tested by installing another new node from the manager).
1
u/jjjnnnxxx 3d ago
Very cool node — I'd love to see it implemented in native Comfy. Maybe you should submit a PR? Also, the widgets are a bit glitchy: they sometimes break node values, and it happens every time I use comfy agent to work with the canvas.
1
u/Flat_Technology_5325 3d ago
Hmm, I was using this in comfyui yesterday after t installing it with no issues but when I updated comfy today, it kills my UI and it won't load 🤔
1
u/Straight-Election963 3d ago
is it normal to take all of that time in generating ?? i mean im using moss like 25 step, and it takes like 2 min, but with connecting this node on 4 steps only it takes like 6 ~ min !! anyway to deduct that time ?
1
u/Calm_Mix_3776 2d ago
Can you kindly post your workflow? For some reason I'm getting worse results with this sampler compared to Euler. :(
1
u/Diabolicor 4d ago edited 4d ago
Really interesting paper. Can you describe the config you used for your video tests and did you run it with your Re-Time pass or was it just 1 Pass ?
1
u/Ill_Resolve8424 4d ago
How to use this in comfy? Looks promising
5
u/Estwhy 4d ago
Im so dumb, could you provide us a workflow please?
2
u/chimaeraUndying 3d ago
Would you care to share the (Comfy, I'm assuming) workflows for these?
0
u/fallengt 4d ago
Neat, but sampling speed decreases quite a bit. It's not free lunch
1
u/Cubey42 3d ago
Have to check this out thanks
1
u/physalisx 3d ago
Looks interesting! I will check this out later
0
u/Enshitification 4d ago
I wonder if this would combine well with the Lakonik team's pi-H3 to get better results from their low-step adapters? I'm not near a machine to test it right now, so this is my reminder note.
0
u/celialoriaart 4d ago
The difference on the fishnet texture and the hand structure in the "after" shot is wild. Definitely plugging this into my SamplerCustomAdvanced node to test those 2-to-4 step settings!