Needle Prompt to Sampler Params
Type a natural-language prompt, get real KSampler settings out
- positive
- width
- height
- steps
- cfg
- sampler_name
- scheduler
- seed
- confidence
- info
This node is the whole pack in one shape: you type a prompt like "a photo of a red fox in snow, 1024x1536, 30 steps, cfg 4.5, dpmpp_2m karras, seed 1234" and it splits it into a positive string, width, height, steps, cfg, sampler_name, scheduler, and seed - real typed outputs you can wire straight into KSampler, an Empty Latent Image, and a seed source. It's the "natural language in, typed graph parameters out" promise, and it's the node people reach for when they want a human-facing control panel on a workflow without rebuilding the graph every time.
Same engine as Needle Extract - the 45M Cactus Needle 2 model on CPU, no GPU, no API. It works by building an internal "render" tool whose parameters are exactly those fields, with sampler and scheduler offered to the model as enum lists, and the model's tool-calling picks the values. Two details in that schema are load-bearing and worth knowing because they're the difference between a nice demo and a silent lie:
- Numeric bounds feed the decoding grammar. Without a
"maximum"oncfg, the model reads"cfg 4.5"as45. The pack sets bounds on everything, which is why the numbers come out sane. - Enum fields are declared first. When they were declared last, the scheduler came back
None4/4 times; declared first, sampler and scheduler are correct 4/4.
The inputs that matter
prompt is the only required one. The optional stack is mostly defaults and two choice lists:
- sampler_choices and scheduler_choices - comma-separated lists offered to the model as enums. Keep them short: every tool token competes for the 256-token window. This is also your safety valve - the output can never be a sampler outside this list, no matter what the model thinks it read.
- default_width / default_height / default_steps / default_cfg / default_seed / default_sampler / default_scheduler - used when the prompt names nothing. The defaults are the contract: a miss degrades to your configured default, never to a made-up number.
- drop_ungrounded (default on) - discards values the engine flags as ungrounded and swaps in defaults. The tooltip is blunt: "The model does invent numbers on sparse prompts."
Outputs
positive (STRING - the subject, with all the technical settings stripped), width, height, steps, seed (INTs), cfg (FLOAT), sampler_name and scheduler (typed against ComfyUI's real sampler/scheduler lists), plus confidence and info. Wire sampler_name and scheduler directly into KSampler - they're constrained to real ComfyUI names, and the node does a two-stage snap (first to what you offered, then to the full legal list) so a wrong guess can't sneak through as a real-but-wrong sampler.
The honest limits
The README measured this, not just claimed it. On dense prompts it extracted 7 of 11 numeric fields cleanly; the other four were defaults, and - this is the good part - never wrong values. Sparse prompts like "a portrait, 40 steps" return nothing at all and fall back to defaults. There's no free-text fallback and no hallucination-by-default: the failure mode is "your default gets used," which is exactly what you want from a control node. That's the same judgment the KB's LLM-in-ComfyUI essay makes - the job selects for small and obedient, and a 45M structured-extraction model is that.
One workflow-level tip: because misses quietly become defaults, set the defaults to values that are actually good for your base model (CFG 1 on a distilled model, for instance - see the troubleshooting essay). Then a sparse prompt is harmless, because "the default" is where you'd have landed anyway.
Install
ComfyUI Manager - search ComfyUI Needle 2 - or:
cd ComfyUI/custom_nodes
git clone https://github.com/DenRakEiw/Comfyui_Needle2
python_embeded\python.exe -m pip install cactus-needle
Restart, first run pulls the 14 MB engine into ~/.cache/cactus-needle/. The two recurring gotchas: don't name the folder needle (it collides with the engine's own Python package), and on Windows, Smart App Control can block the unsigned DLL with [WinError 4551]. Neither is a prompt-params problem specifically, but both will make this node fail and the error messages are the first place to look.
Inputs (11)
| Name | Type | Default | Description |
|---|---|---|---|
| prompt | STRING | a photo of a red fox in snow, 1024x1536, 30 steps, cfg 4.5, dpmpp_2m karras, seed 1234 | — |
| sampler_choicesopt | STRING | euler, euler_ancestral, dpmpp_2m, dpmpp_2m_sde, dpmpp_3m_sde, ddim | Offered to the model as an enum. Keep it short - every tool token competes for the 256-token window. The output is never a sampler outside this list. |
| scheduler_choicesopt | STRING | normal, karras, exponential, simple | — |
| default_widthopt | INT | 102416–16384 | — |
| default_heightopt | INT | 102416–16384 | — |
| default_stepsopt | INT | 201–1000 | — |
| default_cfgopt | FLOAT | 7.00–100 | — |
| default_seedopt | INT | 00–1152921504606847000 | — |
| default_sampleropt | COMBO | Used when the prompt names no sampler. | |
| default_scheduleropt | COMBO | Used when the prompt names no scheduler. | |
| drop_ungroundedopt | BOOLEAN | true | Discard values the engine flags as not grounded in the prompt, and use the defaults instead. The model does invent numbers on sparse prompts. |
Outputs (10)
| Name | Type | Description |
|---|---|---|
| positive | STRING | — |
| width | INT | — |
| height | INT | — |
| steps | INT | — |
| cfg | FLOAT | — |
| sampler_name | euler,euler_cfg_pp,euler_ancestral,euler_ancestral_cfg_pp,heun,heunpp2,exp_heun_2_x0,exp_heun_2_x0_sde,dpm_2,dpm_2_ancestral,lms,dpm_fast,dpm_adaptive,dpmpp_2s_ancestral,dpmpp_2s_ancestral_cfg_pp,dpmpp_sde,dpmpp_sde_gpu,dpmpp_2m,dpmpp_2m_cfg_pp,dpmpp_2m_sde,dpmpp_2m_sde_gpu,dpmpp_2m_sde_heun,dpmpp_2m_sde_heun_gpu,dpmpp_3m_sde,dpmpp_3m_sde_gpu,ddpm,lcm,ipndm,ipndm_v,deis,res_multistep,res_multistep_cfg_pp,res_multistep_ancestral,res_multistep_ancestral_cfg_pp,gradient_estimation,gradient_estimation_cfg_pp,er_sde,seeds_2,seeds_3,sa_solver,sa_solver_pece,ddim,uni_pc,uni_pc_bh2 | — |
| scheduler | simple,sgm_uniform,karras,exponential,ddim_uniform,beta,normal,linear_quadratic,kl_optimal | — |
| seed | INT | — |
| confidence | FLOAT | — |
| info | STRING | — |