Commit Graph
237 Commits
Author SHA1 Message Date
digital-garbageandClaude Opus 4.8 480e3620a1 Temporal styles: automatic per-scene 'auto' director (heuristic baseline)
Adds temporal_style='auto': Studio classifies each scene's prompt for motion
energy and bakes a continuous frame_rate multiplier into that scene's
conditioning metadata; the Scene Chain Sampler applies it per scene via a
layered model_function_wrapper (composes with embed guidance, restored in
install order). Concrete styles keep the global build_enhancements path
unchanged.

- ltx_enhancements: TEMPORAL_STYLES gains 'auto'; single-source TEMPORAL_STYLE_MULT
  table; classify_temporal_intent() keyword director (energy->punchier mult<1,
  stillness->hold mult>1, loop flag); factored make_temporal_wrapper() shared by
  global + per-scene paths; build_enhancements skips the global wrapper for auto.
- conditioning: _v2_apply_auto_temporal() bakes funpack_temporal_mult/label/loop
  into each entry inside the single finalize hook; both refine_v2 returns pass
  temporal_style + the run prompt as per-scene fallback text. 'auto' added to V2
  node dropdown.
- samplers: _scene_temporal_mult() reader + per-scene temporal wrapper around
  _sample_chunk in the scene loop.
- web: 'auto' in the Studio dropdown + hint text.

Heuristic is the baseline director, structured so a reward-driven override can
replace the multiplier per intent-family later. loop's RoPE coordinate trick is
still unimplemented (inert flag only); auto detects loop intent but does not yet
honor it.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-05 17:58:48 +03:00
digital-garbageandClaude Opus 4.8 88a226da93 Session Reset: clear keyless 'default' bucket + Absolute global store
clear_refinement_data() early-returned on an empty refinement_key, but a
keyless run stores its blessed/attn maps, creativity latent and velocity-bias
trajectories under the 'default' bucket. So a keyless Session Reset no-opped
and those disk-persisted stores survived restart too -- the first fresh run
felt cleaner than every later run. Normalize empty key to 'default' (matching
the write side) so reset actually wipes that bucket.

Also wire the keyless Absolute taste store (FUNPACK_ABSOLUTE_KEY) into reset:
it learns from every rated run regardless of steer_mode but had no clear path,
so it would survive reset + restart forever. Delete its state json + value fn
on reset_session.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-05 17:35:59 +03:00
digital-garbageandClaude Opus 4.8 e4a74dc3b9 Interactive Guessing: make noise-seed freezing optional
Add guess_freeze_seed (default True) threaded refine_v2 -> _v2_pack_batch
-> _v2_pack_guess_ladder and the Studio refine_v2 call. Frozen = every rung
shares one seed (only conditioning strength varies; cleanest for learning).
Off = distinct seed per rung (varied compositions too). New "Freeze seed"
toggle in the Interactive Guessing config; persisted on Arm.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-04 15:48:01 +03:00
digital-garbageandClaude Opus 4.8 c8e4f2c404 Interactive Guessing: UI trigger + Phase-3 learning & dual auto-cap
UI: Batch Training tab gains Mode (Regular / Interactive Guessing),
Direction, Range, and a Learning toggle; Arm sets refiner.guess_* +
batch_learning; auto-disarm clears guess_mode; rating list shows each
rung's [x factor]; Submit passes the learn flag.

Learning (batch_training.py): submit honors learn=false (pure generation,
no training). Guess batches detected via guess_factor -> _learn_guess_ceiling
finds the furthest-pushed acceptable rung before quality broke and stores a
per-key safe ceiling (absolute spread + factor) via _store_guess_ceiling.

Dual auto-cap (refine_v2, normal runs only): soft pre-limit on
absolute_strength + hard clamp of the output conditioning's video-channel
spread to the learned-safe value in _v2_finalize_conditioning. Skipped
during the guessing ladder itself. Helpers conditioning_spread /
scale_conditioning_spread.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-04 15:35:58 +03:00
digital-garbageandClaude Opus 4.8 7a6821930a Interactive Guessing engine: conditioning-spread ladder (Phase 2)
New variant producer for Batch Training that, instead of seed/shortcut
variation, scales the conditioning's spread (sigma) on VIDEO channels by a
linear ramp across N rungs, freezing everything else including the noise
seed so the only variable is conditioning strength. Up amplifies toward
overbake, down dampens. Each rung records funpack_guess_factor (in cond
meta + batch manifest) so the ladder is interpretable and Phase-3 learning
can read each rung. Audio channels untouched (scale_conditioning_spread
reuses the LTXAV channel split). Wired refine_v2 -> _v2_pack_batch
(guess_mode branch -> _v2_pack_guess_ladder) and the Studio refine_v2 call
(guess_mode/direction/range from refiner settings).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-04 15:27:30 +03:00
digital-garbageandClaude Opus 4.8 ef04c21a5a Stack latent normalization onto Hybrid + Distilled samplers (opt-in)
Reuse _normalize_video_denoised in _sample_const_rf_full (Hybrid CONST/RF
path) and sample_funpack_distilled_flow: new normalize_strength /
normalize_start_sigma (default 0 = off). Applied to the denoised after
rescue/quality-sharpness, video-only, so audio is never touched and the
samplers keep AB2/Heun/velocity/rescue. Wired node INPUT_TYPES (appended)
-> get_sampler -> Studio _build_one_sampler + JS panels for both.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-04 15:11:10 +03:00
digital-garbageandClaude Opus 4.8 49e7517389 Add FunPack Normalizing Sampler (video-only latent normalization)
New SAMPLER for distilled LTXAV at CFG=1: deterministic 1st-order euler
base (clean ddim look + clean audio) plus per-step video-only latent
normalization to counter overbaking / oversaturation / colour drift at
~zero overhead. Tracks the video latent's robust spread, anchors a
reference once x0 is meaningful (normalize_start_sigma), and compresses
inflated later steps (normalize_strength). Benefit-only, no-op when
healthy, audio never touched (whole-latent for single-stream LTXV).
Velocity bias + rescue included, video-only.

Node FunPackNormalizingSampler + Studio sampler option ("Normalizing")
wired through _build_one_sampler and the JS panel. Registered in __init__.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-04 12:07:39 +03:00
digital-garbageandClaude Opus 4.8 951c61953d Distilled Flow: graduated 2nd order (AB2 ramp, opt-in)
Instead of full AB2 on every step, optionally ramp the AB2 contribution
linearly 0->1 across the schedule: denoised_eff = lerp(raw, ab2, i/(N-1)).
Early/high-sigma steps stay near 1st-order euler (less overshoot); late
steps get full AB2. Reuses the computed AB2 estimate -> no extra model
evals. Aimed at low-step distilled quality. No-op at order=1; audio still
rides plain euler. Wired node -> get_sampler -> Studio panel (+ JS toggle).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-04 11:42:25 +03:00
digital-garbageandClaude Opus 4.8 ee66e4ec1e Report audio split on every Absolute steer (not once per process)
The conditioning-dim diagnostic logged once per process via _FUNPACK_AV_LOGGED,
so after the first generation it went silent — easy to read as "it never ran".
Fold the detected split into the per-run "Absolute steer applied" line so every
generation states whether audio is PROTECTED (video[:v] of D) or NOT split
(unrecognised width -> steering all channels, audio unprotected). Makes the
no-op case visible instead of silent.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-04 10:48:22 +03:00
digital-garbageandClaude Opus 4.8 dd8da50153 Audio-safe conditioning steering on LTXAV (video-only channel-slice)
LTXAV splits one conditioning tensor into video|audio channel-slices
(av_model _prepare_context: torch.split(context,[v_dim,a_dim],-1)) and
cross-attends each stream to its own slice. Steering the whole tensor
corrupted the audio's text conditioning -> degraded audio (observed live).

Add protect_audio_channels: restore the audio channel-slice from the
unsteered conditioning so every edit moves video only. Applied at all
steering chokepoints:
- _v2_apply_conditioning_memory (per-prompt: liked/axis/concept/vf-grad)
- _v2_apply_absolute (global taste pull)
- _v2_ascend_conditioning (relative VF ascend+search)
- attn2 K/V direction patch + phrase emphasis
- FunPackConditioningAdjust (manual)
- sampler embed_guidance wrapper + per-scene VF ascend

Split auto-detected from width (7680->3840, 6144->4096); logs once.
Single-stream LTXV / unknown width = no-op (no regression).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-04 10:34:08 +03:00
digital-garbageandClaude Opus 4.8 c823d5bf3e Refiner V2 + Studio: add Absolute / Relative steer mode
Relative (default, unchanged) = per-prompt steering. Absolute = a keyless,
prompt-agnostic "global taste" prior that pulls conditioning toward generally-
liked directions regardless of the prompt; Both layers them.

- New keyless Absolute store (FUNPACK_ABSOLUTE_KEY): pooled liked/disliked
  direction + global value function, learned across every rated generation.
- Absolute rating semantics: a rating means "details I like in general" (not
  prompt adherence) — reward-driven liked/bad-dir storage, axis attribution
  bypassed. Perfect = "more of this everywhere".
- _v2_finalize_conditioning replaces the per-key ascend hook on both returns;
  pure Absolute also bypasses per-prompt conditioning memory.
- Scene Chain sampler: embed_guidance_source (relative/absolute) lets the
  per-step nudge draw from the global direction/value function.
- Studio popup + V2 node expose Steer mode + Absolute strength.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-04 10:06:56 +03:00
digital-garbage ea602f9de0 Revert "Distilled Flow: add Karras stochastic churn (zero-overhead variability)"
This reverts commit b47452e76e7fdfb8204051f2888d95d85e60816c.
2026-06-04 02:02:59 +03:00
digital-garbageandClaude Opus 4.8 e56dcf2c39 Distilled Flow: add Karras stochastic churn (zero-overhead variability)
Adds s_churn/s_tmin/s_tmax to sample_funpack_distilled_flow: optionally
re-noise the latent within [s_tmin, s_tmax] before each eval, then denoise
from the bumped sigma_hat. No extra model calls (still one eval per step,
at a higher noise level). Fights stale/frozen distilled output (more motion)
and can sharpen by letting the model re-resolve. sigma_hat is clamped to the
schedule start so the model never sees a higher-than-trained noise level, the
final jump-to-zero detail step is never churned, and the default 0.5-1.0 band
protects the sub-0.4 detail finish per the empirical sigma findings.

Churn supersedes the legacy s_noise ancestral path while active and is
video-stream-only on packed LTXAV latents. With s_churn=0 the sampler is
byte-identical to the previous deterministic ODE. Wired into the node and
Studio's Distilled Flow config panel.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-04 01:54:36 +03:00
digital-garbageandClaude Opus 4.8 40fe867dac Distilled Flow sampler: velocity bias + reactive rescue
Port the Hybrid/RF velocity-bias capture/apply and rating-gated reactive
rescue into sample_funpack_distilled_flow, reusing the shared trajectory
memory helpers. Adds velocity_bias_mode/strength/source/key and
rescue_mode/threshold/strength to the FunPackDistilledFlowSampler node and
wires them into Studio's Distilled Flow config panel (same blank/'default'
velocity-key -> refinement-key fallback as Hybrid). Steering is
magnitude-preserving and, on packed LTXAV latents, video-stream only
(audio-safe). With all controls off the sampler is byte-identical to the
previous deterministic ODE.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-04 01:42:04 +03:00
digital-garbageandClaude Opus 4.8 aa4a7f643c Batch Training: remove debug diagnostics; bump version to 2.7.7
Batch Training confirmed working end to end (controlled batch with transitions, distinct
per-variant seeds, node rating ignored during a batch, per-entry rating + VF/axis learning
on submit). Stripped the temporary trace prints (Batch Training check / Batch check / ACTUAL
scene seeds), keeping clean progress logs. Gitignore the local .testvenv.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-03 00:29:11 +03:00
digital-garbageandClaude Opus 4.8 ad9e171e4f Batch Training: distinct per-variant seeds in the SINGLE-scene path too (real cause of identical videos)
The live log showed the single-scene path: 'packed 3 variant conditioning(s)' with ACTUAL
scene_seeds identical across all 3 (all inherited the base entry's funpack_scene_seed). My
earlier seed fix only covered the multi-scene duplication path. When a prompt resolves to one
scene (common), _v2_build_batch_variants reused the base scene seed for every variant ->
identical noise -> identical videos (only tiny diffs from VF ascent).

Fix: _v2_pack_batch now assigns a fresh, well-spread per-variant scene seed (gen-seeded RNG,
reproducible, per-scene offset) to the packed entries in BOTH paths, after building them.
Verified in venv: single-scene 3 variants -> 3 distinct seeds.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-03 00:18:16 +03:00
digital-garbageandClaude Opus 4.8 7ff60f7a9d Batch Training: distinct per-variant seeds + ignore the node rating during a batch
1) All batch videos identical: in the transition path each scene carries a
   'funpack_scene_seed' the sampler honors over its own seed, so duplicating the scene-set
   left every variant with the same seeds. _v2_pack_batch now assigns DISTINCT per-variant
   scene seeds via a gen-seeded RNG (well-spread, reproducible per gen). Verified in venv:
   4 variants -> 4 distinct seed sets, reproducible.

2) Ignore the node's rating widget while a batch generates: that selection would apply
   learning to the PREVIOUS run, but it's stale during a batch (the batch is rated afterward
   in the panel). When batch_variants>1, force rating to '-Just forget it-' (skip_learning),
   so all learning paths (phrase/conditioning-memory update, VF training, velocity commit)
   are skipped. Conditioning APPLICATION still runs (it has no skip_learning guard), so the
   batch still uses the learned directions.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-03 00:01:13 +03:00
digital-garbageandClaude Opus 4.8 efe6b33881 Batch Training: fix — works WITH split_by_transitions (the real cause of single-pass)
Root cause (found via the diagnostics + the venv tests): the producer was gated on
'not split_by_transitions', but the user's workflow is multi-scene chains, so with
transitions on the producer never ran -> no variant markers -> sampler did one pass.

Fix: defer variant packing to the FINAL conditioning, applied right before BOTH returns
(the transition early-return and the normal return), so it wraps whatever output ends up
being. New _v2_pack_batch dispatcher: single-scene output -> _v2_build_batch_variants
(shortcut variants); multi-scene output (transition split) -> duplicate the whole scene
set per variant (seed-only). Each variant tags ALL its scene entries with the same index,
so the sampler groups by marker into N full chains and keeps variants independent.

Verified in the test venv: 3-scene set x 4 -> 12 entries, markers [0,0,0,1,1,1,2,2,2,3,3,3]
-> sampler sees 4 groups of 3 scenes; a single-variant group returns None (chains normally,
no recursion). Marker detection + producer round-trip all green.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-02 23:51:10 +03:00
digital-garbageandClaude Opus 4.8 3ae8238141 Batch Training: add diagnostics to trace why a batch isn't activating
Prints (a) the batch_variants value + mode flags the refiner sees and how many packed
entries it produced, and (b) the positive entry count + variant markers + group count the
Chain Sampler sees. Pinpoints whether the break is the arm/settings (batch_variants==1 at
the refiner), the conditioning path (markers stripped before the sampler), or the split
logic. Temporary, to be removed once the cause is found.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-02 23:34:57 +03:00
digital-garbageandClaude Opus 4.8 a1ba067d9a Batch Training Phase 3b: deeper learning from batch ratings (axis + direction memory)
Submit now does more than train the value function (3a). New refiner method
_v2_learn_from_batch feeds each rated entry's conditioning through the SAME per-axis
direction-memory machinery as a normal rated run (_v2_update_conditioning_memory →
axis directions + liked/bad direction stores), and tallies axis votes across the batch:
because tokens were frozen, an axis rated missing/wrong in >= half the rated entries is a
high-confidence problem (not seed luck). Those consistent axes are written to
active_repair_axes, which the next generation's repair persists until a Perfect — so a
batch where most gens were 'Missing details' makes the next run boost details.

Wiring: batch submit collects (rating, serialized cond) per rated entry, trains the VF,
then calls _v2_learn_from_batch; the resulting insight ('consistent problem axes = ...')
is returned and shown in the Studio submit toast. List route now also returns each item's
variant index + prompt for the panel.

Batch Training is now complete: seed-only + shortcut variants + node button + VF training
+ axis/direction learning, all human-rated.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-02 18:07:01 +03:00
digital-garbageandClaude Opus 4.8 9fe10533e4 Batch Training: variant producer (Studio) + node button — feature complete end-to-end
Producer (Studio owns conditioning, per the boundary law): refine_v2 gains batch_variants.
When >1, _v2_build_batch_variants packs N conditioning entries into the single positive wire,
each tagged 'funpack_batch_variant'. Variant 0 is the fully-processed base; variants 1..N-1
re-resolve shortcuts with seed+i (random option per entry) and get the same conditioning-memory
treatment, deduped by expansion text. No shortcut variability -> all entries resolve identical
and reuse the base cond -> the batch becomes seed-only (sampler varies the seed per entry).
Captures the pre-shortcut prompt to re-resolve. Not combined with split_by_transitions.

Trigger: a 'Batch Training' button on the Studio NODE (next to Open Studio) — prompts for N,
sets refiner.batch_variants, queues one prompt, then auto-reverts to 1 (one-shot). Studio is
the batch trigger (hub principle); no sampler input needed.

Sampler: now enters batch mode when positive carries variant markers, even if batch_iterations
is 1 (markers are the trigger; variant count wins). Each entry already saves its own cond, so
Submit trains the VF per variant — teaching which prompt variant rated better. Panel hints now
point at the button.

End-to-end: press Batch Training -> N -> Studio makes N variant conds -> sampler samples N ->
previews to temp -> rate in Studio panel -> Submit trains VF per entry -> batch cleared.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-02 18:00:32 +03:00
digital-garbageandClaude Opus 4.8 71c5afc668 Refiner V2: always train value function; value_guidance gates application only, default on
Audit finding: value_guidance defaulted OFF, and it gated value-function TRAINING — so
by default the VF never trained, conditioning ascent + the chain sampler's embed_guidance
were permanently inert, and a user who ran many gens with it off then enabled it started
from zero (no accumulated learning).

Fix decouples learning from application:
- The VF now ALWAYS trains in the background on rated gens (cheap: small MLP, 20 steps,
  no diffusion calls) whenever there's a rated previous run + refinement key. The reward
  asset accumulates regardless of the toggle.
- value_guidance now controls only APPLICATION of the learned direction (output ascent +
  search), via a new apply= param on _v2_ascend_conditioning. Default ON.
- Defaults flipped to True: refine_v2 signature, Studio settings read, JS default +
  migration. Studio toggle relabeled 'Apply value guidance' with corrected help (training
  always on; applies after 10+ ratings; off = strict prompt fidelity, learning still
  accumulates). Fixed stale '5+ ratings' text (MIN_SAMPLES is 10).

Side effect: embed_guidance (chain sampler) now has a trained VF available by default.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-02 16:56:59 +03:00
digital-garbageandClaude Opus 4.8 963198b999 Audit fixes: velocity commit key mismatch, sparse rescue targets, redundant aspect bucket
Three issues found tracing the full Studio path with all features on:

1) BUG (silent data loss): a custom velocity_refinement_key captured trajectories
   under that key but the refiner committed the rating under the effective refinement
   key — so custom velocity keys never learned (banks stayed empty, rescue/velocity a
   permanent no-op). This undercut per-key cut-routing. Fix: Studio resolves each pass's
   velocity key (same logic as _build_one_sampler) and passes them to refine_v2, which
   now commits the verdict to the union of {effective key} + velocity keys (dedup).
   Backward compatible (callers without _velocity_keys behave as before).

2) Effectiveness: VELOCITY_BIAS_TARGETS (0.90, 0.80) matched only sigma~0.909 on the
   standard 8-step LTX schedule, so rescue fired once per gen at a near-noise step and
   never at the detail-forming sigmas. Broadened to (0.90, 0.72, 0.42) -> hits 0.909,
   0.725, 0.422. Velocity APPLY still structure-only (highest target); rescue now acts
   where runs actually go good/bad. (New detail targets fill as gens are rated.)

3) Redundant value: velocity_aspect_bucket was a manual text field never tied to actual
   resolution, and the bank key already includes the full latent shape (which encodes
   resolution) — so it was doubly redundant. Removed from the key, all sampler plumbing,
   INPUT_TYPES, Studio build, and the JS UI/defaults. Persistence loads old stores fine
   (the 'aspect' field is simply ignored; key is now (refkey, target, shape)).

Verified: both py files + JS parse clean; all refactored call signatures aligned.
Tests require the ComfyUI venv (torch) to run.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-02 16:38:31 +03:00
digital-garbageandClaude Opus 4.8 f7acc91570 Velocity-bias anti-softening: magnitude-preserving apply, sigma-decay, quality sharpness, nearest-cluster source
Compensate the slow quality degradation from velocity-bias 'apply' (additive
mean-pull) with four guards on the Hybrid Euler 2S sampler (both eps and
rectified-flow/LTXAV paths):

- B: apply is now magnitude-preserving — rotate x toward (x+delta) and
  renormalize to |x| instead of x+delta, so no energy is injected.
- C: apply fires only at the highest (structure) velocity target and decays
  strength with the sigma ratio; detail sigmas left untouched.
- E: new quality_sharpness knob — temporal-average unsharp on the x0 prediction
  during the quality phase to restore high-frequency detail (free, no extra eval).
  Default 0.0 (off).
- D: new velocity_bias_source = mean|nearest — 'nearest' steers toward the single
  best-matching prompt cluster (one real good gen's detail) instead of the
  washed-out average. Affects both apply and rescue. Default 'mean' (off).

Plumbed through get_sampler/INPUT_TYPES, Studio _build_one_sampler, and the
Studio JS sampler panel (both presets + UI controls).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-02 13:45:55 +03:00
digital-garbageandClaude Opus 4.8 323945fa46 Make rescue rating-gated with separate good/bad trajectory banks
Root cause of "rescued toward an Awful gen": velocity capture was
rating-blind — it wrote every sampled trajectory straight into the one
"good" memory, so a fresh key whose only capture was an awful gen made that
awful run the sole steering target. Ratings (which live in the refiner) never
touched the bank.

Now:
- capture STAGES the current gen's trajectory (VELOCITY_BIAS_PENDING) instead
  of committing it; staging runs whenever rescue is on (no separate capture
  toggle needed).
- the refiner commits the previous gen's staged trajectory by its rating:
  like/loved/nailed -> good bank, awful -> bad bank, everything else dropped.
- rescue steers TOWARD the good bank and AWAY from the bad bank (per prompt
  cluster), firing when diverged from good OR aligned with bad beyond
  threshold; no-op when neither bank has a prompt match.
- session reset / clear_refinement_data now clears good + bad + pending.

velocity-bias "apply" now also reads the rating-gated good bank. Tooltips and
Studio note updated.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-01 19:08:22 +03:00
digital-garbageandClaude Opus 4.8 a69c914c18 Default velocity/rescue memory key to Studio's wired refinement key
The velocity_refinement_key (namespace for trajectory capture + rescue
clusters) was a separate field defaulting to "default", easy to drift out
of sync with the refinement key Studio actually uses. Now when it is blank
or left at "default", Studio resolves it to the effective refinement key
(same resolution as seed memory / refine_v2), so capture and rescue share
one bucket automatically. An explicit non-default value is still respected.
JS hint added on the velocity key field.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-01 18:13:41 +03:00
digital-garbageandClaude Opus 4.8 c111a16991 Make rescue prompt-aware via conditioning-clustered trajectory memory
Rescue previously steered toward a prompt-blind average of all captured
good trajectories, risking false positives that fight a legitimately
different prompt. Now the velocity memory keeps per-prompt clusters: each
tagged with a pooled+normalized conditioning signature. Capture merges into
the nearest cluster (cosine >= 0.92) or starts a new one (cap 8/key, evict
lowest-count). Rescue builds its reference from clusters similar to the
current prompt (cosine >= 0.5, >= 2 matched captures), similarity-weighted;
with no confident prompt match it skips rather than steering to the global
mean. Studio pools its positive conditioning into a signature and threads it
through _build_samplers -> get_sampler -> sampler extra_options. Standalone
node (no conditioning) falls back to the prior global-average behavior.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-01 18:07:27 +03:00
digital-garbageandClaude Opus 4.8 22b0b9c8d7 Expose reactive rescue in Studio Hybrid Euler-2S sampler config
Studio builds its sampler via FunPackHybridEuler2SSampler.get_sampler but
did not pass the new rescue params. Thread rescue_mode/threshold/strength
through _build_one_sampler, add them to the Studio JS hybrid defaults
(high+low) and the sampler config panel, with a note that rescue needs the
velocity-bias memory captured first.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-01 17:58:58 +03:00
digital-garbageandClaude Sonnet 4.6 f2ad55fced Reorder conditioning patches and add VF final gate
New order: positive signals (broad→specific) → negative signals
(broad→specific) → delta cap → VF gate.

Concept-in-context delta moved before bad conditioning repulsion so
positive phrase signal isn't added after negatives are removed.
Pair repulsion stays last among negatives as most targeted.

VF final gate: after all patches + delta cap, if net effect lowered
VF predicted reward by >0.05, linearly roll back toward original
proportionally to how much worse it got (max 75% rollback). Visible
as vf-rollback:X.XX in axis adjustments.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-30 15:53:02 +03:00
digital-garbageandClaude Sonnet 4.6 4ca896c73a Add Monte Carlo conditioning search after gradient ascent
search() generates 16 random unit-direction perturbations (2.5% of
conditioning norm each), scores each with the VF, returns the best.
Runs after ascend() in _v2_ascend_conditioning — ascent exploits the
known gradient direction, search explores the neighbourhood around it
for any better nearby region. Total cost: 16 VF forward passes ≈ free.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-30 15:47:28 +03:00
digital-garbageandClaude Sonnet 4.6 79bca9b693 Add concept-pair bad direction repulsion
Learns which phrase combinations in the final encoded prompt correlate with
anatomy/quality failures (reward < -0.10, wrong_appearance, wrong_action+quality).
For each pair of phrases (up to top 8) present in a bad generation, accumulates
the conditioning direction as a per-pair bad slot using the existing
_v2_store_direction mechanism.

At generation time: for each phrase pair in the current final prompt with ≥3
observations, applies a repulsion from the stored bad direction (max 3 pairs,
strength capped at 3.0% of conditioning norm). Visible in axis_actions as
pair-repulsion:N. Prunes to 200 pairs when exceeding 300.

Trigger includes wrong_appearance explicitly (reward=0.0 but signals anatomy
artifacts), missing quality, and all outcomes below -0.10 reward.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-30 15:20:25 +03:00
digital-garbageandClaude Sonnet 4.6 2463bdeb5b Disable perfect_freeze — prompt changes after Perfect now respected
The freeze locked prompt text to the previous Perfect output, overriding
intentional prompt changes when intent similarity stayed above 0.50. With
VF + conditioning memory maintaining quality direction, the freeze is no
longer needed and only causes unwanted video repetition.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-30 14:55:25 +03:00
digital-garbageandClaude Sonnet 4.6 5459eb90f5 Add concept-in-context conditioning guidance
Learns which phrases in the final encoded prompt (not intent, not raw input —
the actual text that went into CLIP) correlate with reward changes when added
or removed between consecutive generations.

Storage: concept_delta_memory per phrase text — add_sum/count, remove_sum/count.
Learning: on rating, diffs previous_run.final_phrase_texts vs prev_final_phrase_texts;
credits reward to added phrases, records it for removed.
Application: before conditioning memory is applied, computes a weighted direction
from phrase embeddings (via phrase_memory) for phrases new to this final prompt
that have ≥3 add observations and avg_reward > 0.10. Nudge capped at 3.5% of
conditioning norm alongside all other deltas.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-30 14:16:40 +03:00
digital-garbageandClaude Sonnet 4.6 d8763da4a7 Fix UnboundLocalError: eff_key not yet assigned when VF loads
Used refinement_key_input/refinement_key directly instead of eff_key
which is assigned ~340 lines later in refine_v2.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-30 13:49:32 +03:00
digital-garbageandClaude Sonnet 4.6 28ef855893 VF-driven confidence scaling and gradient-aligned phrase boosting in conditioning memory
Two new VF-driven behaviours in _v2_apply_conditioning_memory:

1. Global confidence scalar — VF predicted reward scales all conditioning memory
   modifications: confidence_scale = (vf_score+1)/2 clamped to [0.4, 1.0].
   High score → full strength (direction is good). Low score → dampened
   (be cautious, current conditioning direction looks bad). Applies regardless
   of which prompt is active — purely VF-signal driven.

2. Gradient-aligned phrase boosting — VF gradient direction (∂reward/∂conditioning)
   is computed and compared to each axis direction slot via cosine similarity.
   Boost factor [0.5, 1.5] applied to direction strength: phrases/axes pointing
   with the reward gradient are amplified, those pointing against are dampened.
   Applies to liked_dir, missing axis repair, and satisfied axis preserve.

VF score and boost factors visible in adaptation status output.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-30 13:47:33 +03:00
digital-garbageandClaude Sonnet 4.6 59b3b5377a Add attention weight accumulation and VF-driven temperature
Attention weight accumulation:
- Capture per-token output norm at identity blocks [14,20,21,30,33] during every
  generation via the optimized_attention patch (same path as temperature)
- EMA-merge into blessed file on liked ratings (0.8 old + 0.2 new)
- Inject as V-scaling bias on future runs: important tokens get amplified V,
  pushing attention toward historically attended positions
- Temp/blessed files cleared on session reset

VF-driven temperature:
- build_enhancements accepts conditioning=None, loads value function, scores it
- _derive_temperature_map(vf_score=) continuously modulates block temperatures:
  high VF score → sharpen (0.80×), low → warm/explore (1.20×), regardless of rating
- Rating-driven temperature still applies when reward < 0.8; VF blends with it

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-30 13:43:11 +03:00
digital-garbageandClaude Sonnet 4.6 776e0a6b12 Remove latent VF and motion floor — inaccessible in LTX token format
LTX packs all spatial/temporal dims into a single token [1, 1, C*T*H*W]
during sampling. Per-step latent steering requires hooking into the model
internals, not the k-diffusion callback. Removed: compress_latent(),
_load_latent_value_function(), latent VF training, motion floor callback,
latent_value_guidance toggle in Studio.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-30 13:24:29 +03:00
digital-garbageandClaude Sonnet 4.6 f0a8fe53d4 Fix Save Refinement Latent not executing + decouple motion floor from liked_dir
OUTPUT_NODE = True forces ComfyUI to run the node even with no downstream
connection on the LATENT output. Motion floor now activates as soon as
embed_guidance is on and a refinement key is set, independent of liked_dir.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-30 13:03:41 +03:00
digital-garbageandClaude Sonnet 4.6 18d879d8c1 Add latent value function — VGG-Flow style per-step latent steering
Trains a second OnlineValueFunction on rated video latents (compressed via
channel mean-pool). At each denoising step, computes ∂reward/∂latent through
the lightweight MLP and applies it as an in-place drift to the noisy latent —
gradients never touch the 22B transformer. Controlled by embed_guidance_strength
alongside the existing conditioning guidance. Studio toggle: "Latent guidance".
Cleared on session reset alongside the conditioning VF.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-30 12:40:03 +03:00
digital-garbageandClaude Sonnet 4.6 9187379a38 Clarify heart modifier semantics + fix positive grid + Nailed it heart
Heart modifier now applies full axis pressure (not 50% softened) — meaning
"fix this specific issue but the quality direction was great." The quality
signal comes from boosted reward and conditioning delta, not from reducing
axis pressure. Nailed it + heart removed (that's just Perfect). Positive
grid changed to 1fr 1fr to fill width with 2 items.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-30 12:13:15 +03:00
digital-garbageandClaude Sonnet 4.6 b8fdf38a77 Remove standalone "Loved it" rating — replaced by heart modifier
The ♥ button on any rating covers the same semantic. Removed from picker
UI and V2_RATING_LABELS; profile kept in Python for backward compat.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-30 12:08:46 +03:00
digital-garbageandClaude Sonnet 4.6 86ef472ed6 Disable heart for quality-degraded ratings
Missing quality, Missing details+quality, Missing action+quality, and
Wrong action+quality can't meaningfully be loved — no heart button.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-30 12:05:24 +03:00
digital-garbageandClaude Sonnet 4.6 b912bdefa2 Add |loved variants to V2_RATING_LABELS for ComfyUI validation
ComfyUI rejects widget values not in the allowed list. Generate all
valid label|loved combinations at definition time.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-30 12:04:22 +03:00
digital-garbageandClaude Sonnet 4.6 e9a1510db0 Add "Loved it" modifier to rating picker
Any rating can now be combined with a "Loved it" toggle. The suffix |loved
is appended to the rating string and parsed in normalize_refiner_v2_rating.

When active: reward boosted to max(base, 0.85), axis pressure softened 50%,
conditioning direction delta raised to 0.45, preferred context applied at
0.30 base_delta. Disabled for Perfect (redundant) and -Just forget it-.
Button label shows ♥ when modifier is active.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-30 11:55:17 +03:00
digital-garbageandClaude Sonnet 4.6 a539bb9b9e Add rating picker popup + Wrong action + quality rating
Replaces the rating dropdown on Studio and Refiner V2 nodes with a button
that opens a categorized floating picker. Each option shows its reward value
and a one-line hint. Rating auto-resets to -Just forget it- after execution
so forgotten ratings don't silently apply to the next run.

Also adds Wrong action + quality (reward -0.40, wrong_axes action, missing
quality) and drops Wrong action reward from +0.10 to -0.10.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-30 11:33:41 +03:00
digital-garbageandClaude Sonnet 4.6 24640a02bf Add "Nailed it" rating — prompt-adherence positive, weaker than Perfect
Restores the old "Loved it" learning behavior (reward 0.75, intent delta
+0.03, preferred context 0.65, axis conditioning 0.35, LoRA 0.44/0.24)
as a distinct rating. Sits between Perfect and Loved it on the ladder:
prompt adherence is rewarded but not at full strength.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-30 11:19:44 +03:00
digital-garbageandClaude Sonnet 4.6 aa47dca72b Redefine "Loved it" as axis-blind quality endorsement
Previously a weaker "Perfect". Now means: output looks great, prompt
adherence is irrelevant. Skips missing_intent_phrases learning, skips
preferred context lock-in, zeroes intent phrase reinforcement. Keeps
conditioning direction delta and raises value function reward to 0.85.
Quality/style LoRAs rewarded at Perfect level (0.55x).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-30 11:15:25 +03:00
digital-garbageandClaude Sonnet 4.6 ba18fc5747 Fix conditioning ascent: load value function inside inference_mode(False)
torch.load under inference_mode creates inference tensors; MLP params then
can't participate in backward. Same fix as the earlier value function loader
in samplers.py.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-30 10:57:50 +03:00
digital-garbageandClaude Sonnet 4.6 199d4cfee0 Clear value function on session reset
reset_session now deletes the value function .pt file alongside the
enhancement files. Previously it was orphaned across resets.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-30 10:56:40 +03:00
digital-garbageandClaude Sonnet 4.6 3d6e06fd32 Apply conditioning ascent in Refiner V2 output (single + scene split paths)
Before returning modified_positive, ascend each scene's conditioning tensor
toward higher predicted reward via the value function. Covers both the
standalone Refiner V2 node and FunPack Studio (which delegates to refine_v2).
No-op until value function reaches MIN_SAMPLES; handles transition-split
multi-scene conditioning correctly.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-30 10:46:52 +03:00