Commit Graph
84 Commits
Author SHA1 Message Date
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 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 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 644cd7629a Fix scene builder mode and add refiner learning mode 2026-05-15 13:07:41 +03:00
digital-garbage 0cad05c55c Link refiner with scene builder memory 2026-05-14 14:59:50 +03:00
digital-garbage bcab55ba6c Preserve perfect Refiner repairs 2026-05-14 03:40:01 +03:00
digital-garbage 399ddc3225 Persist Refiner repairs until perfect 2026-05-14 03:37:59 +03:00
digital-garbage 63d637f71b Handle semantic short intent expansions 2026-05-14 03:25:49 +03:00
digital-garbage 0e47823086 Match one-word intents to expanded prompts 2026-05-14 03:22:55 +03:00
digital-garbage 0b5e0b8d04 Block requested actions from negative repair 2026-05-14 03:21:28 +03:00
digital-garbage aeffa7457b Upgrade Refiner V2 intent learning 2026-05-14 03:04:42 +03:00
digital-garbage 71aad9e3d4 Add Scene Builder learning mode 2026-05-13 22:34:33 +03:00
digital-garbage 8305e44f2a Merge remote-tracking branch 'origin/main' into dev
# Conflicts:
#	CHANGELOG.md
#	README.md
#	conditioning.py
#	docs/FunPackVideoRefinerV2.md
#	pyproject.toml
2026-05-13 12:52:48 +03:00
digital-garbage e716b37264 Add refiner vision context and velocity research hooks 2026-05-13 12:36:07 +03:00
digital-garbage 82ceea6c9a Fix Refiner V2 conditioning fallback 2.3.3 2026-05-08 22:27:34 +03:00
digital-garbage 10d6a49603 Release 2.3.2 intent alignment memory 2026-05-08 21:35:42 +03:00
digital-garbage 35eae99318 Tighten Refiner V2 prompt repair intent matching 2026-05-08 21:13:51 +03:00
digital-garbage edb5cc3607 Remove duplicate Refiner key widget 2026-05-08 19:32:31 +03:00
digital-garbage 78dc9252f6 Release Refiner V2 appearance safety 2026-05-08 19:28:00 +03:00
digital-garbage 8daf151b68 Add wrong-intent V2 ratings 2026-05-08 16:12:00 +03:00
digital-garbage 5d057a95d9 Serialize V2 repair candidates safely 2026-05-08 15:57:00 +03:00
digital-garbage 11b597b6ea Prefer clustered context in V2 prompt repair 2026-05-08 15:50:24 +03:00
digital-garbage f8c5bcd45d Filter prompt enhancer refusals from refiner learning 2026-05-08 15:28:57 +03:00
digital-garbage f48411c64f Improve V2 training diagnostics 2026-05-08 14:47:07 +03:00
digital-garbage 16709c1fd5 Add context-aware V2 category learning 2026-05-08 14:39:21 +03:00
digital-garbage 0946748f90 Make V2 ratings axis-aware 2026-05-07 22:40:53 +03:00
digital-garbage faec254cd9 Fix refiner phrase category alignment 2026-05-07 21:22:17 +03:00
digital-garbage cf9afb2539 Prepare 2.2.0 refiner release 2026-05-07 20:28:30 +03:00
digital-garbage f722a06526 Add video refiner v2 2026-05-07 20:04:44 +03:00
digital-garbage 48a448d114 Fix Lucky refiner learning 2026-05-07 10:35:34 +03:00
digital-garbage 061269a41f Remember lucky phrase placement 2026-05-06 23:07:09 +03:00
digital-garbage bb413273a4 Preserve phrases in lucky prompts 2026-05-06 23:00:01 +03:00
digital-garbage 6b89984e10 Handle lucky re-encode length changes 2026-05-06 22:54:16 +03:00
digital-garbage 94563b47e9 Remove redundant lucky memory work 2026-05-06 22:51:49 +03:00
digital-garbage 6b021f5d3f Speed up lucky conditioning composition 2026-05-06 22:46:00 +03:00