Skip to content

Omnidreams: live mid-stream editing — prompt hot-swap, edit guidance, actor spawn/despawn - #431

Open
wenqingw-nv wants to merge 15 commits into
NVIDIA:mainfrom
wenqingw-nv:omnidreams-live-edit-pr
Open

Omnidreams: live mid-stream editing — prompt hot-swap, edit guidance, actor spawn/despawn#431
wenqingw-nv wants to merge 15 commits into
NVIDIA:mainfrom
wenqingw-nv:omnidreams-live-edit-pr

Conversation

@wenqingw-nv

@wenqingw-nv wenqingw-nv commented Aug 8, 2026

Copy link
Copy Markdown
Collaborator

Omnidreams fixes the prompt at rollout start — the serving path encodes it once and discards later prompts — so the world can't be edited while driving. This PR adds live mid-stream editing: swap the prompt at any chunk boundary with full scene continuity, optionally amplify the edit with two-prompt guidance, and spawn/despawn grounded actors from user commands. Everything is opt-in at the event layer; a session that never edits runs the untouched hot path.

Contents

  • core/attention/kvcache.pyclone_kv() / overwrite_kv_(): full-buffer KV overwrite through copy_, so storage addresses survive and captured CUDA graphs stay valid across a swap.
  • omnidreams/transformer + pipeline.pyreplace_text_embeddings / replace_text: rebuild the per-block text cross-attn KV in place at a chunk boundary; the self-attn history is untouched, so the scene carries forward under the new prompt. TextEditGuidance: for N post-swap chunks, each denoise step runs the cond branch under old and new text against the same history and extrapolates flow_old + s(flow_new − flow_old) (one captured graph, outputs cloned per replay; the KV commit always runs single-branch under the new prompt). recache_last_chunk: LongLive/GameCraft-2-style ReCache — a same-index cache-bracket re-open re-commits the previous chunk's KV under the new text.
  • omnidreams/webrtc — datachannel event messages carry free-text prompts (a clear state restores the scene prompt); /spawn <preset> [dist_m] [speed_mps] [lateral_m] and /clear-actors place constant-velocity world-frame actor boxes into the HDMap conditioning through the same converter as the gRPC dynamic-actor path; /spawnt <fwd_m|auto> [lateral_m] [template_idx] clones a real parked-track template to a user target — the first spawn path that materializes anything (see the stress-tested placement rules below). Client gains a Scene Prompt panel + spawn buttons; typing in text fields no longer drives WASD.
  • tests/ — 23 ci_cpu tests: swap reproduces a fresh cache init at stable addresses; guidance combine / countdown / finalize suppression; same-index rewrite semantics; spawn geometry and pool timing; template extraction filters, gap search, and clone rigidity.
  • scripts/ — three GPU probes (RNG-matched per-chunk divergence vs control): smoke_text_edit.py, sweep_text_edit.py, smoke_spawn_actor.py (drives the WebRTC runtime headless).
  • guidance_distill/PLAN.md — follow-up recipe to distill the guidance into a post-swap-gated LoRA (guided strength at plain-swap cost).

Measured (704×1280, 2-step distilled student, swap at chunk 8, RNG-matched vs control, GB300)

Swaps are bit-clean: 0.000 pre-swap pixel divergence. Post-swap, per-chunk mean |Δ| in uint8 units:

edit s gap @ +6 chunks visual outcome
rain-night (training-style phrasing) 3 35 glossy wet road, streetlight reflections, windshield droplets
snow (training-style phrasing) 3 23 progressive full snow cover, artifact-free
night / sunset / fog 3 37 / 20 / 19 all land
snow (freeform phrasing) 5 52 dramatic but transition artifacts — s=3 + caption-style phrasing is the envelope

Actor spawn — corrected after a reviewer-caught misattribution, now with a partially materializing path. The /spawn preset plumbing verifiably places grounded, correctly-classed boxes into the HDMap conditioning, but synthetic preset boxes do not materialize objects — on the distilled student or on the 35-step bidirectional teacher (mask-level checks against an RNG-matched baseline show empty road at the box locations; earlier "spawned car" observations were the scene's own recorded traffic re-rendered after divergence). The model keys on perception-track statistics that hand-built presets lack, so /spawnt clones a real parked-vehicle track out of the scene's own cube pools — per-frame jitter, true dimensions, orientation, colors — and rigidly moves it to the user target; auto picks the largest actor-free gap on the requested lateral line, so a materialized clone provably isn't recorded traffic. Honest quality bar (mask-verified across three configs — right curb auto, left curb auto, two stacked clones): 2 of 3 placements materialize a semi-transparent, blurry vehicle where the RNG-matched control shows empty road — box-interior darkening ~9–10 uint8 vs ~52 for a scene-native parked car, i.e. roughly 20% of full render strength — and the left-curb placement failed to materialize at all (near-zero darkening; in-box divergence 13–16 is texture shift, not an object). Cloning is the existence proof that user boxes can materialize training-free; solid rendering is the open problem. Leading explanation: the context frames and all KV history predate the box, so the 2-step student splits the difference between conditioning and history (scene-native parked cars are in the first-frame pixels; recorded moving traffic materializes solidly from boxes alone, suggesting a fixed-spot history conflict rather than a conditioning limitation). Preset /spawn remains as game world-state (collision logic, gRPC parity); solid materialization is the follow-up (history re-commit on spawn, mild box-axis guidance over the clone signal, moving-track clones, instruction-SFT). Spawned boxes are grounded on the road plane (the ego pose is the rig origin, ~1.5 m up).

Spawn stress tests (later commits: probe_moving_clone.py, probe_pedestrians.py)

Placement-manifold rule, mask-verified against RNG-matched no-spawn controls: clones materialize only where their class plausibly lives in the AV training distribution.

scenario in-box divergence (uint8, vs ~52 real-car contrast) outcome
parked-car clone, curb 9–10 darkening (~20%) semi-transparent ghost
parked clone + box-axis guidance s=2 ~20 (~40%) solid by late frames
moving-track clone (oncoming) 18–21 from entry solid but smeared
moving clone + s=2/s=3 guidance 41–53 (≈ benchmark) fully opaque; smooth "toy-car" texture
pedestrians mid-road, 1/5/20 2–8 (noise) never materialize, any density
pedestrians on sidewalks, 3/20/40 19–23 materialize and scale

Box-axis guidance (GUIDE_SCALE on the probes) is the two-prompt-guidance analog on the HDMap axis — it amplifies a clone's real signal (s=2–3 usable) but cannot create one for off-manifold placements (mid-road crowds, synthetic presets). Texture realism beyond this is SFT territory (separate track).

sbs_spawnt_ped40_annotated.mp4

Overhead

  • Idle: zero — no new work on the hot path, and text_edit_guidance=None short-circuits to the existing single-branch forward.
  • On swap: one text-encoder forward + in-place KV copies at a chunk boundary; ReCache adds one off-hot-path context forward (~42 ms).
  • Guidance active (default s=3 for 6 chunks): +1 DiT forward per denoise step, 84 → ~168 ms/chunk — within the 266 ms/chunk playback budget.

Guidance distillation (Tier-2a, later commits)

guidance_distill/PLAN.md documents the recipe (the trainer scripts build on the Clean Forcing training infra and land with #398); the deploy hook here is self-contained. The recipe trains a LoRA to reproduce the guided flow from a plain swap — teacher is the frozen base running the guidance combine on the same on-policy states, so no external data or models. The r64 / 1600-step checkpoint passes the eval gate: the LoRA'd plain swap reaches 0.854 of guided divergence on held-out clips (bar 0.8; untrained base 0.376), visually clean. Deployed via omnidreams/_edit_lora.py: both weight sets pre-merged at load, edit windows toggle by in-place copy_ (CUDA-graph-safe, ~0.2 ms at window boundaries only) — guided-strength edits at plain-swap cost, replacing the +84 ms/chunk two-branch combine. Opt-in via text_edit_lora_path; without it, plain swaps are bit-identical to the hookless run (GPU-verified). Checkpoint (211 MB, md5 1fc7b33ea037f745eeb8d5a1bee59371): https://github.com/wenqingw-nv/flashdreams-wq/releases/tag/live-edit-guidance-lora-v1 (fork release, per the drift-corrector precedent; happy to move to HF on maintainer preference).

Not included (follow-ups)

gRPC field for mid-stream prompts; the native optimized-DiT (FP8) path raises NotImplementedError on swap (default configs unaffected); instruction-SFT for grounded props, object-by-prompt edits, and trajectory-locked moving actors.


Video comparison (original | edited)

All clips are RNG-matched: identical seed, controls, and conditioning until the edit; labels burned in. Left: base rollout. Right: same rollout with the live edit.

Prompt swap → heavy rain (guided s=3, swap at 2 s): wet glossy road, streetlight/taillight reflections, windshield droplets — same street, same trajectory.

sbs_rain_edit.mp4

Prompt swap → snowstorm (training-style phrasing, s=3): progressive snow cover on road, trees, and parked cars, artifact-free.

sbs_snow_edit.mp4

/spawn car 16 mid-drive (superseded — kept for the correction record): the car visible here is the scene's own traffic re-rendered after divergence, not the commanded box; see the corrected Actor-spawn paragraph above.

sbs_spawnt_moving_s3_annotated.mp4

Spawn + /clear-actors (superseded — kept for the correction record): same confound as above; the appearing/vanishing car tracks the scene's recorded traffic under divergence rather than the commanded box.

sbs_spawn_remove.mp4

Props via prompt assist: an oversized "Other"-class cone box alone under-renders, but combined with a construction-zone prompt swap the model paints real orange traffic cones along the road — visual dressing rather than grounded objects, which is the documented props limit.

sbs_cone_prompt_assist.mp4

/spawnt template clone (verified, ghost-strength): a real parked-track clone placed in an auto-selected empty gap materializes as a semi-transparent vehicle on the right curb (~20% of a scene-native car's contrast); the RNG-matched control (left) shows empty curb at the same location. Three reliability clips staged in integrations/omnidreams/scripts/outputs/pr_videos/sbs_spawnt_rel{1,2,3}.mp4 — rel1/rel3 show the ghost vehicle, rel2 (left curb) failed to materialize and is kept for the record.

/spawnt moving clone + s=3 guidance (annotated): the red box tracks the user-spawned clone — a fully opaque car passing in the left lane; scene traffic is unmarked.

Sidewalk pedestrians (annotated, 20 and 40): person-sized clones on both sidewalks materialize as standing figures; the same grids placed mid-road never materialize (the placement-manifold rule above).


Update: composite overlay stack (cf686c8a)

Spawn-SFT probes established that the student will not materialize arbitrary new actors from boxes alone (placement-manifold rule above). The practical route we landed on for game-style object/actor insertion is composite, then renoise-refine:

  • composite_assets.py — pastes photoreal cutouts (or custom sprites) at box-projected screen positions. Placement masks come from diffing the boxed vs baseline conditioning renders, so positions are exact in screen space (fisheye included); IoU tracking + EMA smoothing keep sprites glued to their boxes, and contact shadows + luminance/chroma harmonization match the plate.
  • composite_track_items.py — item courses without hdmap or GPU: a pinhole camera is fitted from the clip's lane geometry, then animated pickups and moving traffic are projected along the lane.
  • probe_composite_refine.py — re-rolls the composited clip through the student from moderate noise (sweet spot σ≈0.47): pasted content inherits model texture and lighting while the scene stays pinned (reported as in-box divergence vs out-of-box cleanliness).
  • enhance_frames.py — optional learned restoration pass (4 Real-ESRGAN variants with measured fps).
  • probe_pedestrians.py gains the teacher/guidance/crowd-follow/ego-stop/walk-speed modes used for the crowd-persistence findings.

wenqingw-nv and others added 3 commits August 8, 2026 09:59
…che)

Rebuild the per-block cross-attention text KV in place at a chunk
boundary (storage addresses survive, so captured CUDA graphs stay
valid) while the self-attention history carries the scene forward under
the new prompt. Optional two-prompt edit guidance runs the cond branch
under old and new text against the same history and extrapolates
flow_old + s*(flow_new - flow_old) for N chunks after a swap; the KV
commit always runs single-branch under the new prompt. ReCache
(LongLive / Hunyuan-GameCraft-2) re-commits the previous chunk's KV
under the new text via a same-index cache-bracket re-open.

GPU-verified: swaps are RNG-clean (zero pre-swap divergence), and
weather/lighting edits land convincingly at s=3 with
training-caption-style phrasing.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Route datachannel event messages to a free-text prompt swap (event_id
carries the prompt; clear states restore the scene prompt) and to
/spawn <preset> [dist] [speed] [lateral] / /clear-actors commands.
Spawned actors follow a constant-velocity world trajectory and enter
the conditioning through the same Ludus bbox path as gRPC dynamic
actors, so the model materializes grounded vehicles/pedestrians the
game shell can track. The web client gains a scene-prompt panel and
spawn buttons; WASD typed into text fields no longer drives the car.

GPU-verified: a spawned car materializes photorealistically within one
chunk and vanishes within one chunk of /clear-actors. Guidance defaults
(s=3, 6 chunks) follow the calibration sweep.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
smoke_text_edit rolls RNG-matched control/swap/guided/recache variants
and reports per-chunk divergence; sweep_text_edit calibrates an edit
prompt bank (incl. the scene bundle's native weather phrasings) against
one control; smoke_spawn_actor drives the WebRTC runtime headless and
exercises /spawn and /clear-actors. guidance_distill/PLAN.md specifies
the Tier-2a LoRA recipe that bakes two-prompt edit guidance into the
student (post-swap-gated, premerge-deployed).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@copy-pr-bot

copy-pr-bot Bot commented Aug 8, 2026

Copy link
Copy Markdown

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

@greptile-apps

greptile-apps Bot commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

The PR adds live prompt replacement, transient edit guidance and LoRA deployment, plus WebRTC actor editing. The attempted ReCache correction preserves the rollout RNG stream but still re-finalizes history using a different context-noise realization.

  • Adds pointer-stable text cross-attention KV replacement and edit-guidance windows.
  • Adds prompt and actor commands to the WebRTC session and browser UI.
  • Adds template-based actor placement, probes, and CPU tests.
  • Adds an optional pre-merged edit LoRA deployment path.

Confidence Score: 4/5

The PR is not yet safe to merge because ReCache can replace finalized KV history with a representation derived from context noise different from the rendered chunk.

ReCache preserves the rollout generator state but FinalState retains only the clean latent, so repeated finalization under the dedicated generator necessarily samples a new noisy latent and overwrites same-index history with an inconsistent representation.

Files Needing Attention: integrations/omnidreams/omnidreams/pipeline.py

Important Files Changed

Filename Overview
integrations/omnidreams/omnidreams/pipeline.py Adds prompt replacement and ReCache, but ReCache still rewrites finalized history from newly sampled context noise.
integrations/omnidreams/omnidreams/transformer/init.py Adds text-edit guidance state, prompt-KV replacement, and LoRA window handling.
flashdreams/flashdreams/core/attention/kvcache.py Adds pointer-stable full-buffer cloning and overwrite operations for captured CUDA graphs.
integrations/omnidreams/omnidreams/webrtc/session.py Integrates prompt-edit and actor commands into live WebRTC sessions.
integrations/omnidreams/omnidreams/webrtc/actors.py Adds synthetic and template-derived actor placement and lifecycle logic.
integrations/omnidreams/omnidreams/_edit_lora.py Adds in-place toggling between cached base and LoRA-merged projection weights.

Sequence Diagram

sequenceDiagram
  participant Client
  participant Pipeline
  participant Transformer
  participant FinalState
  participant KVCache
  Client->>Pipeline: replace_text(new prompt)
  Pipeline->>Transformer: replace_text_embeddings()
  Transformer->>KVCache: overwrite text cross-attention KV
  Pipeline->>FinalState: recache_last_chunk()
  FinalState->>Pipeline: retained clean latent
  Pipeline->>Pipeline: draw newly seeded context noise
  Pipeline->>Transformer: finalize_kv_cache(new noisy latent)
  Transformer->>KVCache: same-index history overwrite
Loading

Reviews (9): Last reviewed commit: "Add composite overlay stack; extend pede..." | Re-trigger Greptile

Comment thread integrations/omnidreams/omnidreams/pipeline.py Outdated
wenqingw-nv and others added 5 commits August 8, 2026 11:01
The ego pose is the rig origin (~1.5 m above the road), so spawned boxes
floated at eye level — off-distribution for the bbox conditioning, and
the model under-rendered them (a moving truck box was ignored entirely).
Offset the bbox center by the rig height; verified against the scene's
own actor boxes in the rendered conditioning.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
/spawn <preset> [dist] [speed] [lateral] [yaw_deg] — box heading
relative to the ego (0 = same direction, 180 = oncoming). The rendered
box's front/back face colors encode travel direction. Probing found the
model paints static boxes in place (parked-vehicle prior) but renders
constant-gap moving boxes as a plausible oncoming pass regardless of
yaw; the argument stays for scene priors where lead vehicles exist.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Distill the two-prompt text-edit guidance into a LoRA so a plain prompt
swap responds at guided strength: on-policy rollouts with a mid-stream
swap, teacher = the frozen base running the guidance combine on the same
states, student = the LoRA'd single branch under the new prompt
(per-term immediate backward under functional attention — the teacher's
in-place KV loads would otherwise invalidate the student's checkpoint
recompute). Prompt bank reuses the calibration-sweep phrasings plus
no-op swaps as a drift regularizer; embeddings precomputed so the 14 GB
text encoder is not resident during training.

r64 / 1600 steps passes the eval gate on held-out clips: the LoRA'd
plain swap reaches 0.854 of guided divergence (bar 0.8; base 0.376),
visually clean, generalizing across scene types.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
omnidreams/_edit_lora.py caches base and base-plus-delta weight sets at
load and toggles them by in-place copy_ at edit-window boundaries, so
weight storage addresses survive and captured CUDA graphs stay valid
(the drift corrector's pointer-rebinding swap is not graph-safe). With
the hook attached (text_edit_lora_path on the wrapper / WebRTC runtime
config, EDIT_LORA on the probe script), replace_text_embeddings builds a
use_lora window: single forward per denoise step at guided strength, KV
commits included, base weights restored on expiry and on new rollouts.

GPU-validated on the rain benchmark: plain swaps stay bit-identical to
the hookless run, and the LoRA window's divergence curve tracks the
two-branch guided reference (same endpoint) with zero extra forwards —
replacing the +84 ms/chunk guidance cost.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Review follow-up (PR NVIDIA#431): the ReCache context forward drew its noise
from the model RNG, so enabling ReCache shifted every subsequent noise
draw relative to a plain-swap rollout. Any noise rendition of the same
clean latent is in-distribution for the context forward (each chunk's
original commit already uses an independent draw), but drawing from a
per-AR-index seeded generator makes the re-commit deterministic and
leaves the rollout's noise stream untouched with or without ReCache.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@wenqingw-nv

Copy link
Copy Markdown
Collaborator Author

Re the ReCache noise concern: addressed in 5541985, with context on why the behavior was in-distribution either way.

The context forward is trained on randomly re-noised latents, and every chunk's original KV commit already uses an independent noise draw — so a ReCache re-commit under a fresh draw produces a valid representation of the same clean latent (our GPU probes showed improved post-swap compliance and no artifacts). The commit that mattered: ReCache previously consumed the model RNG, shifting every subsequent noise draw relative to a no-ReCache rollout. It now draws from a dedicated per-AR-index seeded generator, making the re-commit deterministic and leaving the rollout's noise stream identical with or without ReCache (unit-tested).

@wenqingw-nv

Copy link
Copy Markdown
Collaborator Author

/ok to test 5541985

Main moved the runner video helpers to flashdreams.infra.runner_io
(load_video_tensor / load_first_frame_tensor / write_video_tensor) —
port the three GPU probe scripts to the new API. The guidance_distill
trainer/eval/precompute scripts import the Clean Forcing training infra
(drift_correction/), which is not on main yet — keep PLAN.md here and
land the scripts with that stack (NVIDIA#398); the deploy hook (_edit_lora.py)
is self-contained and stays. Also satisfy ty: cast the torch.compile
unwrap, require the test checkpoint path, annotate the two intentional
test monkeypatches; ruff-format the touched files.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Comment thread integrations/omnidreams/omnidreams/pipeline.py
Synthetic preset boxes render into the conditioning but never materialize
(student and 35-step teacher, mask-verified). Bit-for-bit clones of real
perception tracks do. /spawnt <fwd|auto> [lateral] [template_idx] extracts
parked car-sized tracks from the scene's cube pools and rigidly moves one
to the target; auto placement targets the largest actor-free forward gap.
Mask-verified across three configs (right/left curb, two-clone): in-box
divergence 18-22 vs 6-8 texture noise, coherent vehicles on eyes-on crops.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Comment on lines +476 to +477
diffusion_model._rng = torch.Generator(device=self.device).manual_seed(
self._RECACHE_NOISE_SEED + final_state.autoregressive_index

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 ReCache resamples finalized history

When a prompt swap runs after a chunk finalized with nonzero context noise, ReCache installs a newly seeded generator and finalizes the retained clean latent again. This overwrites the rendered chunk's KV with a representation derived from different context noise, causing continuity loss or transition artifacts in the next chunk.

Knowledge Base Used: Core Engine (flashdreams/flashdreams/core/)

aidanfnv pushed a commit to aidanfnv/flashdreams that referenced this pull request Aug 13, 2026
Squash the ten commits from NVIDIA/flashdreams PR NVIDIA#431, including prompt hot-swap, edit guidance, ReCache, distilled edit-LoRA deployment, actor spawn/despawn commands, template spawning, probes, and CPU coverage.

Source-PR: NVIDIA#431

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
Signed-off-by: Aidan Foster <aidanf@nvidia.com>
wenqingw-nv and others added 4 commits August 14, 2026 22:20
Parked-template clones render at ~20% strength (fixed-spot history
conflict). A cloned oncoming track rigidly shifted +25 m materializes as
an opaque vehicle through its whole pass (in-box divergence 18-21 uint8
from entry, vs texture noise 3-5), texture smeared mid-pass. Box-axis
guidance s=2 over a parked clone doubles darkening to ~40% of a real
car with no scene damage (out-of-box +2 uint8); s=1.5 gains nothing.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Moving clone + s=2 guidance renders a fully opaque vehicle (in-box
divergence median 41.5 uint8, approaching the ~52 real-car benchmark)
with no scene damage; unguided moving clone is solid but smeared.
Prompt synergy over a parked clone gains nothing (darkening 5.2 vs 7.1
plain) - text edits act globally, not at the box.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
probe_pedestrians clones person-sized scene tracks onto placement grids
(mid-road ladder, sidewalk bands, scene-prompt synergy via EDIT_PROMPT).
Verified findings: mid-road crowds never materialize at any density;
sidewalk placements do (median in-box 19-23 uint8 at 3/20/40 people) —
clones materialize only where their class plausibly lives. REPULSE_EVERY
on the text-edit smoke re-opens edit windows periodically (tested: does
not fix long-hold style drift; the drift lives in the KV history).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Comment thread integrations/omnidreams/omnidreams/pipeline.py
…owd modes

composite_assets.py: paste photoreal cutouts (or custom sprites) into
rendered clips at box-projected screen positions - conditioning-render
diff masks give exact placement incl. fisheye, with IoU tracking, EMA
smoothing, contact shadows and luminance/chroma harmonization.
composite_track_items.py: lane-calibrated item courses (camera fitted
from lane geometry) - animated pickups and moving traffic, no hdmap or
GPU needed. probe_composite_refine.py: sigma-swept renoise-refine that
re-rolls the composite through the student so pasted content inherits
model texture (sweet spot sigma~0.47; in-box divergence vs out-of-box
cleanliness reported). enhance_frames.py: learned restoration pass
(4 Real-ESRGAN variants, measured fps). probe_pedestrians.py gains
teacher/guidance/crowd-follow/ego-stop/walk-speed modes used for the
crowd persistence findings.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Comment on lines +475 to +478
if seeded:
diffusion_model._rng = torch.Generator(device=self.device).manual_seed(
self._RECACHE_NOISE_SEED + final_state.autoregressive_index
)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 ReCache still resamples finalized history

When a mid-stream prompt swap enables ReCache after a chunk finalized with nonzero context_noise, this dedicated generator makes the repeated finalization draw a different noise realization because FinalState retains only the clean latent. The same-index rewrite therefore replaces the rendered chunk's KV entries with a representation derived from a different noisy latent, causing boundary discontinuity or transition artifacts in the next chunk.

Knowledge Base Used:

aidanfnv added a commit that referenced this pull request Aug 26, 2026
…cles, weather (stacked on #463) (#494)

* Initial impl

Signed-off-by: Aidan Foster <aidanf@nvidia.com>

* More overlays

Signed-off-by: Aidan Foster <aidanf@nvidia.com>

* Add handbrake and pedal brake->reverse behaviour

Signed-off-by: Aidan Foster <aidanf@nvidia.com>

* Improve pickup dropoff placements

Signed-off-by: Aidan Foster <aidanf@nvidia.com>

* add global timer and scoreboard

Signed-off-by: Aidan Foster <aidanf@nvidia.com>

* minor improvements

Signed-off-by: Aidan Foster <aidanf@nvidia.com>

* Fix idling speed

Signed-off-by: Aidan Foster <aidanf@nvidia.com>

* Show highscore in HUD, remove pickup bonus time

Signed-off-by: Aidan Foster <aidanf@nvidia.com>

* Faster acceleration

Signed-off-by: Aidan Foster <aidanf@nvidia.com>

* Make pickup/dropoffs more random

Signed-off-by: Aidan Foster <aidanf@nvidia.com>

* Fix taxi integration on PhysX baseline

Signed-off-by: Aidan Foster <aidanf@nvidia.com>

* Keep taxi driveable after collisions

Signed-off-by: Aidan Foster <aidanf@nvidia.com>

* Strengthen curb steering and reverse transition

Signed-off-by: Aidan Foster <aidanf@nvidia.com>

* Make taxi handling more arcade-like

Signed-off-by: Aidan Foster <aidanf@nvidia.com>

* Place initial taxi pickup ahead of player

Signed-off-by: Aidan Foster <aidanf@nvidia.com>

* Make braking and handbrake turns arcade-sharp

Signed-off-by: Aidan Foster <aidanf@nvidia.com>

* Make curb recovery follow arcade steering

Signed-off-by: Aidan Foster <aidanf@nvidia.com>

* Keep collision physics aligned with world rendering

Signed-off-by: Aidan Foster <aidanf@nvidia.com>

* Keep vehicle attitude and steering responsive

Signed-off-by: Aidan Foster <aidanf@nvidia.com>

* Reduce traffic and bevel vehicle collision shapes

Signed-off-by: Aidan Foster <aidanf@nvidia.com>

* Synchronize native taxi markers with displayed frames

Signed-off-by: Aidan Foster <aidanf@nvidia.com>

* Make arcade steering responsive and consistent

Signed-off-by: Aidan Foster <aidanf@nvidia.com>

* Unify presented state with authoritative physics frames

Signed-off-by: Aidan Foster <aidanf@nvidia.com>

* Keep physics yaw within world model conditioning

Signed-off-by: Aidan Foster <aidanf@nvidia.com>

* Support Python 3.10 high-score timestamps

Signed-off-by: Aidan Foster <aidanf@nvidia.com>

* Keep ego heading on the conditioning trajectory

Signed-off-by: Aidan Foster <aidanf@nvidia.com>

* Restore progressive keyboard steering

Signed-off-by: Aidan Foster <aidanf@nvidia.com>

* Vary taxi pickups after the first fare

Signed-off-by: Aidan Foster <aidanf@nvidia.com>

* Cap initial pickup distance

Signed-off-by: Aidan Foster <aidanf@nvidia.com>

* Isolate taxi physics from Ludus renderer

Signed-off-by: Aidan Foster <aidanf@nvidia.com>

* Move taxi game into crazy_robotaxi package

Signed-off-by: Aidan Foster <aidanf@nvidia.com>

* Restore Crazy Robotaxi physics policy

Signed-off-by: Aidan Foster <aidanf@nvidia.com>

* Isolate Crazy Robotaxi from Interactive Drive

Signed-off-by: Aidan Foster <aidanf@nvidia.com>

* Add routed turn guidance to Crazy Robotaxi

Signed-off-by: Aidan Foster <aidanf@nvidia.com>

* Improve Crazy Robotaxi intersection guidance

Signed-off-by: Aidan Foster <aidanf@nvidia.com>

* Synchronize Crazy Robotaxi BEV frames

Signed-off-by: Aidan Foster <aidanf@nvidia.com>

* Expand Crazy Robotaxi pickup choice

Signed-off-by: Aidan Foster <aidanf@nvidia.com>

* Remove Crazy Robotaxi turn guidance

Signed-off-by: Aidan Foster <aidanf@nvidia.com>

* Limit visible Crazy Robotaxi pickups

Signed-off-by: Aidan Foster <aidanf@nvidia.com>

* Keep Crazy Robotaxi fares inside map bounds

Signed-off-by: Aidan Foster <aidanf@nvidia.com>

* Align Crazy Robotaxi generated frames with world state

Signed-off-by: Aidan Foster <aidanf@nvidia.com>

* Fix Crazy Robotaxi native BEV targets

Signed-off-by: Aidan Foster <aidanf@nvidia.com>

* Point pickup compass at nearest target

Signed-off-by: Aidan Foster <aidanf@nvidia.com>

* Prefer longer Crazy Robotaxi fares

Signed-off-by: Aidan Foster <aidanf@nvidia.com>

* Keep taxi targets farther from map edges

Signed-off-by: Aidan Foster <aidanf@nvidia.com>

* Enclose the Crazy Robotaxi play area

Signed-off-by: Aidan Foster <aidanf@nvidia.com>

* Fix Crazy Robotaxi play-area enclosure

Signed-off-by: Aidan Foster <aidanf@nvidia.com>

* Enclose interior road-network boundaries

Signed-off-by: Aidan Foster <aidanf@nvidia.com>

* Add pedestrians to Crazy Robotaxi pickups

Signed-off-by: Aidan Foster <aidanf@nvidia.com>

* Place Robotaxi stops along road edges

Signed-off-by: Aidan Foster <aidanf@nvidia.com>

* Extract Crazy Robotaxi as a standalone app

Signed-off-by: Aidan Foster <aidanf@nvidia.com>

* Fix Crazy Robotaxi runner manifest options

Signed-off-by: Aidan Foster <aidanf@nvidia.com>

* Add playable live-edit abilities to Crazy Robotaxi (skins + coins)

Wire the flag-gated live_edit package into the composition root:

- CLI: --live-edit-* flags registered in runtime_cli.build_parser and
  plumbed through cli._build_application / runtime_cli.run into
  CrazyRobotaxiApp(live_edit_config=...).
- Session: install_style_ability_on_backend swaps in a CUDA-graph-free
  flashdreams session when the drift corrector is configured and attaches
  the text-edit LoRA + corrector after model warmup.
- Presenter: CausalFrameAlignmentPresenter(LiveEditPresenter(inner)) so
  coin compositing sees frame-aligned poses; pixel-drawn SKIN / COINS
  chips; per-rollout coin ability bound via set_coin_ability.
- Input: K cycles the world skin, C toggles coins, in both the native
  HUD and the MJPEG /control path; rising-edge requests live on
  CrazyRobotaxiKeyboardState.live_edit and are drained each tick by
  CrazyRobotaxiRuntime.process_events.
- Coins: course laid along ALL driving-lane centerlines (previously only
  allows_taxi_stops lanes, which kept coins outside the pickup radius);
  pickups run on the authoritative per-frame trajectory states.
- Style: duty-cycled re-swap (--live-edit-style-reswap-chunks, default 8)
  re-issues the active skin's replace_text so long holds stay crisp,
  respecting the finalize -> replace_text ordering.

Validated end-to-end on GPU via the headless MJPEG app: photoreal start,
mid-run key-cycle to cyberpunk at chunk 9, re-swaps at 17/25 keeping the
style crisp through chunk 32, 57 coin pickups on-route.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* Add obstacle and weather live-edit events to Crazy Robotaxi

Obstacle events (O key): clone a real moving vehicle track from the
scene's perception tracks, retime it to now, and rigidly shift it ahead
of the ego through the advance_frames dynamic-actor seam (synthetic
boxes render in the conditioning but never materialize; clones do).
Merging same-direction templates at city speed are preferred. Optional
box-axis guidance (validated operating point s=2.0: in-box |diff| ~18
vs ~7 unguided, out-box clean) runs a shadow encoder cache over
obstacle-free conditioning and doubles predict_flow during events.

Weather events (V key): clear -> rain -> snow -> clear via plain
two-prompt guided swaps (2.5/20, the PR #431 mechanism); the style
LoRA is detached around weather-only swaps and the drift corrector is
gated off during weather (its gate profile was calibrated on style v6).
Skin + weather compose into one compositional prompt through the LoRA.

Presenter gains WEATHER/OBSTACLE/HITS chips and an optional projected
3D-box annotation for the obstacle clone (evidence aid).

29 new CPU tests (weather cycle/LoRA-bypass/corrector policy, template
extraction/placement/despawn/collision, guidance seams, key plumbing).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* Improve live-edit coin compositing: aspect-true sizing, contact shadow, edge clipping

Sizing keeps the FTheta vertical-extent projection for height, preserves
the sprite's native aspect ratio, and carries the spin squash on width.
Adds a light elliptical contact shadow (kept subtle so the coin pops)
and edge-clipped compositing so large near-edge sprites can't raise.
The default coin stays procedural; a custom RGBA sprite can be supplied
with --live-edit-coin-sprite.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* Pad the coin contact shadow past its blur radius

The 2 px padding clipped the Gaussian falloff into a faint rectangle on
flat road textures (visible in the cyberpunk demo stills).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* Make weather a base-world-only ability with a corrector-gain dispatch

Skin+weather combo prompts produced rain that read as no rain under the
neon skins, and the corrector hard-off rule left over half the demo run
drifting. Weather now only runs over the base world: the V key is
rejected while a skin is active or pending, activating a skin clears an
active weather, and compose_swap_target rejects the combo outright.
WeatherPreset drops the combo clause and front-loads visible-rain cues
(streaks in the air, droplets on the windshield/lens, tire spray) in
the standalone prompt.

The corrector's boolean dispatch becomes a per-state gain dispatch: the
style gain rides the validated gated predict_flow, gain 0 short-circuits
to the bit-clean base forward, and any other gain re-derives the
alpha*(t) x gain LoRA scale before the base forward. New flags:
--live-edit-weather-guidance (2.5 default; snow needed 3.0 in sweeps)
and --live-edit-weather-corrector-gain (0 default = corrector off during
weather, the calibrated-safe behavior).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* Add storm preset, stronger snow prompt, and direct weather select

- Rewrite the snow preset with front-loaded falling-precipitation cues
  (heavy snowfall, flakes streaking past the windshield, accumulation on
  the hood/roadsides) after the 2.5-guidance capture read as a dusting;
  A/B probes picked guidance 3.0 over 3.5 (3.5 added sky smear without
  more snow).
- Add an experimental hurricane-force 'storm' preset (appearance cues
  expected to land; dynamic wind effects documented as unlikely).
- Add --live-edit-weather-first to rotate the V-key cycle so any preset
  is one confirmed press away (no pass-through transition weather).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* Port fused drift-corrector mode and per-state dispatch from omnidreams-live-edit

Brings 671d9f99 (CUDA-graph-safe fused mode) and 39fe3af1
(DriftCorrectorDispatch + TextEditLoRA.release_targets) into the game
branch; library tests live on omnidreams-live-edit.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* Wire the fused per-state drift corrector into the live-edit abilities

corrector_mode=fused (default; LIVE_EDIT_CORRECTOR_MODE /
--live-edit-corrector-mode fall back to unfused) deploys
DriftCorrectorDispatch with per-(base|skin|weather) pre-merged sets:
base keeps an optional photoreal corrector, the skin state composes the
released self-attn LoRA delta with the style corrector in one copy_
source, weather reuses the style (or a dedicated) corrector at its own
gain. compile_network + use_cuda_graph stay ON in fused mode; the
graph-free session rebuild now happens only for unfused. The K/V state
machine selects the dispatch state at chunk boundaries.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* Gate live-edit native-DIT rejection on real hooks; add corrector mode off and guidance-window knobs

Fixes the three perf problems reported against PR #494 + #496:

- --live-edit-corrector-mode off disables every drift corrector even when
  checkpoints are configured: no DriftCorrectorDispatch is built, no
  weight sets are snapshotted, and the scheduler/finalize gate drivers are
  never installed (weights verified bit-identical in tests).
- The native-DIT guard is now precise and actionable: it fires only for
  the prompt-swap abilities that genuinely need the Python transformer
  forward (replace_text_embeddings raises NotImplementedError under the
  native executor, and TextEditLoRA's copy_ toggles never reach the
  native fp8 weight snapshot), names the exact flags to drop, and only
  mentions corrector flags when a corrector is actually enabled. Coins
  and other pixel-only abilities never construct the ability and run
  under native_dit_acceleration untouched.
- New knobs --live-edit-skin-guidance-chunks (default 6) and
  --live-edit-weather-guidance-chunks (default 20). The skin window is
  LoRA-realized single-branch (length is not a per-chunk cost); a GPU A/B
  on a cyberpunk swap showed 6 lands the style as fast and as strong as
  20. Weather has no LoRA: its guided window costs ~2x per chunk while
  open, and the 8-chunk re-swap refresh re-opens it - now documented in
  the README with the knob to shorten it.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* Composite live-edit pixels on the GPU when the model frame is CUDA-resident

The presenter used to materialize the model frame to host numpy for PIL
compositing, which on the native Vulkan HUD fast path (lazy CUDA uint8 HWC
frames) forced a GPU->CPU->GPU round trip per frame (~10 fps observed).

LiveEditFrameCompositor keeps the frame on device: coin sprites, contact
shadows, and HUD chips are pre-rendered once (PIL) and cached as
premultiplied per-size textures; the per-frame work is one float32
conversion, a fused lerp ROI blend or two per coin, and a single
round/clamp/uint8 cast (plus an optional separable-Gaussian unsharp for
skins). Measured on GB300 at 1280x704: 0.09 ms/frame with 0 coins,
0.59 ms with 9 coins (~4.7 ms per 8-frame chunk), issued from the
presenter thread so it overlaps model compute.

The composited result is re-wrapped as a LazyCudaFrame whose CUDA event is
recorded after the blends, so both consumers stay ordered (Vulkan interop
copy stream, MJPEG host prefetch) and the single-materialization
numpy-XOR-cuda contract holds. Host/numpy sources keep the PIL path, as
does the obstacle box-outline annotation (debug aid). All compositor math
is device-agnostic and unit-tested on CPU tensors.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* Fix ruff findings in the live-edit branch files

obstacle_ability/test_runner import-block ordering (repo ruff 0.12.7
--select I), C408 dict literals, PLR0402/RUF059/RUF046/UP037 from the
current ruff default set on the live-edit files.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* Add --stream-token gate to the MJPEG streaming presenter

Every HTTP endpoint (page, /stream, /bev_stream, /control, /state,
/scenes, /thumbnail, /scene/select, /taxi/name) now requires the shared
token via ?token= query param or X-Stream-Token header when the flag is
set; requests without a valid token get 403. The served page reads the
token from its own URL and appends it to all of its requests. Omitting
the flag keeps the historical open behavior.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* Add demo_kit: hosted-demo launch scripts and runbook

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* Add hurricane weather preset (kill-gated vs shipped storm)

Escalates storm along the cues that materialize (2026-08-21 A/B at
guidance 3.5/4.0 vs the shipped storm frames): visibility collapse,
walls of spray/mist, static debris lying on the flooded road, and a
black-green emergency-gloom sky. Dynamic wind wording (bending trees,
flying debris) is deliberately absent — it never materializes in the
history-anchored model. Shipped at weather guidance 4.0.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* Bound the coin ability's per-frame cost at course scale

Aidan reported coins still hurting native-path perf after the CUDA
compositor fix. Profiling at real course scale (4395 coins on the shipped
suburb scene) found two costs the 9-coin measurement missed:

- visible_sprites/advance_frames scanned all coins every frame
  (0.60 ms/frame CPU at 4400 coins). A static 32 m spatial hash with
  per-cell cached windows plus a vectorized projection filter makes both
  O(nearby): 0.20 ms/frame, pickup 0.10 -> 0.015 ms.
- The compositor is CPU-launch-bound, not bandwidth-bound (GPU drain adds
  ~0 in every measurement), and dense areas put 211 sprites inside the
  120 m render radius -> 11-14 ms/frame enqueue. Fixes: one blend per coin
  (shadow+coin+quantized fade pre-composited into one cached texture,
  2.6x fewer kernels: 1.14 -> 0.44 ms at 9 sprites, 5.20 -> 1.84 ms at
  48) and a nearest-N sprite cap (--live-edit-coin-max-visible,
  default 64) so dense courses cannot blow the budget.

Also adds the ROI-only uint8 blend path (LIVE_EDIT_COMPOSITOR=roi) that
never converts the full frame to float32 - exact parity with the float
path (max diff 0) and minimal GPU traffic, but slower wall-clock on
launch-bound machines, so the float canvas stays the default - and a
perf self-report (--live-edit-perf-log N / LIVE_EDIT_PERF_LOG) that logs
p50/p95 coin CPU ms, compositor enqueue CPU ms, and compositor GPU ms
(lazy CUDA event pairs, no added sync) every N composited frames so
remote users can send numbers instead of guesses.

Validated headless MJPEG at course scale: chunk cadence unchanged
(219-242 ms, matching the no-coins baseline), coin rendering parity vs
the previous compositor within 1.5 LSB mean on sprite pixels (fade
quantization + <=1 px shadow anchor). New tests cover the windowed
culling, the sprite cap, ROI/float parity, and the perf log.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* Add traffic events: multi-clone obstacle bursts

One O press now spawns --live-edit-obstacle-count clones (default 1 =
unchanged single obstacle): distinct crossing/oncoming template tracks
(never pace-matched lead cars, which render at ghost strength), staggered
across a 16-40 m band ahead of the ego (spacing_m per slot) and
--live-edit-obstacle-stagger-chunks apart in time, each retimed+rigidly
shifted with ground-z correction and despawning after its own pass.

Guidance already strips every OBSTACLE_ENTITY_PREFIX actor from the
shadow branch, so the box-axis path handles simultaneous boxes unchanged.
Mask-anchored validation (RNG-matched baseline, per-clone camera-projected
boxes, 26-chunk headless runs): s=2.0 lands 2/3 clones at N=3 (52/61/18%
of real-car in-box benchmark) and 4/5 at N=5 (52/60/15/69/83%), out-box
clean (median 5.7-7.5); s=2.5 is stronger still at N=3 (63/79/22%) with
no breakup, so the traffic demo ships at s=2.5. Simultaneous spawns
(stagger 0) are stable; the 1-chunk default is for on-screen pacing.
The one weak clone is the fastest template (~11 m/s) which holds distance
until late. The presenter annotates every active clone and shows a
TRAFFIC xN chip.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* Land weather then release: unguided holds persist, steady-state 2x -> 1x

The always-guided weather deployment (guidance_chunks 20, re-opened by the
8-chunk skin re-swap) paid a second forward per denoise step for the whole
hold — and, worse, every re-swap snapshotted its old KV from buffers that
already held the weather text, so the re-opened windows guided along a ZERO
direction (2x cost, no edit pressure). RNG-matched A/B on the real model
(scratch weather_hold probe, rain, 27-chunk hold): a 6-chunk guided landing
followed by a plain unguided hold matches the always-guided policy both in
divergence-vs-clear (peak 35.1 vs 38.4 uint8, identical late-run decay) and
eyes-on frames; a rebased 2-chunk maintenance pulse every 16 adds ~1 uint8
(noise), so the default hold has no maintenance.

- weather guidance_chunks default 20 -> 6 (landing window only)
- weather no longer rides the skin re-swap; optional maintenance knobs
  --live-edit-weather-maintain-interval / -maintain-chunks (default 0/2),
  and a maintenance pulse rebases (plain base swap first) so its guidance
  direction is weather-minus-base, not zero

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* Pre-encode swap prompts at session start; swaps inject cached embeddings

Every skin/weather swap paid a text-encoder forward inside replace_text at
the chunk boundary (450-930 ms model_ms on the boundary chunk). All swap
prompts are known up front, so StyleAbility.attach() now encodes the
configured skin + weather prompts once (and start() encodes the scene's
base prompt once), and _replace_text injects the cached [1,1,L,D]
embeddings through the pipeline's existing replace_text_from_embeddings —
no main-repo change needed. Uncached prompts (or pipelines without the
embedding API / a resident text encoder, e.g. the offload path) fall back
to the encode-per-swap replace_text. Each swap logs
cached_embeddings=<bool> swap_ms=<ms> for measurement.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* Make obstacle box-axis guidance CUDA-graph safe; drop the graph-free rebuild

The guidance previously forced use_cuda_graph=False session-wide (~545 ms
per chunk for the WHOLE session, events or not). It never needed to: the
transformer's CUDAGraphWrapper stages every top-level tensor kwarg —
including hdmap_condition — into static buffers per call, so the two
forwards of a guided step are two REPLAYS of the same captured cond graph
with box/no-box conditioning staged in (the mechanism two-prompt text-edit
guidance already rides), and the predict_flow dispatch runs eagerly outside
any capture.

The one genuinely graph-unsafe seam was the shadow ENCODER: the Wan VAE's
graph wrapper passes its streaming cache dict through verbatim, binding
captured kernels to one cache's buffer addresses — feeding it the shadow
cache would silently read/write the real cache (and alternating real/shadow
calls through one wrapper would capture against whichever cache was live).
Shadow encodes now run eagerly via _eager_vae_scope, which also keeps the
wrapper's warmup/capture stream fed by the real cache only.

install_obstacle_guidance_on_backend keeps the accelerated session; the
transformer guard now rejects only the native optimized-DiT executor.

GPU validation (graphs ON, s=2.5, 3-clone burst, RNG-matched baseline,
scratch obstacle_graphs probe): one graph captured at chunk 4 and never
re-captured through spawn/despawn; pre-spawn |diff| exactly 0.0; event
chunks ~340 ms model vs ~230 non-event (non-event unchanged vs baseline);
per-clone in-box |diff| 44/60/44% of the real-car benchmark with out-box
clean (6.1 median) — materialization matches the graph-free reference.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* Add timed power-up skin mode with HUD countdown

--live-edit-skin-duration-chunks N auto-reverts an activated skin to the
base world after N generated chunks through the existing plain-swap
revert path (guidance 1.0/0; corrector dispatch returns to base). 0
keeps the hold-until-cycled behavior. K during an active timed skin
keeps its cycle semantics: next skin with a fresh timer (same key
meaning in both modes; base reachable by cycling; a user press at the
expiry boundary wins over the auto-revert). Duty-cycle re-swaps are
skipped when the duration fits inside the re-swap interval; re-swaps
never reset the timer. HUD skin chip shows the remaining seconds
(chunk-granular, manifest-derived chunk length).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* Add --live-edit-skin-first rotation; document timed skin mode

Mirrors --live-edit-weather-first: rotate the K cycle so a named skin
comes first for direct one-press selection — timed power-up demos would
otherwise burn transitional chunks cycling through the skins ahead of
it. README documents the power-up mode and its K semantics.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* Add MJPEG drop-to-latest backpressure fix and stream bandwidth knobs

Slow clients (VPN / SSH tunnel) were watching seconds-old frames: the
LatestFrameBus already drops to the newest frame, but the default kernel
SO_SNDBUF (several MB) let TCP queue seconds of encoded JPEGs anyway.
Cap the per-connection send buffer to ~2 frames so writes block as soon
as the link saturates and the next bus read skips to the newest frame.

Per-connection sent/dropped/bandwidth stats are logged every 10 s and on
disconnect. New knobs: --stream-jpeg-quality (default 85, unchanged) and
--stream-scale (e.g. 0.5 = 640x352) downscale before JPEG encode, off
the render thread as before.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* Fix fp32 base-weight aliasing in TextEditLoRA pre-merge (backport)

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* Add pickup-driven effect items and timed weather

Effect items: sparse pickups along the lanes (rain/snow icons -> that
weather; mystery box -> seeded-random timed skin burst) reusing the coin
course/projection/culling/compositing machinery via per-sprite bank keys.
Pickups dispatch through the existing ability state machines at the next
chunk boundary — the same path as the K/V keys, which stay fully live.
Weather stays base-world-only: a pickup during a skin is ignored with a
HUD hint (not queued). Item sprites are local-only config paths; defaults
render procedural placeholder icons.

Timed weather: --live-edit-weather-duration-chunks (default 90 ~ 24 s)
auto-reverts any weather activation to clear via a GUIDED clear landing
(clear is itself a weather transition; plain swaps leave precipitation
running on KV momentum). HUD weather chip gains a countdown. Re-picking
the active weather refreshes the timer without a zero-direction re-swap.

Weather-state corrector stays default-off per policy (clean-forcing
corrector only for game-skin states); knob kept for A/B.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* Make item-course sparsity global across the lane network

Real maps chop lanes into segments shorter than the item spacing (the
shipped suburb map laid out 4 items instead of ~300): walk candidates
every ~spacing/4 and accept one only when no accepted item lies within
spacing_m (spacing-sized spatial hash), so rarity is a property of the
whole network rather than each polyline.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* Document effect items and timed weather in the README

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* Keep item sparsity independent per driving direction

Global min-distance suppression let whichever directed lane was walked
first claim every spacing-disc along a road, so drivers of the opposite
lane never passed within pickup radius of an item (0 pickups over a 30 s
GPU drive that collected 60 coins). Suppress a candidate only against
accepted items with a similar heading (dot > 0.5): each direction of a
road carries its own items while overlapping/duplicated lanes still dedup.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* Add static-roadblock obstacle mode (parked clones from chunk 0)

--live-edit-obstacle-static-count N lays out N parked-track clones midroad
ahead of the spawn pose, in the conditioning from the session's first chunk,
alternating laterals so the ego weaves between them; they persist until a
rollout reset re-anchors them, and O-key bursts keep working alongside.

Probed 2026-08-23 (RNG-matched, mask-anchored): static clones stay at ghost
strength unguided even from chunk 0 (the initial camera frame anchors an
empty road), materialize solid stopped cars in the 5-25 m band with box-axis
guidance s=2.0, and break up when spawned mid-stream at s=2.5 - so the mode
pairs with guide_scale 2.0 and nearer slots are expected to lag.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* Expose the static-roadblock lateral offset on the CLI

--live-edit-obstacle-static-lateral-m widens the alternating slots so the
ego has a slalom line with clearance beyond the 3 m collision radius; the
first capture at the 2.8 m default clipped the clone boxes, and a
camera-through-box overlap sends the box-axis guidance into frame-wide
breakup.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* Add the nitro pickup item: an instant timed speed boost

A nitro item (GPU icon) joins the effect-item course mix at the same
rarity as the other kinds. Picking one up applies a temporary boost
inside the app-authoritative taxi physics tick — the integrate_fn seam
in RolloutSpec — multiplying max speed AND max acceleration by
--live-edit-nitro-boost (1.6) for --live-edit-nitro-duration-s (4 s
game time). Unlike the weather/skin items there is no chunk-boundary
handshake: nitro is physics-only, so the effect lands on the very next
sampled physics tick and composes with every skin/weather/obstacle
state. A second pickup while boosted resets the timer (no stacking).

The boosted max speed is hard-capped at --live-edit-nitro-max-speed
(16 m/s default) so the conditioned ego never outruns the world
model's manifold on the suburb map. The HUD shows the NITRO! pickup
flash plus a boost chip with a game-time countdown.

--live-edit-item-types restricts the course mix (single-effect capture
courses); --live-edit-item-nitro-sprite supplies the local-only icon,
with a procedural placeholder as the shipped default.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* Route prompt swaps through session.replace_prompt

StyleAbility._replace_text's encode-per-swap fallback now calls the
public FlashdreamsWorldModelSession.replace_prompt instead of reaching
into session.pipeline/_cache, dropping the TODO(upstream) note. Since
replace_prompt flushes the adapter's deferred chunk finalize itself,
the manual flush in the continue_generation wrapper is gone; the
embeddings fast path (no upstream equivalent yet) keeps an explicit
_flush_pending_finalize so finalize still runs under the old text.

The fake sessions in the live-edit tests grow a matching replace_prompt
that mirrors the real flush-then-swap semantics.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* Add SPDX headers to demo_kit scripts

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

---------

Signed-off-by: Aidan Foster <aidanf@nvidia.com>
Signed-off-by: aidanfnv <aidanf@nvidia.com>
Co-authored-by: Aidan Foster <aidanf@nvidia.com>
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
@wenqingw-nv

Copy link
Copy Markdown
Collaborator Author

Handoff note: my NVIDIA access ends 2026-08-28. Maintainer edits are enabled on this PR; all trained checkpoints are published (fork releases on wenqingw-nv/flashdreams-wq) and the full code+weights+demo-videos snapshot is mirrored internally at gitlab-master.nvidia.com/worldsim/flashdreams (branches wenqingw/*, artifacts in wenqingw/handoff-artifacts via LFS). Context owners going forward: @aidanfnv (game integration, #463/#494-merged) and Yong He (research review). Happy to answer questions async post-internship.

🤖 Generated with Claude Code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant