πΈ LLM Latent Selector
Let an LLM read your prompt and pick the canvas size
- latent
- w
- h
- resolution
Frog LLM Latent Selector is a small idea with a big dependency: it reads your image prompt, asks a local Ollama model which resolution fits best, and hands you an empty latent at that size. Portrait composition, landscape, cinematic wide - the LLM picks from the same nine Anima-friendly presets the manual πΈ Empty Latent offers, and outputs the chosen latent plus the width, height, and the resolution string it decided on. It's resolution-by-composition instead of resolution-by-habit.
The "how it works" is straightforward, and the tooltips are unusually candid about the plumbing. Your prompt is sent to an Ollama model (default mistral), which returns one of the preset resolutions based on composition; if Ollama is unreachable or returns garbage, the node falls back to a configurable preset instead of failing. That fallback is the safety net that makes this node practical rather than a fragile demo. And because this is a local-LLM node, the README's honest framing applies: it requires Ollama running locally, on the same machine (or reachable remote) as ComfyUI - it's a local-LLM-as-tool pattern, not an API node, no key, no cloud bill.
The intended wiring, per the README, is through πΈ Smart Latent Switch: LLM Latent Selector feeds the override slot, your manual Empty Latent feeds the primary, and the switch routes to whichever is active. When the LLM path works, you get automatic composition-aware resolution; when it doesn't, you get your manual fallback without touching anything. It's a genuinely nice ergonomic - "let the graph decide, but never let it decide alone."
The inputs that matter
- prompt - the image prompt, wired from your prompt node. This is what the LLM reads to judge composition.
- model - the Ollama model name, default
mistral. The tooltip adds the practical note: it "should match what's loaded on the remote machine" - Ollama will error or fall back if the named model isn't pulled. - fallback - the resolution used when the LLM is unreachable or returns nonsense. Default
1536 Γ 1536. - unload_after - default true, and this is a real VRAM consideration: it unloads the model from VRAM after each call, which the tooltip says frees roughly 35% VRAM for Anima and the Detailer. Disable it only if you're doing rapid repeated runs and can spare the memory.
- batch_size - how many empty latents to create, default 1.
What comes out
latent (empty latent at the chosen resolution), w, h, and resolution (the chosen string, e.g. 1344 Γ 1728) - handy if you want to see or record what the LLM decided.
Installing it
Install Frog Node Pack:
cd ComfyUI/custom_nodes
git clone https://github.com/RabbitThatIsPink/FrogNodePack
...and install Ollama separately, pull a model (ollama pull mistral), and make sure it's running. The pack itself has no extra Python dependencies; the Ollama requirement is external.
Where people trip
The whole failure surface is Ollama. Not running, model not pulled, or model name mismatched β fallback kicks in, which means "the LLM picked" is really "the fallback picked" if you're not watching the resolution output. Second: unload_after costs you time on every call - the model has to reload each run - so if you're hammering it for batch runs, you'll feel the reload tax and may want it off. And a local LLM picking resolution is not magic: mistral is a general-purpose model, and its "cinematic" judgment is only as good as the composition info in your prompt. If your prompts are terse tags, the pick will be approximate.
Inputs (5)
| Name | Type | Default | Description |
|---|---|---|---|
| prompt | STRING | The image prompt. Wire from your prompt node. The LLM picks the best resolution for it. | |
| model | STRING | mistral | Ollama model to use. Should match what's loaded on the remote machine. |
| batch_size | INT | 11β64 | β |
| fallback | COMBO | 1536 Γ 1536 | Resolution used if the LLM is unreachable or returns garbage. |
| unload_after | BOOLEAN | true | Unload the model from VRAM immediately after each call. Frees ~35% VRAM for Anima and the Detailer. Disable if you are doing rapid repeated runs and can spare the VRAM. |
Outputs (4)
| Name | Type | Description |
|---|---|---|
| latent | LATENT | Empty latent at the chosen resolution. |
| w | INT | Width in pixels. |
| h | INT | Height in pixels. |
| resolution | STRING | The resolution string that was chosen (e.g. '1344 Γ 1728'). |