Repository navigation
Closed-loop RL in AlpaSim: training-aligned map and route inputs, and a minimal GRPO loop - #237
Open
riita10069 wants to merge 79 commits into
Open
riita10069 wants to merge 79 commits into
riita10069 wants to merge 79 commits into
Conversation
… so the AlpaSim driver feeds the exact nuPlan training map context Signed-off-by: Ryota Yamada <riita@amazon.com>
…driver models so the AutoE2E driver can load the scene HD map Signed-off-by: Ryota Yamada <riita@amazon.com>
… host runs the same forked driver API Signed-off-by: Ryota Yamada <riita@amazon.com>
…ces the destination with the training transform Signed-off-by: Ryota Yamada <riita@amazon.com>
…ke nuPlan training so the driver stops running camera-only Signed-off-by: Ryota Yamada <riita@amazon.com>
…map and PredictionInput.route so closed-loop inputs match training Signed-off-by: Ryota Yamada <riita@amazon.com>
…n gets the HD map Signed-off-by: Ryota Yamada <riita@amazon.com>
…ead of an env var nobody sets differently Signed-off-by: Ryota Yamada <riita@amazon.com>
…driver so the plugin can open each scene USDZ map Signed-off-by: Ryota Yamada <riita@amazon.com>
…eir ego frame against a two-lane trajdata map Signed-off-by: Ryota Yamada <riita@amazon.com>
… so lane lookups have their index Signed-off-by: Ryota Yamada <riita@amazon.com>
…t already converts them to sets Signed-off-by: Ryota Yamada <riita@amazon.com>
…unt and the AlpaSim patch they need Signed-off-by: Ryota Yamada <riita@amazon.com>
…lugin data contract, replacing the camera-only note Signed-off-by: Ryota Yamada <riita@amazon.com>
…ecisions get the same map and route as the driver Signed-off-by: Ryota Yamada <riita@amazon.com>
…ration so the deterministic GRU planner gets smooth, BC-anchored samples (#211) Signed-off-by: Ryota Yamada <riita@amazon.com>
…ges, KL pull and that GRPO steers a toy plan to the reward Signed-off-by: Ryota Yamada <riita@amazon.com>
…ons, scores sampled plans with the phase-1 reward and updates only the planner Signed-off-by: Ryota Yamada <riita@amazon.com>
… short scene so the minimal closed-loop RL runs end to end on one GPU host Signed-off-by: Ryota Yamada <riita@amazon.com>
… with the reasons for its reward, groups and exploration Signed-off-by: Ryota Yamada <riita@amazon.com>
… stays outside the pipeline until it shows value Signed-off-by: Ryota Yamada <riita@amazon.com>
…empty routes, as training sets the two route channels independently Signed-off-by: Ryota Yamada <riita@amazon.com>
…keep the destination channel Signed-off-by: Ryota Yamada <riita@amazon.com>
…e the parser reads the field unconditionally Signed-off-by: Ryota Yamada <riita@amazon.com>
… since plain SGD scaled curvature updates 100x over acceleration and the subspace KL let high frequencies drift Signed-off-by: Ryota Yamada <riita@amazon.com>
…t of both signals, the full-plan anchor, and a toy learning both signals Signed-off-by: Ryota Yamada <riita@amazon.com>
…e scored on collisions, road, direction and progress instead of only distance to the log Signed-off-by: Ryota Yamada <riita@amazon.com>
…human filter on a synthetic two-lane road Signed-off-by: Ryota Yamada <riita@amazon.com>
… the recorded drive also leaves the mapped lanes Signed-off-by: Ryota Yamada <riita@amazon.com>
…rd opens the same artifact as the driver Signed-off-by: Ryota Yamada <riita@amazon.com>
…and that the corridor drops oncoming lanes and off-map points Signed-off-by: Ryota Yamada <riita@amazon.com>
…e by-place human filter, path-distance truncation and the improving line search Signed-off-by: Ryota Yamada <riita@amazon.com>
… hold static tracks, take one-sided track speeds, measure EP from where the log passed the ego and judge lanes at the box centre, per round-4 review Signed-off-by: Ryota Yamada <riita@amazon.com>
…, track-end speeds and progress from the ego's place Signed-off-by: Ryota Yamada <riita@amazon.com>
…orridor ahead along unique successors, so the drivable and route rasters cover what nuPlan training drew Signed-off-by: Ryota Yamada <riita@amazon.com>
…or, since nuPlan routes include the roadblocks behind the ego and AlpaSim's route starts at it Signed-off-by: Ryota Yamada <riita@amazon.com>
…rops merging side roads and stops 120 m ahead Signed-off-by: Ryota Yamada <riita@amazon.com>
…e: it is the KL's natural gradient, in the policy term's units Signed-off-by: Ryota Yamada <riita@amazon.com>
…he static hold, measure EP over the log's moving time and guard sub-0.1 s tracks, since round-5 review showed waiting plans scoring full and hidden objects gating plans Signed-off-by: Ryota Yamada <riita@amazon.com>
…o progress and that stub tracks have no speed Signed-off-by: Ryota Yamada <riita@amazon.com>
…std (Dr. GRPO), so near-equal groups do not push as hard as real safety differences Signed-off-by: Ryota Yamada <riita@amazon.com>
…cy with a bounded reward like the driving one Signed-off-by: Ryota Yamada <riita@amazon.com>
… AlpaSim does before filtering short tracks Signed-off-by: Ryota Yamada <riita@amazon.com>
…do not reuse the same exploration noise Signed-off-by: Ryota Yamada <riita@amazon.com>
…ntages, per-step seeds and the missing traffic-light term Signed-off-by: Ryota Yamada <riita@amazon.com>
…g and fail clearly on mapless scenes, since shortened horizons made late plans incomparable Signed-off-by: Ryota Yamada <riita@amazon.com>
…ip end and skip rollouts of scenes without an HD map Signed-off-by: Ryota Yamada <riita@amazon.com>
… braking plan and reject plans near the clip end Signed-off-by: Ryota Yamada <riita@amazon.com>
…out a map Signed-off-by: Ryota Yamada <riita@amazon.com>
…ck, follow NAVSIM's TTC rule and filter comfort signals as nuPlan does, since clipping at the rollout end hid late collisions Signed-off-by: Ryota Yamada <riita@amazon.com>
…ar in the next lane costs no TTC Signed-off-by: Ryota Yamada <riita@amazon.com>
…nner so evaluation loaders accept RL checkpoints Signed-off-by: Ryota Yamada <riita@amazon.com>
… where the projection stays in the horizon and smooth the jerk magnitude from raw accelerations, per round-7 review Signed-off-by: Ryota Yamada <riita@amazon.com>
…t does not overlap at t0 Signed-off-by: Ryota Yamada <riita@amazon.com>
…kpoints passing between steps with on-policy replays and bounded steps Signed-off-by: Ryota Yamada <riita@amazon.com>
…ded steps but does not yet change the driving, and why Signed-off-by: Ryota Yamada <riita@amazon.com>
… by how they were found Signed-off-by: Ryota Yamada <riita@amazon.com>
Signed-off-by: Ryota Yamada <riita@amazon.com>
…ce the human filter and EP moved to by-place matching Signed-off-by: Ryota Yamada <riita@amazon.com>
…led-path list so mypy passes Signed-off-by: Ryota Yamada <riita@amazon.com>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Following the discussion in #221, #211 and #123, this PR does two things:
PredictionInput.route. It now draws the 14-channel map context and the 2-channel route mask with the nuPlan training rasterizer, from the scene's HD map and AlpaSim's route (option 2 in Closed-loop AlpaSim: nuPlan Epoch 5 drifts off the road from ego yaw-history feedback #221).experiment/closed-loop/rl(outsidewf_autoe2e): AlpaSim rollouts alternating with GRPO steps on the GRU planner, on one scene.The loop works end to end, but on one scene and three small steps it does not change the driving yet (Results). I would be grateful for feedback on the reward and the exploration recipe before scaling it up.
1. Training-aligned inputs (
Model/plugins/alpasim_driver)experiment/closed-loop/alpasim.patch, applied bysetup_alpasim.sh, addsPredictionInput.scene_idfrom the session'sdebug_info, so the driver can open the scene's USDZ. The driver config mounts AlpaSim's scene cache read-only. No proto change.scene_map.py): the scene's trajdataVectorMapdrawn by the samerasterize_navigation_mapas nuPlan packing (now factored out ofdata_parsing/nuplan/targets.py, pack path unchanged). Lanes stand in for nuPlan's roadblocks, wait lines for stop lines; lanes without edges are widened to 3.7 m as AlpaSim's offroad metric does. NuRec maps carry no intersection areas, so that channel stays empty.replay_driver.pyreplays the logged route and scene id, so replays see the same inputs.2. Minimal GRPO loop (
experiment/closed-loop/rl)grpo_step.pyreplays every decision fromrollout.asl, keeps the planner's inputs and samples 8 plans per state. It stops if the replayed plan differs from the executed one by more than 5 cm or 0.01 rad, so updates stay on-policy.reward.py): progress gated by safety,NC · DAC · DDC · V · EP · TTC · LK · Cover 4 s of each plan.-1 + safe_fraction: below every passing plan, with later failures above earlier ones.Results (
experiment/closed-loop/RESULTS.md)nuPlan Epoch 5, scene
clipgt-01d503d4, one 11 s rollout per iteration (7 s on the log, then 4 s in closed loop), L40S. The attached videos are the front camera of iterations 0 to 3.Pipeline note
Entry points, data layers and lineage are unchanged. The RL loop stays in
experiment/, and thetargets.pychange is a behaviour-preserving extraction. RL checkpoints have no Flyte lineage; if the loop proves useful, I would redesign it forwf_autoe2einDesign/first.Limitations and next steps
--sigma), more scenes and rollouts per step, and measuring what the planner's detach costs the update direction. After that, rollout-level groups and Proposal / discussion: reward design for the stage-3 closed-loop RL policy #123's phase-2 terms.Testing
On the GPU host (AlpaSim venv):
experiment/closed-loop/rl35 passed; plugin and map tests 61 passed. Scoring the recorded drive itself gives 1.0 on every term.References
closed-loop-rl-r3-iteration-0.mp4
closed-loop-rl-r3-iteration-1.mp4
closed-loop-rl-r3-iteration-2.mp4
closed-loop-rl-r3-iteration-3.mp4