Nodes/ComfyUI-Taylor-Attention/Flux2TTRTrainingParameters
ComfyUI Node

Flux2TTRTrainingParameters

One Config Node to Rule Both Training Phases

By ttulttul·Created 8 months ago·Updated 7 months ago· 1
Flux2TTRTrainingParameters
    • training_config
    ◄rmse_weight1.000►
    ◄cosine_weight1.000►
    ◄lpips_weight0.000►
    ◄dreamsim_weight0.000►
    ◄hps_weight0.000►
    ◄biqa_quality_weight0.000►
    ◄biqa_aesthetic_weight0.000►
    ◄gemini_similarity_weight0.000►
    ◄gemini_quality_weight0.000►
    ◄gemini_modelgemini-3-flash-preview►
    ◄gemini_api_key►
    ◄gemini_api_key_envGEMINI_API_KEY►
    ◄reward_baseline_quality_floor-0.300►
    ◄huber_beta0.0500►
    ◄learning_rate0►
    ◄grad_clip_norm1.000►
    ◄alpha_lr_multiplier5.000►
    ◄phi_lr_multiplier1.000►
    ◄target_ttr_ratio0.700►
    ◄lambda_eff1.000►
    ◄lambda_entropy0.100►
    ◄gumbel_temperature_start1.000►
    ◄gumbel_temperature_end0.500►
    ◄warmup_steps0►
    ◄comet_enabledfalse►
    ◄comet_api_key►
    ◄comet_project_namettr-distillation►
    ◄comet_workspace►
    ◄comet_experimentc6376d52026072021405003308600636►
    ◄log_every10►

    Flux2TTRTrainingParameters doesn't train anything itself - it's the shared config bag that both training phases read. You dial in the loss weights, optimizer settings, and Comet logging once, and it emits a TTR_TRAINING_CONFIG wire that feeds Flux2TTRControllerTrainer (required there) and Flux2TTRTrainer (optional there). One set of hyperparameters across Phase 1 and Phase 2 is the whole point: the distillation and the controller are trained against the same numbers, and you don't have to keep two workflows in sync by hand.

    The inputs that matter

    For a first run, the inputs that actually matter are a small handful:

    • rmse_weight and cosine_weight - both default 1. These are the workhorse quality terms in controller training.
    • Everything else starts at 0: lpips_weight, dreamsim_weight, hps_weight, biqa_quality_weight, biqa_aesthetic_weight, gemini_similarity_weight, gemini_quality_weight. Raising any of them pulls in that scorer - a heavy dependency (pyiqa, hpsv2, dreamsim) or, for the Gemini terms, the Google API.
    • target_ttr_ratio (0.7), lambda_eff (1), lambda_entropy (0.1) - the reward-shaping knobs for the controller. target_ttr_ratio is the fraction of eligible layers you want routed to the fast TTR path.
    • learning_rate (1e-4), grad_clip_norm (1), huber_beta (0.05) - optimizer and Phase-1 loss settings.
    • comet_enabled - defaults to false, so you're not shipping runs to a cloud dashboard unless you flip it.

    Gemini, only if you ask for it

    The Gemini angle deserves a callout, because it's easy to misread. The node has gemini_model (default gemini-3-flash-preview), gemini_api_key, and gemini_api_key_env (default GEMINI_API_KEY), but with both gemini weights at zero the trainer never calls the API. You only need a key when you raise gemini_similarity_weight or gemini_quality_weight - and those calls cost real money, image-by-image. The key field is a plaintext string sitting in your workflow JSON, so think twice before sharing a workflow with a key baked in. Better: leave it empty and set the GEMINI_API_KEY env var.

    Output is a single training_config (TTR_TRAINING_CONFIG), which is what you wire into the trainer nodes.

    It's a config node, so there's nothing to get wrong at runtime - the failure modes live in whatever trainer you feed it to. The one genuine trap is the optional quality scorers. The pack's installer (via uv pip install -e custom_nodes/ComfyUI-Taylor-Attention, or bash install_requirements.sh /venv/main) handles pyiqa, hpsv2, and dreamsim, but image-reward is explicitly not installed by default because it pins an old timm that breaks pyiqa. If a tutorial tells you to add it, don't.

    Installing and gotchas

    Install the pack through ComfyUI Manager (search "Taylor-Attention") or clone it into custom_nodes, then restart and run the dependency install above. Note the README's one-liner still names the old folder ComfyUI-Approximate-Attention - use the folder you actually cloned. No model files are downloaded; the checkpoints end up under ComfyUI/models/approximate_attention/. This is a research pack with essentially zero community footprint and everything flagged experimental - treat the defaults as the author's best guess and tune from there.

    Categoryadvanced/attention

    Inputs (30)

    NameTypeDefaultDescription
    rmse_weightFLOAT1.0000–1000—
    cosine_weightFLOAT1.0000–1000—
    lpips_weightFLOAT0.0000–1000—
    dreamsim_weightFLOAT0.0000–1000—
    hps_weightFLOAT0.0000–1000—
    biqa_quality_weightFLOAT0.0000–1000—
    biqa_aesthetic_weightFLOAT0.0000–1000—
    gemini_similarity_weightFLOAT0.0000–1000—
    gemini_quality_weightFLOAT0.0000–1000—
    gemini_modelSTRINGgemini-3-flash-previewGemini model used for image-to-image quality scoring when Gemini weights are enabled.
    gemini_api_keySTRINGOptional Gemini API key value. If empty, gemini_api_key_env is used.
    gemini_api_key_envSTRINGGEMINI_API_KEYEnvironment variable name that holds the Gemini API key.
    reward_baseline_quality_floorFLOAT-0.300-10–1Clamp floor for reward-baseline EMA updates in controller training.
    huber_betaFLOAT0.05000.000001–10—
    learning_rateFLOAT01e-7–1—
    grad_clip_normFLOAT1.0000–100—
    alpha_lr_multiplierFLOAT5.0000–100—
    phi_lr_multiplierFLOAT1.0000–100—
    target_ttr_ratioFLOAT0.7000–1—
    lambda_effFLOAT1.0000–100—
    lambda_entropyFLOAT0.1000–1—
    gumbel_temperature_startFLOAT1.0000.0001–10—
    gumbel_temperature_endFLOAT0.5000.0001–10—
    warmup_stepsINT00–1000000—
    comet_enabledBOOLEANfalse—
    comet_api_keySTRING—
    comet_project_nameSTRINGttr-distillation—
    comet_workspaceSTRING—
    comet_experimentSTRINGc6376d52026072021405003308600636Comet experiment key. Use a stable value to keep logging to one persistent experiment.
    log_everyINT101–1000000—

    Outputs (1)

    NameTypeDescription
    training_configTTR_TRAINING_CONFIG—