Files
olivv-cs-ComfyUI-FunPack/docs/FunPackGemmaEmbeddingRefiner.md
T

7.1 KiB

FunPack Video Refiner

This node analyzes the positive conditioning produced by your text encoder, tracks your feedback over time, and nudges the conditioning toward directions that should score higher in future generations. It also has optional sigma and latent refinement paths for video workflows.

Parameters

positive_conditioning: Conditioning to refine. Place this node after your text encoder and before the downstream video conditioning node.

mode: Tokenizer mode used for prompt analysis. Use ltx2 for LTX-style workflows and wan for Wan workflows.

rating: Rating for the previously generated result, from 1 to 10, where 1 means "awful" and 10 means "masterpiece".

refinement_key: Name of the refinement session. The node stores its learned refinement data under this key so you can continue training the same style later.

scheduler_mode: Learning behavior preset. original keeps the legacy behavior, while accurate and aggressive adjust how strongly the node updates the refinement.

positive_prompt: Optional prompt text used for token analysis and concept-level feedback.

If you want the model to preserve speech or spoken lines, wrap that text in " or “ ”. Quoted text is treated as one protected phrase during prompt analysis, so dialogue like "You should go for it, young man." stays intact. If speech is not quoted, common words inside it can still be treated as low-value prompt words and may be omitted or ignored.

sigmas: Optional input sigma schedule to co-refine alongside the conditioning. When connected, the node preserves the first and last sigma exactly and only adjusts the middle values.

sigma_strength: Preset strength for sigma refinement. off disables sigma changes, while subtle, medium, strong, and max allow progressively larger movement of the middle sigma values.

reset_session: If enabled, clears the saved training history for the selected refinement key and starts a fresh session.

unlimited_history: If enabled, disables history pruning.

seed: Seed used for exploration behavior during refinement.

feedback_enabled: If enabled, the node can return a concept-focused feedback question alongside the refined conditioning.

feedback_rating: Answer to the feedback question on its own 1 to 6 scale. This is only useful when concept feedback is enabled.

lora_stack: Optional stack from FunPack LoRA Loader. The refiner uses it to save next-run model LoRA weight suggestions.

latent: Optional latent input. It is only used when the refined_latent output is also connected. If no saved latent exists yet, the node uses the connected input latent as the current reference.

Outputs

modified_positive: Refined conditioning. Connect this output to the next conditioning stage in your workflow.

status: Short general node state summary. Use this to quickly see whether the refiner is learning well, what it is focused on, and which subsystems are active.

feedback_question: Optional concept feedback prompt generated by the node when feedback mode is active.

training_info: Detailed training diagnostics for the current refinement step, including exact metrics, concept breakdown, LoRA suggestion details, and sigma/latent refinement details.

loss_graph: Graph image showing learning loss over total session iterations for the current refinement key.

refined_sigmas: Refined sigma schedule. If no sigmas input is connected, this output is empty.

refined_latent: Refined latent output. Connecting this output enables latent refinement logic; leaving it disconnected disables latent refinement even if the latent input is connected.

Purpose

Use this node when you want to iteratively tune prompt conditioning based on your own ratings instead of manually rewriting prompts every time. Over multiple runs, it builds a refinement profile for the selected refinement_key.

Latent Refinement

Use FunPack Save Refinement Latent to store a reference latent tensor bundle under a refinement_key and tokenizer mode. When FunPack Video Refiner later receives a latent input with the same key and mode, it loads that saved latent and applies a small rating-driven adjustment to the latent output.

For LTX audio/video workflows, the latent path must use video latents only:

  • Split sampler output with LTXVSeparateAVLatent.
  • Send the video latent output to FunPack Save Refinement Latent.
  • Send the plain video latent to FunPack Video Refiner latent input.
  • Send FunPack Video Refiner refined_latent to LTXVConcatAVLatent video_latent.
  • Send the original audio latent to LTXVConcatAVLatent audio_latent.

Do not connect the combined AV latent from LTXVConcatAVLatent, the sampler AV output, or the audio latent to this node. Those use LTX nested/audio latent structures and are intentionally rejected with a clear error.

Some LTX separated video latents keep type: audio metadata even after LTXVSeparateAVLatent; the node accepts those when their samples tensor is the 5D video tensor shape.

Latent refinement follows the connection state exactly:

  • If the latent input is disconnected and refined_latent is disconnected, latent tweaking is disabled.
  • If the latent input is disconnected, refined_latent is connected, and no saved latent exists, the node errors with: No available latent to operate. Please connect reference latent to input of Video Refiner.
  • If the latent input is disconnected, refined_latent is connected, and a saved latent exists, the node reports: Running refinement on saved latent. Changing reference latent shape and size will cause no effect to generation.
  • If the latent input is connected and refined_latent is disconnected, latent tweaking is disabled.
  • If both latent input and refined_latent are connected but no saved latent exists, the node passes the input latent through unchanged and saves it as the current reference.
  • If both are connected and the saved latent shape does not match the current input, the node rewrites the reference and passes the current input through unchanged.
  • If both are connected and the saved latent shape matches the current input, the node tweaks the latent using the connected input as the base and the saved latent as the learned reference. The refined tensor is bounded to the current/reference value range to avoid out-of-range latent values.

Resetting the session deletes the saved latent reference too.

Latent refinement is intentionally conservative. It tracks latent shape changes in the session state and leaves zero-valued latent positions unchanged because zero values can be intentional.

Capability Boundary

This node cannot make the underlying model generate concepts it does not already know how to represent. If a required subject, action, style, object, anatomy detail, or relationship is missing from the model's learned capabilities, repeating ratings will not teach it from scratch.

The refiner can only adjust the strength, balance, stability, and emphasis of concepts that are already present in the model's output space. Use model choice, LoRAs, ControlNet/reference tools, better source images, or prompt changes when a concept is absent rather than merely under-weighted.