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>
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>
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>
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>
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>
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>
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>
- 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>
- 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>