W21B Wave 4 FP Fidelity Implementation Brief

Floor-plan PNG self-fidelity, marker semantic validation, and layout-faithful BG anchor rendering.

Date: 2026-05-29
Status: doc-only brief, code/API/DB/image changes 0
Project: κΈˆμ›”λ„ E2E W20E7 4f948193-6809-4ae3-a3c6-2ca4e8af1c1a
Episode: dc70c0b3-5c09-4664-8c0f-9cac38c0c6ca
Depends on: W21B-wave-3 local reuse/gate-fix commits, push currently held
Primary symptom: FP gallery shows floor plan and rendered background do not match

0. Decision

Do not treat this as a W21B-wave-3 reuse regression. The reuse router, copy-less alias materialization, low-frequency character-state fix, and scene regeneration completed their own scope. The FP gallery exposed a separate existing fidelity gap in the floor-plan-to-background chain.

Recommended sequence:

  1. Phase A: FP PNG self-fidelity + marker semantic gate. A floor-plan image must match its own t2i_prompt and numbered_elements before it can be used as an authoritative visual reference. This phase adds a VLM semantic gate that checks whether each visible marker's image content matches the expected metadata label/object role, with evidence fields such as source_ref, observed_object_summary, confidence, and reasoning_basis. Mismatches trigger bounded retry or fail-closed state, not silent downstream use.
  2. Phase B: fp_seeded_anchor layout-faithful BG anchor. Once the FP image is trustworthy, the BG anchor should preserve fixed structure, openings, persistent fixtures, persistent furniture, room scale, and spatial relationships from the validated FP. Style guidance can alter finish and realism, but must not replace FP layout with a different dwelling shape.

W21B-wave-3 commits should remain unpushed until the user confirms whether to close reuse as a separate deliverable or fold this wave into the same PR sequence.

1. Evidence

Evidence Observed fact Implication
background_render.data.groups.L05B06 floor_plan_used=true, ref_used=fp_only, attached_ref_labels=["fp:fp_l05_main"]. The FP was actually attached. This is not a missing-reference or gallery-mapping bug.
floor_plan_prompt.data.floor_plans.fp_l05_main.numbered_elements 17=main floor bedding mat, 18=main wardrobe closet, 24=wall-mounted family photo frame. Downstream prompt generation and shot-aware planning trust these number-to-label meanings.
fp_l05_main.png visual review The rendered FP looks like a larger multi-room apartment with a proper bed; visible marker placement does not visually align with the metadata labels. The FP image drifted from its own metadata and prompt. The problem starts before BG render.
L05B06.png visual review Rendered as a modest room with floor bedding, wardrobe, window, and curtain partition. The BG is largely faithful to metadata/prose, not to the visual FP PNG.
floor_plan_geometry_readback VLM/readback records marker number, coarse cell, and base kind. It does not validate that marker 17 is actually drawn on bedding. Semantic marker-label mismatch can pass current gates.
background_prompt/*/system.md and adapter guidance FP is described as a layout source, but prompts explicitly avoid preserving the top-down plan exactly; adapter style contract strongly pushes modest residential styling. Even when FP is attached, content/layout can be overridden by metadata prose and style guidance.

2. Root Cause

Important inversion: in the L05 case, the BG plate is closer to the floor-plan metadata than the FP PNG is. The floor-plan image is not a reliable visual source of truth.

  1. Floor-plan render self-fidelity gap. render_one_floor_plan renders a PNG from the prompt and optional refs, but there is no post-generation check that the PNG matches the prompt's layout, furniture, scale, or numbered elements.
  2. Marker semantic readback gap. floor_plan_geometry_readback and floor_plan_vlm_provider check marker number/kind/cell shape. They do not ask the VLM to confirm that each marker is placed on the expected object class or semantic label.
  3. BG anchor layout-faithfulness gap. fp_seeded_anchor attaches the FP, but renderer guidance treats base markers as spatial guidance and style/prose as content authority. This is too weak when the FP is supposed to be the visual layout anchor.

Upstream metadata risk: Phase A deliberately starts with the narrower contract "does the PNG match its own metadata?" It does not prove the metadata itself is the right scale or dwelling interpretation. If Phase A shows that the metadata is consistently wrong-scale or wrong-layout for the location, stop and move one layer upstream to floor-plan prompt/master-plan interpretation rather than forcing the PNG to faithfully render bad metadata.

3. Scope

In Scope

Non-goals

3.1 Specific Scenario Leakage Guard

Production logic must stay generic. The L05B06 / fp_l05_main case is evidence only. It may live in canary artifacts or review fixtures, but production prompts and code must not hard-code rooftops, bedding, wardrobes, family photos, scene numbers, Korean nouns, or any marker number as a semantic rule.

4. Proposed Implementation

Step Change Expected effect
1. FP prompt/render contract Add a new floor-plan prompt/render pack or selector that makes numbered-element fidelity explicit: every numbered element must appear exactly once at the corresponding object/area; do not substitute beds for floor bedding, multi-room apartments for compact rooms, or extra furniture not in the inventory. Reduces self-fidelity drift before any readback gate runs.
2. Semantic readback sidecar Extend or add a VLM readback sidecar with canonical field observed_marker_semantics[]. Each entry uses: number, expected_label, expected_layer, observed_object_summary, semantic_match, mismatch_reason, source_ref, confidence, reasoning_basis. The VLM should cite evidence from the image in generic visual terms, not scenario nouns embedded in code. Turns marker-label consistency into an explicit evidence-backed gate instead of assuming metadata and PNG agree.
3. Retry/fail policy If semantic readback finds structural/furniture marker mismatch, retry FP render within a small cap; after cap, mark the FP as needs_fix/failed for BG anchor consumption. Do not delete old assets. Prevents untrustworthy FP images from becoming authoritative visual references.
4. BG anchor guidance Update fp_seeded_anchor guidance to preserve validated FP fixed layout: room count, openings, windows, persistent furniture positions, fixture positions, and scale relationships. Style contract may adjust material finish but must not relocate or replace validated objects. Makes BG anchor use FP as a real layout source rather than weak spatial inspiration.
5. Review artifact Generate active-only review rows with old/new scene, BG, FP, and used marker list. Highlight bg_id, fp_id, camera_unit, look_at_unit, and use_numbered_elements. Separates true mismatch from normal top-down-plan vs camera-view differences.

5. Touchpoints

Area Likely files Notes
Floor-plan prompt prompts/_base/floor_plan_prompt/*, backend/app/modules/pipeline/floor_plan_prompt.py, backend/app/core/steps/floor_plan_prompt_step.py New pack or selector. Keep schema changes deterministic. Preserve scenario-general language.
Floor-plan render backend/app/modules/pipeline/floor_plan_render.py, backend/app/core/steps/floor_plan_render_step.py Potential retry integration after semantic readback. Rendering itself remains image API call; no destructive cleanup.
Geometry/semantic readback backend/app/modules/pipeline/floor_plan_vlm_provider.py, backend/app/modules/pipeline/floor_plan_geometry_readback.py, backend/app/core/steps/floor_plan_geometry_readback_step.py Existing readback observes number/cell/kind. New semantic sidecar should validate expected object semantics.
Base dossier backend/app/modules/pipeline/base_location_dossier.py Should consume validated semantic readback state and surface warnings/blockers to downstream planners.
BG anchor render backend/app/modules/pipeline/shot_aware_bg_render_adapter.py, prompts/_base/background_prompt/* Strengthen layout preservation only after FP has passed semantic fidelity gate.
Review tooling /tmp operator runner or reusable read-only helper Show FP/BG/scene and marker usage together. Do not mutate DB or files.

6. Canary Plan

Default mode is dry-run. Any runner or script for this wave must default to --generate=false or equivalent. The first pass designs and validates prompt/schema/contracts only. Real image or VLM calls require an explicit generate flag and a short scope/cap notice.

  1. Read-only preflight: run a small FP fidelity audit over W20E7 active FP set. Report marker semantic mismatch candidates, not as hard acceptance.
  2. FP-only canary: force floor-plan prompt/render/readback for W20E7 with a tight image cap. Do not rerun BG or scene yet.
  3. Visual acceptance: inspect FP PNGs first. Canary evidence may use the L05 case, where the FP should read as compact rooftop rental room with floor bedding and correct marker positions rather than a large furnished apartment. This example is review-only evidence, not production prompt or code logic.
  4. BG-anchor canary: after FP acceptance, force downstream dossier, shot-aware plan if needed, background prompt/render for affected BGs. Cap separately.
  5. Scene rerun: only after FP and BG visual acceptance, force scene-image pipeline if required. Preserve old images by demotion, not deletion.

7. Acceptance

Visual Acceptance

Deterministic Sanity Checks

These checks do not decide image quality. Visual review, canary outputs, and focused experiments remain the acceptance gate for uncertain image outputs. Do not claim fidelity quality from pass counts alone.

8. Work Split

Owner Responsibility
Claude Main production/prompt patching, operator runners, canary execution, and implementation notes.
Codex Direction/brief, light deterministic test matrix, cross-review, visual/evidence evaluation, and closure guidance.

9. Stop Conditions

9.1 Asset Safety

10. Retrospective Note

W21B-wave-3's active scene regeneration passed mechanical gates, but the FP comparison gallery exposed that mechanical success did not cover FP-to-BG semantic fidelity. Future visual reviews should include the specific visual source that downstream prompts claim to use, plus the metadata markers that bridge them.