W21B Wave 3 Implementation Brief

W21B-wave-2에서 exterior / transition / site plate coverage를 복구한 뒤, 같은 물리 공간 안에서 가구와 구조가 흔들리거나, 변화가 거의 없는 BG를 과잉 생성하는 문제를 좁게 다루는 구현 브리프다.

작성일: 2026-05-29
상태: doc-only implementation brief
기준 문서: docs/w21-background-first-plan-20260528/index.html
직전 closure: W21B-wave-2 HEAD af779aa

요약

이번 wave의 목표는 style_reference_new_space가 같은 방의 다른 시점에도 "새 공간"처럼 작동하면서 냉장고, 커튼, 싱크대, 문, 창 위치를 새로 invent하는 문제를 줄이는 것이다. 동시에 L20B04 / L20B05 / L20B06처럼 배경 편차가 거의 없는 경우에는 새 plate를 굽지 않고 대표 plate를 재사용하도록 한다.

핵심 방향은 기존 단일 모드 style_reference_new_spacesame_physical_space_viewrelated_style_new_space로 분리하고, LLM planner의 자유 판단보다 unit graph / camera-look-at unit overlap / anchor reference overlap 같은 deterministic signal을 우선하는 post-process router를 두는 것이다.

같은 물리 공간인데 새 plate가 필요한 경우도 같은 원칙을 적용한다. L04B01 / L04B02처럼 같은 방 또는 같은 사이트의 연속 plate가 필요하면 직전 또는 대표 plate를 reference로 물려야 하며, reference 없이 새 세계를 invent하는 text-only direct plate는 실패로 본다.

이번 산출물은 구현 전 브리프다. 코드, DB, 이미지, API, canary, downstream resume은 이 문서 작성 단계에서 수행하지 않는다.

0. Current Assumptions

Wave-2 visual ack is still pending. W21B-wave-2는 active-only artifact 기준 mechanical pass 후 push됐다. 사용자 visual review가 아직 최종 hit/miss로 닫히지 않았으므로, wave-3 acceptance는 wave-2 residual이 발견되면 조정 가능하다.

Wave-2 active-only URL: http://192.168.35.42:8769/w21b_wave2_bg_canary_20260528_195936/compare_active.html

1. Problem Statement

사용자가 지적한 핵심 증상은 "같은 옥탑방 내부인데 어떤 BG에는 오른쪽에 냉장고가 있고, 어떤 BG에는 커튼이 있는" 식의 layout identity 붕괴다. 이는 BG purity나 exterior plate coverage와 별도 축이다.

증상 현재 원인 이번 wave에서 다루는 방식
같은 방인데 fixed furniture / wall / window / counter 위치가 다름 style_reference_new_space guidance가 "same home"만 강제하고 layout invent를 허용한다. same physical space면 layout-lock guidance를 적용한다.
LLM이 같은 공간/다른 공간 판단을 runtime label에 기대함 planner가 physical_space_idsame_physical_space_dedup_decision를 emit하지만, code-side router는 이를 primary SOT로 쓰지 않는다. unit / camera / look-at overlap을 primary deterministic signal로 둔다. LLM text label은 tie-breaker 또는 diagnostic이다.
stale chain_bg가 visual review에서 active failure처럼 보임 W21B-wave-2에서 stale 5개를 보존했고, active-only compare를 별도 생성했다. active-only audit helper를 preflight/tooling으로 승격한다. production rendering behavior 변경은 금지한다.
배경 차이가 거의 없는 연속 BG가 각각 새로 생성됨 현재 plan/render 흐름은 "선택된 BG 하나 = 생성 하나"에 가깝고, I2I가 처리할 작은 framing/state 차이를 BG plate 단계에서 중복 생성한다. low-delta cluster는 대표 plate 1개를 생성하고 나머지는 reuse / skip-render action으로 연결한다.
같은 물리 공간 plate가 서로 다른 세계처럼 보임 새 plate path가 text-only anchor처럼 동작하면 직전 representative plate의 visual identity를 물려받지 못한다. 새 same-space plate가 필요할 때도 reference continuity와 layout-lock guidance를 강제한다. reference가 없으면 text-only render는 anchor 1개에만 허용한다.

2. Current Code Touchpoints

파일 / 영역 현재 상태 Wave-3 의미
prompts/_base/shot_aware_bg_render_plan/1.202605281200/schema.json mode enum은 fp_seeded_anchor, reference_derived, style_reference_new_space, two_refs_distinct_spaces. v2 pack에서 same_physical_space_viewrelated_style_new_space를 도입한다. legacy style_reference_new_space는 prompt output에서 더 이상 목표 enum이 아니다.
backend/app/modules/pipeline/shot_aware_bg_render_plan.py validator는 LLM graph shape, selected refs, same-fp, camera candidates, anchor, rationale를 검증한다. 현재 same-space split router는 없다. deterministic post-process / validation layer 후보. LLM output을 final render mode로 normalize하고 router diagnostics를 checkpoint에 남긴다.
backend/app/modules/pipeline/shot_aware_bg_render_plan_llm_provider.py prompt pack version 1.202605281200를 로드하고 strict schema로 LLM call을 수행한다. v2 prompt pack wire-up. user prompt에는 extra scenario-specific literals를 넣지 않는다.
backend/app/modules/pipeline/shot_aware_bg_render_adapter.py ALLOWED_MODES_MODE_GUIDANCE가 renderer-facing reference guidance를 결정한다. 현재 style_reference_new_space guidance는 layout lock이 약하다. 새 mode guidance 추가. adapter는 router의 final mode를 소비하며, semantic reclassification은 하지 않는다.
backend/app/core/steps/background_render_step.py _run_shot_aware_plan_queue는 ordered nodes를 materialize하고 render한다. W21B-wave-2에서 direct plate queue가 추가됐다. render behavior는 가능한 유지한다. final mode / guidance만 adapter를 통해 들어오게 한다.

3. Scope Decision

Decision: 다음 작업은 W21B-wave-3이다. W21B-wave-2.1 active-only audit helper는 별도 wave로 빼지 않고 wave-3 preflight / observability item으로 흡수한다.

4. Non-goals

5. Design Decisions

5.1 Same-space 판정 SOT

Same-space 판정은 surface_role 단독으로 하지 않는다. surface_role은 coarse guard이고, primary signal은 같은 fp 안의 unit/camera/look-at 관계다.

Signal 용도 판정
same fp 기본 eligibility shot-aware plan validator의 same-fp invariant는 유지한다.
surface_role coarse guard interior_room끼리만 same-space layout lock 후보가 된다. exterior / transition / site는 wave-2 direct plate axis로 남긴다.
camera/look-at unit overlap primary deterministic signal child node와 selected ref node의 {camera_unit, look_at_unit} set이 겹치면 same physical space 후보.
target unit markers secondary deterministic signal dossier / overlay payload의 target_unit_marker_numbers 또는 dominant_target_unit_marker_number가 겹치면 same-space 후보.
LLM physical_space_id diagnostic / tie-breaker 동일 ID면 supporting signal로만 사용한다. code-side semantic source of truth는 아니다.

5.2 Router output

Router는 layout seed를 새로 생성하지 않는다. Router의 출력은 final reference mode, renderer guidance policy, explicit render_action, 그리고 reuse일 때의 reuse_target_bg_id다. render_action은 plan node의 canonical field로 checkpoint에 기록되어야 하며, render stage의 임의 post-process가 되어서는 안 된다.

5.3 Router location

Router의 기본 위치는 shot_aware_bg_render_plan builder의 LLM output validation 뒤, checkpoint write 전에 둔다. Adapter는 final mode를 소비하는 renderer-facing materializer로 유지한다. Background render step은 checkpoint에 기록된 render_action을 집행만 하며, semantic reuse 여부를 새로 판단하지 않는다.

Layer 역할 이유
LLM planner reference graph 후보 emit scenario-specific reasoning 금지. runtime facts만 사용.
post-process router same-space vs related-style final mode + render_action 결정 LLM-planner의 semantic low-delta 후보를 deterministic unit overlap / target unit overlap으로 corroborate한다. 둘 중 하나만 있으면 reuse하지 않는다.
validator canonical mode + selected refs shape 검증 malformed router output을 fail-closed한다.
adapter final mode의 guidance prefix materialize adapter는 semantic reclassification을 하지 않는다.

5.4 Wave-2 dependency

W21B-wave-2가 strict prerequisite인 이유는 surface_role이 coarse guard로 필요하기 때문이다. 다만 same-space primary signal은 surface_role이 아니라 unit graph / target unit overlap이다.

5.5 Low-delta plate suppression / reuse

같은 physical space이고 camera/look-at/target unit이 크게 다르지 않으며 state 변화가 BG plate에 영구적으로 남을 요소가 아니라면 새 plate를 생성하지 않는다. 다만 state delta는 deterministic code만으로 판단하지 않는다. LLM planner가 low-delta / scene-layer-restorable 후보를 emit하고, router가 unit / target overlap으로 이를 corroborate할 때만 reuse한다. 이 경우 downstream I2I / scene layer가 shot-specific framing, subject placement, transient state를 처리한다.

판정 축 reuse 후보 새 render 필요
physical space same fp + same interior unit / same exterior site cluster different unit / different site / no representative plate
view delta camera/look-at unit overlap 또는 target unit overlap이 높음 opposite wall, different doorway, different exterior facade side처럼 fixed geometry가 달라짐
state delta LLM planner가 subject position, gesture, temporary object, light action처럼 scene/I2I layer에서 복원 가능한 차이라고 emit하고 router signal이 이를 뒷받침함 permanent structural damage, fixed signage, persistent fixture arrangement처럼 BG plate 자체에 고정되어야 하는 차이이거나, LLM low-delta 후보와 deterministic overlap이 동시에 성립하지 않음
reference continuity representative plate가 있고 그 plate를 reference로 attach할 수 있음 first anchor plate 또는 representative가 missing/corrupt인 경우

Acceptance fixture: L20B04, L20B05, L20B06 같은 저변화 cluster는 대표 plate 1개 + reuse diagnostics가 목표다. 이 ID들은 production rule이 아니라 review fixture다.

5.6 Same-space reference continuity

Text-only anchor는 cluster의 첫 representative plate에만 허용한다. 같은 physical space cluster에서 두 번째 이후 plate를 새로 그려야 한다면 representative plate를 reference로 attach한다. Reference가 없으면 새 world invent를 막기 위해 fail-closed 또는 reuse_existing_plate를 선택한다.

Acceptance fixture: L04B01L04B02는 같은 방 / 같은 물리 공간인데 서로 너무 달라 보인다는 사용자 피드백이 있었다. Wave-3에서는 같은 physical-space cluster가 새 plate를 필요로 할 때 reference continuity가 checkpoint diagnostics와 ImageAsset lineage에서 확인되어야 한다.

6. Proposed Implementation Touchpoints

Commit Touchpoint 예상 변경
Commit 1 shot-aware plan prompt/schema v2 new pack prompts/_base/shot_aware_bg_render_plan/2.YYYYMMDDHHmm/. mode enum에 same_physical_space_view, related_style_new_space 추가. LLM output에는 low-delta candidate fields만 둔다: same_physical_space_low_delta_candidate, low_delta_reuse_target_bg_id, low-delta rationale. Canonical render_action은 strict schema에서 LLM이 단독 결정하지 않도록 Commit 2a router가 추가한다.
Commit 1 shot_aware_bg_render_plan_llm_provider.py PROMPT_VERSION을 v2 pack으로 bump. prompt preflight / strict schema path 유지.
Commit 1 shot_aware_bg_render_plan_step.py PROMPT_VERSION / SCHEMA_VERSION bump. config_hash가 mode router change를 반영하게 한다.
Commit 2a shot_aware_bg_render_plan.py post-process router helper 추가. ordered graph node별 selected ref의 camera/look-at units, target unit markers, surface_role을 비교해 final mode와 render action을 normalize. diagnostics에 router decision counters와 reuse decisions를 남긴다. Anchor node는 반드시 render_new_plate여야 하며, reuse target은 same-fp earlier real plate로 검증한다.
Commit 2a shot_aware_bg_render_adapter.py ALLOWED_MODES_MODE_GUIDANCE 갱신. same physical space guidance는 fixed layout lock을 positive constraint로 표현한다.
Commit 2b background_render_step.py reuse_existing_plate action을 render queue에서 image API call 없이 active group entry로 materialize한다. render stage는 action을 새로 추론하지 않는다. Verify completion은 reused BG를 missing ImageAsset으로 오인하지 않도록 expected / rendered / reused를 분리한다. 구현이 커지면 2a만 먼저 닫고 2b는 별도 commit으로 둔다.
Commit 3 active-only audit helper promotion canary artifact helper / compare generation을 reusable read-only tooling으로 정리한다. production render selection이나 checkpoint semantics를 바꾸지 않는다.

7. Deterministic Router Contract

Router는 아래 판정만 수행한다. 어느 경우에도 runtime label substring matching으로 같은 방 여부를 결정하지 않는다.

  1. node가 fp_seeded_anchor이면 유지한다.
  2. node가 non-interior surface이면 same-space split 대상에서 제외한다.
  3. node의 selected ref가 아직 graph/catalog상 earlier node가 아니면 기존 validator가 fail한다.
  4. selected ref node와 child node의 unit set overlap이 있으면 same_physical_space_view로 normalize한다.
  5. unit overlap은 없지만 target unit markers가 겹치면 same_physical_space_view 후보로 normalize한다.
  6. LLM planner가 low-delta candidate를 emit하고, same-space deterministic signal도 강하면 reuse_existing_plate action을 허용한다. 둘 중 하나만 있으면 reuse하지 않는다.
  7. reuse_existing_plate node는 reuse_target_bg_id를 가져야 한다. target은 같은 fp의 earlier render_new_plate node여야 하며, reuse-of-reuse와 cyclic target은 fail-closed한다.
  8. anchor node는 반드시 render_new_plate여야 한다. Anchor가 reuse이면 graph invariant 위반이다.
  9. same-space signal은 강하지만 view delta가 크면 same_physical_space_view + render_new_plate로 normalize한다. 이 경우에도 representative reference attachment는 필수이며 text-only render로 후퇴하지 않는다.
  10. 위 deterministic signal이 없으면 related_style_new_space + render_new_plate로 normalize한다.
  11. LLM이 two_refs_distinct_spaces를 emit한 경우 기존 distinct physical-space validator를 유지한다. 두 refs 중 하나라도 same-space signal이 강하면 fail-closed하거나 single-ref route로 repair하지 않는다. 자동 repair는 이번 wave scope가 아니다.

현재 geometry readback의 visible_units_candidatesvisible_openings_candidates는 superset이다. 이 값만으로 adjacency를 확정하지 않는다. 이번 wave의 primary safe signal은 unit overlap / target unit overlap이며, true adjacency graph는 후속 schema wave로 넘긴다.

8. Prompt Contract Notes

9. Canary Plan

단계 내용 비용 / 영향
Preflight W21B-wave-2 active-only artifact review 결과 확인. active-only audit helper가 있으면 사용, 없으면 기존 artifact path 유지. read-only.
Force scope W20E7 project에서 shot_aware_bg_render_planbackground_promptbackground_render만 force하는 것을 기본으로 한다. master_plan/floor_plan stack은 wave-2 output을 재사용한다. planner LLM + image render. exact cap은 implementation dry-run 후 산정. reuse action이 작동하면 active 21 전체보다 낮아야 한다.
Image cap active 21 BG 재-render를 절대 상한으로 잡는다. 목표는 low-delta cluster reuse로 image call을 줄이는 것이다. cap 후보는 30이나, dry-run에서 예상 render_new_plate 수가 낮으면 더 낮춘다. floor_plan render는 재실행하지 않는다. image API cost. canary 직전 사용자에게 짧게 공유한다.
Artifacts /tmp/w21b_wave3_bg_canary_YYYYMMDD_HHMMSS/ 아래 before/after, active-only compare, summary.json, contact sheet를 둔다. read/write local artifact only.

Canary는 implementation commits 적용 뒤 실행한다. 이 brief 작성 단계에서는 실행하지 않는다.

10. Visual Acceptance

통과 기준 실패 예
Same-space layout lock 같은 physical space로 판정된 BG들 사이에서 fixed furniture / wall / window / door / counter 위치가 유지된다. 한 BG에는 오른쪽 냉장고, 다른 BG에는 같은 위치에 커튼 또는 다른 큰 가구가 생김.
Related-style freedom 다른 물리 공간으로 판정된 BG는 같은 dwelling style을 공유하되 layout invent가 허용된다. 서로 다른 unit인데 무리하게 같은 layout을 복사해 구조가 어색해짐.
Wave-2 no regression exterior / transition / site plates는 유지되고 fp-less direct plate path가 깨지지 않는다. L04/L09/L15 exterior/site plates가 사라지거나 text-only로 후퇴.
Wave-1 purity no regression 인체/사건/TV-content leakage가 다시 들어오지 않는다. BG plate 안에 손/팔/시신/뉴스 화면 의미 content가 다시 등장.
Low-delta suppression 배경 편차가 낮은 cluster는 대표 plate를 재사용하고, 새 image API call / 새 PNG를 만들지 않는다. Reuse relation이 summary와 checkpoint diagnostics에 보인다. L20B04/L20B05/L20B06 같은 저변화 cluster를 각각 새로 렌더링해 차이가 거의 없는 PNG가 3장 생성됨.
Same-space continuity 같은 physical space cluster의 후속 plate가 새로 필요한 경우 representative plate를 reference로 붙여 visual identity와 fixed layout을 이어간다. L04B01/L04B02처럼 같은 방 / 같은 물리 공간인데 reference 없는 text-only 생성으로 서로 다른 세계처럼 보임.

Visual acceptance는 사용자 + Codex review가 통과 기준이다. Deterministic tests는 shape와 router contract만 확인한다.

11. Deterministic Sanity Checks

이 sanity check는 implementation safety만 본다. visual 품질 판정은 §10으로만 한다.

11.1 Commit 1 deterministic test matrix

Test focus Required assertion Out of scope
v2 prompt pack loads schema/user/system files load; schema is valid JSON; provider resolves v2 pack name. LLM quality, visual output.
mode enum same_physical_space_view and related_style_new_space are accepted; legacy style_reference_new_space is not a target mode in v2 prompt instructions. Legacy checkpoint migration beyond fail-visible diagnostics.
LLM reuse-candidate shape v2 schema accepts low-delta candidate fields (same_physical_space_low_delta_candidate, low_delta_reuse_target_bg_id, rationale) but does not let the LLM emit final render_action. Actual image API call suppression, handled in Commit 2b.
canonical render action deferred Commit 1 tests assert final render_action is absent from the strict LLM schema. Commit 2a router is responsible for adding canonical render_action / reuse_target_bg_id. Router implementation, handled in Commit 2a.
anchor invariant anchor node cannot be reuse_existing_plate; anchor remains first real plate. Visual anchor selection quality.
reuse target invariant reuse target must be same-fp earlier render_new_plate; reuse-of-reuse and cyclic reuse fail deterministic validation. Semantic low-delta correctness, judged by canary.
AND boundary test fixtures cover: LLM low-delta only => no reuse; deterministic overlap only => no reuse; both => reuse candidate allowed. Pixel, OCR, embedding, or text-substring heuristics.

12. Parallel Work Split

작업 Codex Claude
Brief finalization 문서/acceptance/stop condition 정리, deterministic TDD 경계 정의, canary plan 산정. read-only cross-review, missing touchpoint 확인, implementation feasibility 의견.
Implementation Commit 1 prompt/schema contract와 테스트 케이스를 먼저 정의하고, patch 후 review. prompt/schema/step/provider version bump 주도.
Implementation Commit 2 router failure matrix / validator invariant / verify_completion expected behavior를 먼저 고정하고, patch 후 review. router + adapter + render materialization 구현 주도.
Tooling / observability active-only artifact helper spec, stale/no-delete constraints, canary report format. helper 구현이 필요하면 주도, Codex가 read-only behavior review.
Canary cap 산정, acceptance gate, visual/eval summary, closure 판단. runner 구현/운영 보조, data-only review, artifact 생성.

13. Stop Conditions

14. Claude Review Questions

  1. Same-space SOT를 unit/camera/look-at overlap + target unit overlap으로 두고, surface_role은 coarse guard로만 쓰는 데 동의하는가?
  2. Router 위치를 planner validation 뒤 / adapter 전으로 두는 것이 맞는가?
  3. style_reference_new_space를 v2 prompt output target에서 제거하고, final modes를 same_physical_space_view / related_style_new_space로 나누는 데 동의하는가?
  4. Low-delta case에서 LLM schema는 candidate field만 emit하고, canonical render_action / reuse_target_bg_id는 Commit 2a router가 추가하는 2-layer 구조에 동의하는가?
  5. Reuse 판정은 LLM low-delta 후보와 deterministic overlap corroboration의 AND 조건으로 제한하는 데 동의하는가?
  6. 같은 physical-space 후속 plate가 reference 없이 text-only direct plate로 갈 수 없게 하는 데 동의하는가?
  7. active-only audit helper를 separate wave-2.1이 아니라 wave-3 preflight/tooling으로 묶는 데 동의하는가?
  8. Canary를 master_plan/floor_plan stack 재실행 없이 shot-aware plan + background_prompt + background_render 범위로 제한하는 데 동의하는가?