Fooocus V2 Expansion
Your prompts are too short — this is the GPT-2 Fooocus hid behind its V2 style
- expanded_prompt
- seed
If you ever used Fooocus, you've already seen this node work - you just couldn't see what it was doing. Fooocus hid a small GPT-2 behind its "Fooocus V2" style that silently rewrites your two-word prompt into a wall of quality adjectives, and that hidden trick is a big chunk of why Fooocus outputs looked punchier than the same prompt typed raw into A1111. This pack drags that exact algorithm out into ComfyUI where you can finally see it, wire it, and steer it.
And yes: it runs fully locally. No API, no key, no cloud call. It's a 350MB model that lives on your disk.
How it works
The heavy lifting is done by LykosAI's GPT-Prompt-Expansion-Fooocus-v2, a GPT-2 fine-tuned for this one job. The node loads it through ComfyUI's own model_management, so it lands on your text-encoder device (GPU if you have one, fp16 if that's appropriate) and behaves like any other model ComfyUI manages.
The interesting part is the constraint. The pack ships a positive.txt whitelist of ~900 positive-sounding words, and builds a logits bias that sets every token not in that list to negative infinity. So the model physically cannot emit "mud" or "grimy" - it can only produce phrases like highly detailed, masterpiece, best quality, intricate, elegant. Your prompt gets a comma appended, the model generates a suffix, and out comes the familiar Fooocus wall of qualifiers. The generation is deterministic for a given seed, which is the whole ballgame for reproducibility.
The inputs and outputs that matter
You'll actually touch two fields, maybe three:
- positive_prompt - the only required input, and the one you set. Type whatever you'd normally type into a text encoder.
- prompt_seed - defaults to
-1, which means "roll a random one". The seed picks which expansion you get, so this is your dice. - seed_behavior -
Randomgives you a fresh expansion every run.Fixedkeeps one. The two "Forward Prompt Seed" modes carry the seed out to the rest of the graph so your sampler and your expansion stay in sync.
One genuine trap: with double_prompt off (the default), the expanded_prompt output is only the generated suffix - it does not include your original prompt. Fooocus appends the suffix internally; here you have to either flip double_prompt to true or feed your original prompt into the positive conditioning yourself. People get burned by this and see a conditioning that's pure adjective soup.
The outputs are expanded_prompt (STRING, wire it into a CLIPTextEncode) and seed (INT, wire it into your KSampler if you want one seed to rule the whole run).
Installing it
ComfyUI Manager → Install Custom Nodes → search ComfyUI-Fooocus-V2-Expansion, install, restart. The README warns that an older install named fooocus-v2-expansion exists and should be deleted - check you don't have both loaded, because they'll clash.
Prefer the manual route:
cd ComfyUI/custom_nodes
git clone https://github.com/PanicTitan/ComfyUI-Fooocus-V2-Expansion.git
Restart ComfyUI after either install. There's no requirements.txt - the pack leans on the torch and transformers that ship with ComfyUI, which is exactly why it's painless.
The gotchas
- The 351MB download. The pack pulls
pytorch_model.binfrom HuggingFace the first time ComfyUI starts with it loaded (the README says "first use" - either way, it happens once). It caches into the pack's ownfooocus_expansion/folder insidecustom_nodes, not intoComfyUI/models, so don't go hunting for it in a model manager. - It re-rolls every queue. The node marks itself always-dirty, so with
Randombehavior you get a different expansion on every run - great for exploration, annoying when you're chasing a specific image. Setseed_behaviortoFixedand wire theseedoutput forward if you need reproducibility. - The flavor is SDXL. The whitelist was tuned for SDXL-era positives. It works fine as text on Flux or Pony, but the output reads like classic 2024 SDXL quality-spam, not modern prompt style.
- The bundled example workflow wants ComfyUI-Easy-Use, ComfyUI_Comfyroll and optionally Crystools - but those are for the demo graph only. The node itself is self-contained.
One caveat on expectations: this expands your positive prompt, full stop. Your negatives pass through untouched, and it won't write a scene description from nothing - give it "a photo of a cat", get back a much longer, punchier "a photo of a cat". That's the deal, and for SDXL workflows it's a good one.
Inputs (6)
| Name | Type | Default | Description |
|---|---|---|---|
| positive_prompt | STRING | — | |
| prompt_seed | INT | -1-18446744073709550000–18446744073709550000 | — |
| seed_behavioropt | COMBO | Random | 4 options: Random, Fixed, Forward Prompt Seed, Random Forward Prompt Seed |
| expandopt | BOOLEAN | true | — |
| logopt | BOOLEAN | true | — |
| double_promptopt | BOOLEAN | false | — |
Outputs (2)
| Name | Type | Description |
|---|---|---|
| expanded_prompt | STRING | — |
| seed | INT | — |