Nodes/ComfyUI-WorkflowGenerator/2. NodeValidator (Optional)
ComfyUI Node

2. NodeValidator (Optional)

The Referee That Stops Your Generated Workflow from Being Full of Ghost Nodes

By DanielPFlorian·Created 9 months ago·Updated 9 months ago· 41
2. NodeValidator (Optional)
    • workflow_edges (refined)
    • llm_prompts (debug)
    • candidate_nodes (debug)
    instruction
    workflow_edges
    use_llm_refinementfalse
    refine_model_pathQwen2.5-7B-Instruct-q8_0.gguf
    embedding_model_pathparaphrase-multilingual-MiniLM-L12-v2
    catalog_directorycatalog
    dtypeauto
    device_preferenceauto
    attn_implementationauto
    auto_gpu_layerstrue
    n_gpu_layers-1
    max_new_tokens4096
    context_size4096
    use_mmaptrue
    use_mlockfalse
    n_batch512
    n_threadsAuto
    temperature0.95
    top_k5
    top_p0.70
    seed0

    The middle stage of the WorkflowGenerator chain - labeled "2. NodeValidator (Optional)" - and the one that deserves its "optional" tag more than any other node in the pack. Step 1's language model is trained on roughly 13,000 workflows from a 2024-era snapshot of the ecosystem, so it will happily write down node names that either don't exist or don't exist on your machine. NodeValidator is the referee that checks every name in the diagram against the catalog of what's actually installed and corrects the misses. It's the difference between a generated workflow that loads and one that opens as a wall of "unknown node" errors.

    How it works: two modes

    The node runs in two modes, and the default is the smart one.

    Semantic search only (use_llm_refinement off - the default). Every node name in your diagram gets embedded with a sentence-transformers model (paraphrase-multilingual-MiniLM-L12-v2, a small multilingual embedding model) and compared against the names in your node catalog using cosine similarity. For each miss it proposes up to top_k (default 5) candidates. This is how "Load Image" becomes "Image Loader" and "Text Encode" becomes "CLIP Text Encode (Prompt)". It's fast, deterministic, and runs fine on CPU - no LLM needed.

    LLM refinement (use_llm_refinement on). For the misses that semantic similarity can't confidently fix, it loads a Qwen2.5-7B-Instruct model (GGUF, also q8_0) and asks the LLM to pick the right node, optionally using your original instruction as context. Slower - it's a second model load and second inference pass - but noticeably more accurate on ambiguous names. You only need the 7B model file if you enable this; semantic-only mode works without it.

    Both modes need the catalog files (node_list.json + node_info.json), which is why the pack insists you run UpdateNodeCatalog first.

    Inputs and outputs

    • workflow_edges - the diagram from Step 1. Required.
    • instruction - optional context for LLM refinement. Wire the instruction output of WorkflowGenerator here, or add your own guidance ("use the Wan video nodes").
    • use_llm_refinement - the big toggle. Off = fast semantic search; on = slower but sharper.
    • top_k - how many candidate nodes to consider per miss.
    • embedding_model_path - defaults to the MiniLM model in models/LLM/.
    • catalog_directory - where the catalog lives; catalog by default.

    Outputs: workflow_edges (refined) (the corrected diagram - wire this into WorkflowBuilder), plus two debug outputs, llm_prompts and candidate_nodes, which show you what was sent to the LLM and which nodes it considered. Ignore those unless you're debugging.

    Install and the honest caveats

    Same pack install as the others: clone into custom_nodes, pip install -r requirements.txt, and drop the embedding model (and optionally the 7B validator GGUF) into ComfyUI/models/LLM/. The embedding model is a sentence-transformers download, a few hundred MB - nothing like the 14B generator.

    Two things worth knowing. First, semantic search fixes names, not signatures - it can match a plausible-looking node that exists but has completely wrong input/output types, and the builder will then quietly skip those edges. Second, its knowledge is bounded by your catalog: if you installed a new custom node pack and never re-ran UpdateNodeCatalog, the validator can't know about it. That stale-catalog trap is the #1 cause of "it still generated wrong nodes" complaints. If validation feels weak, update the catalog before you flip on the 7B model - usually the cheaper fix. And if you're on a small GPU or just impatient, remember this whole stage is optional: you can wire Step 1 straight into Step 3 and accept the ghost nodes.

    CategoryWorkflowGenerator

    Inputs (21)

    NameTypeDefaultDescription
    instructionSTRINGOptional context for LLM refinement. Connect 'instruction' output from Step 1 or add your own instructions to guide refinement.
    workflow_edgesSTRINGInput diagram from Step 1 (WorkflowGenerator).
    use_llm_refinementBOOLEANfalseEnable LLM-based correction for better accuracy (slower). False uses only semantic search.
    refine_model_pathCOMBOQwen2.5-7B-Instruct-q8_0.ggufLLM model for refinement (if enabled).
    embedding_model_pathCOMBOparaphrase-multilingual-MiniLM-L12-v2Embedding model for semantic search.
    catalog_directorySTRINGcatalogDirectory containing node catalog files.
    dtypeCOMBOautoData type for refinement model (HuggingFace).
    device_preferenceCOMBOautoDevice preference for refinement model.
    attn_implementationCOMBOautoAttention implementation (HuggingFace).
    auto_gpu_layersBOOLEANtrueAuto-calculate GPU layers based on available VRAM (prevents OOM errors) (GGUF).
    n_gpu_layersINT-1-1–1000Number of GPU layers (GGUF). -1 for all.
    max_new_tokensINT40961–16384Max tokens for refinement.
    context_sizeINT4096512–32768Context window size (GGUF).
    use_mmapBOOLEANtrueUse memory-mapped loading (GGUF).
    use_mlockBOOLEANfalseLock memory to prevent swapping (GGUF).
    n_batchINT51232–2048Batch size for prompt processing (GGUF).
    n_threadsCOMBOAutoCPU threads for inference (GGUF).
    temperatureFLOAT0.950–2Sampling temperature.
    top_kINT51–20Number of similar nodes to consider.
    top_pFLOAT0.700–1Top-p sampling.
    seedINT00–4294967295Random seed.

    Outputs (3)

    NameTypeDescription
    workflow_edges (refined)STRINGRefined workflow diagram with corrected names.
    llm_prompts (debug)STRINGPrompts sent to LLM (debug).
    candidate_nodes (debug)STRINGCandidate nodes found (debug).