Commit Graph
425 Commits
Author SHA1 Message Date
digital-garbageandClaude Sonnet 4.6 f0f121ddf2 Fix FunPackAdvisorLLM: thinking tokens, semantic gate, missing import
- Strip <think>...</think> blocks in decode so Qwen3 chain-of-thought
  doesn't pollute the repaired prompt and cause validation to reject it
- Pass enable_thinking kwarg to apply_chat_template (with TypeError
  fallback for models that don't support it); propagate thinking flag
  through tokenize -> generate so the token budget is expanded by 2048
  when thinking mode is active, giving room for reasoning + response
- Return 1.0 from _v2_text_semantic_similarity when the clip has no
  encode_from_tokens_scheduled - generation-only clips can't compute
  similarity so they shouldn't be penalized with a 0.0 semantic gate
- Add FunPackAdvisorLLM to standalone (non-package) imports in
  __init__.py so tests can run without the full ComfyUI runtime
- Update three stale advisor tests: 5-value _v2_prompt_advisor unpack,
  "Encoded as:" prefix change, 6-return-value unpacking after negative
  conditioning was removed

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-16 14:36:49 +03:00
digital-garbageandClaude Sonnet 4.6 8f7c61c6ce Evict poisoned perfect-repair phrases on Awful or Wrong Appearance rating
When a phrase injected by the perfect-repair system is present during a
generation rated Awful or Wrong Appearance, it is now hard-deleted from
perfect_repairs in the intent family slot. One bad rating is enough to
stop the re-injection permanently. Evicted phrase names are reported in
the intent family status line.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-16 14:36:49 +03:00
DigitalGarbage 6fbc2c23f2 Merge pull request #11 from digital-garbage/dev
Example workflow featuring new FunPack nodes
2026-05-16 13:50:59 +03:00
DigitalGarbage f93ff4325e Example workflow featuring new FunPack nodes 2026-05-16 13:50:40 +03:00
digital-garbageandClaude Sonnet 4.6 8a5a4bdca4 Release 2.5.1 - docs, changelog, version bump
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-16 03:59:46 +03:00
digital-garbageandClaude Sonnet 4.6 3e08ea41a8 Improve debug outputs: human-readable adaptation, direction memory, model patch
- _v2_direction_readout: new helper showing each direction slot's status
  in plain language ("warming up 2/3 runs", "active 8 runs, mag 0.412",
  "away from learned pattern") for liked, bad, and all three axes.
- _v2_apply_conditioning_memory: return replaced with multi-line readable
  block showing strength, reward trend, streak, which mode each slot is
  using, and what axis adjustments were applied.
- training_info Adaptation section: now includes the full direction
  readout so users can see exactly what memory state the refiner is in.
- Model patch status: expanded from one line to a readable block showing
  which direction slots are active with their run counts, and lists the
  phrase texts being emphasized (up to 4) alongside position range count.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-16 03:57:03 +03:00
digital-garbageandClaude Sonnet 4.6 a70b55ad5a Make FunPackAdvisorLLM wrapper fully compatible with TextGenerate node
TextGenerate calls tokenize(prompt, skip_template=bool, image=..., thinking=...)
and generate(..., min_p=..., presence_penalty=...). Wrapper now handles all of:

- skip_template=True: raw encode without chat template (for nodes like
  TextGenerateLTX2Prompt that pre-format with role tokens)
- skip_template=False (default): apply model's own chat template via
  apply_chat_template, with optional system_prompt kwarg
- min_p, presence_penalty: forwarded to model.generate() with progressive
  fallback stripping unsupported params via TypeError catch
- All other kwargs absorbed silently so future TextGenerate params don't break

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-16 03:48:09 +03:00
digital-garbageandClaude Sonnet 4.6 8fa4da3d36 Add FunPackAdvisorLLM node + fix session reset clearing all history
FunPackAdvisorLLM:
- Loads any HuggingFace CausalLM via AutoModelForCausalLM.from_pretrained
- Wraps it in _FunPackAdvisorLLMWrapper which exposes tokenize/generate/decode
  matching the interface _v2_generate_advisor_text already uses
- tokenize() accepts system_prompt kwarg, applies the model's own chat
  template via apply_chat_template, absorbs unsupported kwargs silently
- generate() uses max_new_tokens (not max_length) so prompt length does
  not eat into the generation budget
- Model cached in _FUNPACK_ADVISOR_LLM_CACHE by (path, dtype) - no
  reload on repeated runs
- Returns CLIP type so it plugs directly into advisor_clip input
- Default: huihui-ai/Huihui-Qwen3-8B-abliterated-v2

Session reset fix:
- _v2_empty_state was missing intent_expansion_memory, session_source_mean_count,
  liked_dir, bad_dir - these survived reset via setdefault on next run.
  Added all four to the empty state so reset is complete.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-16 03:41:26 +03:00
digital-garbageandClaude Sonnet 4.6 9de08cf66f Rewrite advisor prompts to natural language - works with enhancement and instruct models
Both _v2_advisor_prompt and _v2_advisor_analysis_prompt now build natural
language user messages instead of structured FIELD: value format that only
instruction-following models can interpret.

System prompt reduced to one line: "You are a video prompt editor. Rewrite
the prompt to fix the specific issue. Output only the corrected prompt."
Simple enough to not conflict with enhancement models' own system prompts.

Repair user message: Issue description, user note, scene context, past
feedback, suggestions, analysis, then "Prompt to fix: ... Write the
corrected prompt." - reads as a natural enhancement request.

Analysis user message: same context then "What specifically needs to
change? One or two sentences, reference actual words from the prompt."

This works for:
- Enhancement models (Sulphur/Qwen): see a natural prompt improvement
  request they were trained on, produce useful output
- Instruction models: follow the clear natural language request
- The label-free output is already handled by the raw-text fallback
  in _v2_parse_advisor_response

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-16 02:01:36 +03:00
digital-garbageandClaude Sonnet 4.6 8082706f30 Fix None return from _v2_generate_advisor_text when layer 1 tokenize succeeds
generate/decode/return were inside the except TypeError block so they
only ran when layer 1 failed. When layer 1 succeeded (system_prompt kwarg
accepted), tokens was set but the function fell off the end returning None,
causing 'cannot unpack non-iterable NoneType' at the call site.

Restructure: tokenize into tokens=None, try each layer in order using
if tokens is None as the gate, then generate/decode/return always runs
after tokenization regardless of which layer succeeded.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-16 01:37:05 +03:00
digital-garbageandClaude Sonnet 4.6 77f905ab08 Simplify chat template: try native system_prompt kwarg first
CLIP.tokenize() passes **kwargs to tokenize_with_weights, so wrappers
that natively handle system/user separation (like Sulphur/Qwen) just
work by passing system_prompt= as a kwarg. Three-layer fallback:
1. clip.tokenize(user, system_prompt=system) - native kwarg support
2. apply_chat_template via BFS-found HF tokenizer - manual formatting
3. flat string + "Output:" anchor - last resort for bare wrappers

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-16 01:31:59 +03:00
digital-garbageandClaude Sonnet 4.6 9ac2a3fb5e Fix system prompt bleeding via proper chat template separation
The advisor was sending one flat string to clip.tokenize() so models
expecting ChatML/Gemma role tokens treated the whole thing as a user
message and echoed instructions back into the output.

- _v2_find_chat_tokenizer: BFS through CLIP wrapper hierarchy looking
  for a HuggingFace tokenizer exposing apply_chat_template (depth ≤ 5,
  checks tokenizer/processor/cond_stage_model/patcher/model attrs).
- _v2_advisor_analysis_prompt and _v2_advisor_prompt now return
  (system_str, user_str) tuples instead of one combined string.
- _v2_generate_advisor_text now accepts (system_prompt, user_prompt):
  - If chat tokenizer found: applies apply_chat_template with proper
    system/user roles and add_generation_prompt=True before tokenizing.
  - Fallback (no template): flat concatenation + "Output:" anchor so
    the model generates output instead of echoing instructions.
- Updated V2_PROMPT_ADVISOR_SYSTEM_PROMPT to state that inputs arrive
  in the user message, so the model knows the structure.
- Updated both call sites in _v2_prompt_advisor.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-16 01:29:52 +03:00
digital-garbageandClaude Sonnet 4.6 1c7143fae1 Fix advisor repetition loops: raise penalty 1.05->1.3, add no_repeat_ngram_size=5
1.05 repetition_penalty was negligible for a 12B model generating long
sequences. 1.3 is meaningfully aggressive. no_repeat_ngram_size=5 hard-
blocks any 5-gram from repeating, which stops loops that penalty alone
misses. Temperature raised 0.5->0.7 so the peaked distribution doesn't
trap the model in local loops even with penalty applied. Falls back to
no no_repeat_ngram_size if the wrapper doesn't forward that kwarg.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-16 01:13:08 +03:00
digital-garbageandClaude Sonnet 4.6 de710c7377 Add persistent cross-run encode cache to eliminate redundant CLIP calls
encode_cache was per-run only - every new rating caused all phrase
encodings to redo from scratch even with unchanged CLIP and text.

_V2_PERSISTENT_ENCODE_CACHE is a module-level dict keyed by
(id(clip), prompt_text), capped at 4096 entries. _v2_encode_prompt
checks persistent cache before encoding, writes to both caches on
miss. If CLIP model is swapped, id(clip) changes so stale entries
are never used (just unused memory until cap evicts them).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-16 01:03:32 +03:00
digital-garbageandClaude Sonnet 4.6 57a9731c15 Fix UnboundLocalError: initialize model_patch_status before training_info build
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-16 00:53:15 +03:00
digital-garbageandClaude Sonnet 4.6 0ee215ea8c Remove seed input from Refiner V2 - randomize internally each run
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-16 00:52:15 +03:00
digital-garbageandClaude Sonnet 4.6 b0b54c128a Add MODEL input/output, layer-level attn2 direction patch, phrase emphasis, clean status
MODEL input/output:
- Optional MODEL input; patched MODEL is the 6th output alongside existing 5.
- _v2_apply_model_patches: clones model and installs attn2_patch for
  layer-level cross-attention K/V injection using stored direction vectors.
  Directions are in text-encoder space [dim] which matches context_attn2
  before projection - compatible across all models using attn2 cross-attention.
- Per-layer scale 0.02 x NORM_SCALE(0.3) x avg_active_norm so effect
  accumulates gradually across layers without blowing up.

Phrase emphasis via K/V scaling:
- _v2_find_phrase_token_ranges: locates repair candidate phrases in the
  full conditioning sequence using cosine similarity between mean-pooled
  phrase encoding and each token position. Model-agnostic, no tokenizer
  format dependency.
- _v2_build_attn2_patch: scales K and V at matched positions by 1.25,
  boosting cross-attention to concepts added by prompt repair/advisor.

Status and training_info cleanup:
- Filter out lines that just say "none", "off", "skipped", "idle" - these
  added noise without signal.
- Status now shows only what actually happened: adaptation summary,
  repair/advisor actions, flags for special modes.
- training_info reorganized: Run, Memory, Prompt Analysis, Adaptation,
  Guidance, LoRA - sections only shown when non-empty.
- Removed negative_memory_status from training_info (negative removed).
- Added model_patch_status to Adaptation section when model connected.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-16 00:47:11 +03:00
digital-garbageandClaude Sonnet 4.6 09203480c6 Add direction-based conditioning memory for cross-prompt generalization
The existing full-tensor conditioning storage resets when prompt lengths
change, making the memory useless when prompts change every run. This
adds a parallel direction-based mechanism that is shape-invariant:

- _v2_pool_conditioning: mean-pools [batch, seq, dim] -> [dim]
- _v2_update_session_mean: running mean of raw source conditioning
  across all runs, pooled to [dim]. Represents the session baseline.
- _v2_store_direction: stores unit-normalized delta (payload - session_mean)
  alongside existing averaged full-tensor. Accumulated per slot as a
  running-averaged unit direction + magnitude scalar.
- _v2_apply_direction: applies stored direction to active tokens only
  (norm > 1% of max), scaled by strength * NORM_SCALE(0.3) * avg_token_norm.
  Active-token masking prevents adjusting padding/near-zero tokens.

Applied everywhere conditioning is stored and applied:
- liked_conditioning: switches to direction mode after 3+ perfect runs
- bad_conditioning: switches to direction repulsion after 3+ bad runs
- axis_conditioning_memory[axis][positive/negative]: per-axis directions

Before 3 runs accumulate per slot, falls back to existing lerp/repel
approach. Both mechanisms are fully backward compatible - old state
keys are preserved alongside new direction keys.

Advisor RATING description updated: Missing details now correctly
describes small actions and micro-interactions, not visual quality.
Missing quality covers visual quality/artifacts.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-16 00:32:33 +03:00
digital-garbageandClaude Sonnet 4.6 bd2046962c Add perfect freeze: lock prompt on Perfect rating, thaw on change signals
When the previous run was rated Perfect and none of the thaw conditions
are met, the refiner skips all prompt transformations (alignment, repair,
wildcard cleanup, emphasis) and re-uses the previously encoded prompt
directly.

Thaw conditions (any one releases the freeze):
- feedback_prompt is provided (user explicitly wants a change)
- intent prompt changed significantly (body similarity < 0.50)
- source image fingerprint changed from previous run

The advisor analysis pass is also skipped on Perfect ratings with no
feedback - nothing to analyse when the output was already perfect, and
the repair would be blocked by the existing is_perfect guard anyway.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-16 00:01:50 +03:00
digital-garbageandClaude Sonnet 4.6 bbeb68d34f Add per-intent expansion memory for short intent prompts
Intent prompts can be short shorthands (e.g. "smoking in bowling club").
As the user provides feedback, those notes are stored in
intent_expansion_memory keyed by the normalized intent prompt and
surfaced to the advisor as INTENT_NOTES alongside ORIGINAL_USER_INTENT.

The advisor system prompt is updated to treat INTENT_NOTES as the true
expanded meaning of the intent and prioritize it during repair.

- _v2_update_intent_expansion: stores feedback per intent key, max 16
- _v2_format_intent_expansions: formats stored notes as a semicolon list
- intent_expansions retrieved before advisor call, stored after each run
  with feedback_prompt present

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-15 23:57:58 +03:00
digital-garbageandClaude Sonnet 4.6 c3d57cc340 Fix advisor analysis echoing instructions and ignoring user feedback
- Skip the analysis pass entirely when feedback_prompt is provided.
  The user already described what is wrong; running analysis is redundant
  and was producing the echoed instruction text as its output. Repair pass
  still runs with the feedback in OPTIONAL_NOTE.
- Rewrite the analysis prompt output instruction to use a placeholder
  format (<your specific analysis...>) instead of content words the model
  can echo back verbatim.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-15 23:51:15 +03:00
digital-garbageandClaude Sonnet 4.6 78aae515b4 Docs and changelog for 2.5.0 release
- CHANGELOG: add new Changed and Fixed entries for negative conditioning
  removal, advisor system prompt rewrite, token limit increases, Only
  prompt double-call fix, and encoded_prompts bug fix.
- README: update 2.5.0 section to cover all of the above.
- docs/FunPackVideoRefinerV2.md: remove negative_prompt input and
  modified_negative output; update advisor_mode description with new
  structured input format and token budgets; update encoded_prompts
  output description with all four possible sections.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-15 23:37:14 +03:00
digital-garbageandClaude Sonnet 4.6 bb25450963 Fix: pass advisor args to encoded_prompts in the normal return path
The success return was calling _v2_encoded_prompts_output(prompt_to_encode)
with no advisor kwargs, so only "Positive prompt:" ever appeared. Only the
error-path return had the full arguments.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-15 23:31:03 +03:00
digital-garbageandClaude Sonnet 4.6 7fc7974b80 Increase analysis pass limit 600→1200 to accommodate thinking tokens
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-15 23:19:53 +03:00
digital-garbageandClaude Sonnet 4.6 2ccd57645a Increase advisor token limits: repair 800→1600, analysis fixed at 600
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-15 23:18:51 +03:00
digital-garbageandClaude Sonnet 4.6 0207f89414 Always surface advisor's suggested prompt in encoded_prompts
- _v2_prompt_advisor now returns the suggested prompt as 5th value on
  both the applied and rejected paths (not just rejected).
- _v2_encoded_prompts_output shows it as "Advisor suggestion (applied):"
  or "Advisor suggestion (rejected):" so the generated text is always
  visible regardless of whether validation passed.
- Renamed "Advisor:" → "Advisor analysis:" to distinguish diagnostic
  text from the suggestion prompt.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-15 23:16:49 +03:00
digital-garbageandClaude Sonnet 4.6 069280697e Show advisor's suggested prompt in encoded_prompts when not applied
_v2_prompt_advisor now returns a 5th value (advisor_suggested) carrying
the raw repaired prompt when validation rejected it. This is surfaced in
encoded_prompts as "Advisor suggested (rejected): ..." so the output is
visible even when the repair didn't pass validation.

No suggested prompt is returned for: skipped, no-change, or successfully
applied (in that case it's already the Positive prompt).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-15 23:10:40 +03:00
digital-garbageandClaude Sonnet 4.6 fcaed22bd2 Include advisor suggestion in encoded_prompts output
When the advisor runs, encoded_prompts now shows:
- Positive prompt (the final/repaired prompt)
- Advisor: <diagnostic> if a diagnostic was returned
- Pre-advisor prompt: <original> if the prompt was actually changed

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-15 22:52:39 +03:00
digital-garbageandClaude Sonnet 4.6 e47b92a5ad Remove negative conditioning output and input from Refiner V2
- Drop CONDITIONING 5th return slot (modified_negative) and the
  negative_prompt optional input entirely.
- Remove all negative encoding, repair, and advisor call sites from
  the processing path.
- Strip negative_* fields from saved prompt_history and last_run state.
- Update status strings and _v2_encoded_prompts_output (positive only).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-15 22:46:53 +03:00
digital-garbageandClaude Sonnet 4.6 d4ef898299 Remove negative processing from Refiner, update Advisor system prompt to DeepSeek format
- Remove _v2_repair_negative_prompt and _v2_negative_prompt_advisor calls from
  all execution branches; negative prompt is now passed through unchanged.
  This fixes "Only prompt" mode running two AI generation passes (positive +
  negative) instead of one, and removes pointless processing at CFG=1.0.
- Replace V2_PROMPT_ADVISOR_SYSTEM_PROMPT with the new structured format:
  ORIGINAL_USER_INTENT / LAST_PROMPT / RATING / OPTIONAL_NOTE variables,
  with explicit RULES for Missing-X vs Wrong-X repairs.
- Rewrite _v2_advisor_prompt to fill in the four named variables; adds
  rating_label parameter (extracted from rating_profile at call site) so
  RATING is now properly included in every repair request.
- In "Only prompt" mode the output format block is omitted so the model
  returns a plain prompt string with no labels, matching the system prompt's
  "Output ONLY the final prompt string" instruction.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-15 22:43:32 +03:00
digital-garbageandClaude Sonnet 4.6 a27e8fa73c Fix greedy decoding and rename prompts for advisor clarity
Critical fix: do_sample was False, which forces greedy decoding and
silently ignores temperature, top_k, top_p, and min_p entirely. The
model was always picking the single highest-probability token regardless
of instructions or feedback. Changed to do_sample=True with temperature
0.5, top_k 50, top_p 0.92 — focused enough to follow the feedback
override reliably without the rigidity of greedy decoding.

Context clarity: renamed "Current prompt" to "Suggested prompt" in
both the analysis and repair advisor prompts, and moved "User intent"
before it. The advisor now sees intent first (what the user actually
wants), then the suggested prompt (what the LLM enhancer proposed),
making the framing correct for applying feedback on top of an enhancer
output. Same rename applied to the negative advisor prompt.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-15 19:31:29 +03:00
digital-garbageandClaude Sonnet 4.6 2d1eb4fc5b Add prompt_repair boolean to Refiner V2
New optional input (default True) that enables or disables the rule-based
prompt repair system. When off, V2 skips _v2_repair_prompt_for_missing_axes
entirely and passes no repair candidates to the advisor. Useful when phrase
memory is sparse or producing irrelevant suggestions that disrupt generation.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-15 19:24:24 +03:00
digital-garbageandClaude Sonnet 4.6 c473502acf Implement two-pass advisor: separate analysis and repair steps
Full mode now runs two sequential LLM calls per generation:

Pass 1 (analysis): a focused prompt asks the model to identify exactly
what needs to change — what to add, what to remove, what to fix — and
output a single DIAGNOSTIC line. Both user feedback and feedback history
are present. Max tokens is halved since only one line is needed.

Pass 2 (repair): builds on pass 1 by including the analysis result as
"Analysis of what needs to change:" before the task instruction. The
model applies the analysis rather than having to simultaneously diagnose
and rewrite in a single response.

Only diagnostics mode runs only pass 1, stores the analysis in
advisor_feedback_history as an advisor-sourced entry (labelled
"Advisor note:" in future history context), and returns without
modifying the prompt — making it useful as a genuine preview step
before switching to Full mode.

Only prompt mode runs only pass 2 directly (no analysis overhead),
unchanged from before.

Both passes receive feedback_prompt and feedback_history.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-15 19:19:35 +03:00
digital-garbageandClaude Sonnet 4.6 462beda1a1 Redesign Advisor context around feedback history
Advisor context is now minimal and feedback-first:
- User feedback (current run, placed first when present)
- Current prompt
- User intent
- Previous encoded prompt (anchor for feedback — so 'he held her head'
  has a referent)
- Suggestions from memory (repair candidates, max 5)
- Past feedback history (last 10 entries, most recent first)

Removed from context: rating label, axis codes, plain-English axis
translation, encoded-vs-original prompt duplication, advisor-poisoning
note, previous advisor diagnostic, perfect example, V2 recommendations,
source image text note (image is fed directly to vision-capable models
via the existing tokenizer image= path)

New persistent store: global_state["advisor_feedback_history"] — up to
10 entries, each {feedback, rating, iteration}. Only populated when
feedback_prompt is non-empty. Updated at the end of each run so the
current run's feedback is available for future runs, not the current.

History format: "Rating: user's exact feedback text" e.g.
"1. Missing details: I asked for smoke but it didn't appear."
"2. Wrong action: he was supposed to hold her hand, not her head."

Removed dead helpers: _v2_find_perfect_example_for_intent,
_v2_build_v2_recommendations, _v2_axes_to_plain_english,
_AXIS_DESCRIPTIONS — none used by advisor context any more.

Cleaned up _v2_prompt_advisor and _v2_negative_prompt_advisor
signatures: removed rating_label, phrases, perfect_example,
v2_recommendations, has_image params; added feedback_history.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-15 19:08:00 +03:00
digital-garbageandClaude Sonnet 4.6 8df4a5dad0 Drastically simplify Advisor context to fix feedback being ignored
The advisor prompt was flooded with internal refiner state that means
nothing to a language model: phrase category tags, raw axis code labels,
redundant recommendations, and duplicate encoded/original prompt fields.
With 15+ fields of noisy context, explicit user feedback buried at the
bottom was competing with everything else for the model's attention.

Changes:
- Phrase analysis removed entirely from advisor context
- Axis labels translated to plain English descriptions via _v2_axes_to_
  plain_english: "missing action axis" → "The previous output was missing:
  main action, movement, motion direction"
- V2 recommendations field removed (was a third copy of the same axis/
  candidate information)
- Encoded prompt only shown when it actually differs from the original
- Repair candidates capped to 5 and framed as "Consider adding:" rather
  than a raw list
- Negative advisor prompt receives the same treatment
- Negative prompt length rejection raised from 900 to 1200 chars
- feedback_prompt placed first in user context in both advisors, before
  all other fields
- System prompt OVERRIDE block injected when feedback is present
- Protected-category and intent-distance validation bypassed when user
  feedback is provided
- is_perfect analysis-only block and intent-change guard also bypassed
  when feedback is present

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-15 18:50:10 +03:00
digital-garbageandClaude Sonnet 4.6 5d5b171c7f Add FunPack Distilled Flow Sampler for few-step distilled models
New sampler targeting LTX2.3 distilled LoRA and similar 4-8 step
flow-matching distilled video models. Three improvements over plain Euler:

Adams-Bashforth 2-step multistep (order=2, default):
Extrapolates the denoised direction from two consecutive steps using
variable-step-size AB2 coefficients: (1 + r/2) * d_curr - (r/2) * d_prev
where r = h_current / h_previous. Gives second-order accuracy across the
large sigma jumps typical of distilled schedules at zero extra model-call cost.

Heun predictor-corrector on final steps (final_correction_steps=1, default):
Replaces the last N steps with a Heun pass: Euler predictor to sigma_next,
second model call at sigma_next for the corrector direction, averaged update.
Costs one extra model call per corrected step and significantly improves
sharpness and detail in the steps that define the final output.
Multistep history is invalidated after each Heun step.

Optional s_noise (default 0.0 = deterministic):
Small ancestral-style noise injection (scaled by sigma_up) for diversity.
Distilled models are trained as pure ODE; any non-zero value is an
intentional deviation. Keep below 0.15 if used at all.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-15 18:42:58 +03:00
digital-garbageandClaude Sonnet 4.6 a791f599ef Remove spurious prompt length rejection from advisor validation
The too-long check rejected valid advisor repairs when the repaired
prompt was longer than 3x the current prompt. Length is not a useful
safety signal — the legitimate guards are refusal text, intent distance,
and protected-category injection.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-15 18:33:41 +03:00
digital-garbageandClaude Sonnet 4.6 33d765bebc Expand Hybrid Euler 2S sampler with three algorithmic improvements
Order-2 ancestral denoised extrapolation (automatic, zero extra cost):
The early Euler-A phase now reuses the previous step's denoised output
to extrapolate a better score direction estimate before each ancestral
step, equivalent to DPM-Solver++ 2M applied to the stochastic phase.
The state is reset after any motion pulse since a pulse modifies x and
invalidates the previous estimate.

Progressive correction_blend in quality phase (automatic, speeds up):
The first half of quality-phase steps now use correction_blend=0
(single-eval Euler ODE); the second half use the configured blend
(full 2S correction). _hybrid_ode_step already returns early at blend=0
with no second model call. For a 30-step run with 35% quality phase this
saves roughly 4-5 model calls (~12% faster) while keeping the expensive
2S correction where sigma is lowest and it has the most impact.

Adaptive eta decay (new eta_final parameter, default 1.0):
When eta_final is set below eta, ancestral noise strength decays linearly
toward eta_final as sigma approaches the quality boundary, based on
sigma proximity (quality_sigma_start / sigma). This reduces stochastic
variation right before the deterministic quality phase, giving a cleaner
hand-off. Default 1.0 preserves existing behaviour.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-15 18:31:21 +03:00
digital-garbageandClaude Sonnet 4.6 4ed7f401a5 Fix four logic bugs in Refiner V2 advisor and streak tracking
- Fix _v2_find_perfect_example_for_intent: was reading non-existent
  loved_delta_sources field; now correctly reads perfect_anchors/base
  and loved_variants using the actual positive_prompt/encoded_prompt keys
- Fix _v2_build_v2_recommendations: removed global phrase_memory liked
  phrases that would inject unrelated-intent vocabulary for universal keys;
  recommendations now only include axis feedback and intent-filtered
  repair candidates
- Fix _v2_update_streaks in Prompt only mode: avg_reward_ema and
  good/bad streaks are now skipped in Prompt only mode so they cannot
  contaminate conditioning adaptation strength in subsequent Refine runs;
  last_rating_label and last_missing_axes still update for repair continuity
- Fix advisor rating label on reset/first run: advisor now receives
  "No previous output (first run or session reset)" instead of the
  user-set rating widget value when has_previous_run is False, preventing
  the advisor from treating a stale rating as evidence

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-15 18:22:33 +03:00
digital-garbageandClaude Sonnet 4.6 2701c10631 Expand and fix Refiner V2 advisor system
- Remove hardcoded Gemma chat tokens; advisor prompts now use plain
  structured text compatible with any CLIP text generator
- Raise advisor generation limit from 384 to 800 tokens (internal)
- Repair candidates are now passed as suggestions to the advisor before
  being applied; rule-based repair applies only if the advisor is off or
  produces no valid output
- Add optional feedback_prompt input for user-provided natural-language
  feedback, injected at highest priority in the advisor system prompt
- Add Prompt only execution mode: full prompt shaping with conditioning
  vectors passed through unchanged
- Rename advisor modes to Off / Only diagnostics / Only prompt / Full;
  Only prompt suppresses the diagnostic line for clean output
- Advisor detects when its own previous output caused a bad rating and
  notes this explicitly in the next system prompt
- Inject perfect-rated prompt example into advisor system prompt when
  one exists for the current intent family
- Inject V2 phrase-memory recommendations into advisor system prompt;
  user feedback takes priority over these
- Guard against stale rating attribution when user intent changes between
  runs (body similarity < 0.50 skips repair application)
- Advisor no longer skips on Perfect rating; runs in analysis-only mode
  to capture what worked
- Previous advisor diagnostic is fed back into the next run's system
  prompt, closing the learning loop

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-15 18:13:51 +03:00
digital-garbage 2b5ec75a98 Expose Refiner encoded prompts 2026-05-15 14:09:13 +03:00
digital-garbage 0ddfb9406a Add separate Refiner advisor CLIP input 2026-05-15 13:52:55 +03:00
digital-garbage e34fdbf060 Add Refiner V2 CLIP advisor 2026-05-15 13:41:11 +03:00
digital-garbage c7e2e96f75 Release 2.4.2 2026-05-15 13:25:59 +03:00
digital-garbage 644cd7629a Fix scene builder mode and add refiner learning mode 2026-05-15 13:07:41 +03:00
digital-garbage 9212fa1e27 Preserve saved scene prompt order 2026-05-14 15:55:38 +03:00
digital-garbage eb7b0f4f21 Preserve scene prompt insertion cursor 2026-05-14 15:50:01 +03:00
digital-garbage f294afa452 Inline scene prompt highlights 2026-05-14 15:39:24 +03:00
digital-garbage c67a12a852 Combine scene prompt highlights with editor 2026-05-14 15:28:30 +03:00
digital-garbage 005520e2aa Add scene preconstruct editor tools 2026-05-14 15:23:47 +03:00