Skip to content

FastSAC v1: off-policy SAC drop-in for PPO - #1

Open
romesco wants to merge 9 commits into
feature/locomotionfrom
feature/off-policy-sac
Open

FastSAC v1: off-policy SAC drop-in for PPO#1
romesco wants to merge 9 commits into
feature/locomotionfrom
feature/off-policy-sac

Conversation

@romesco

@romesco romesco commented Aug 10, 2026

Copy link
Copy Markdown
Member

Off-policy SAC for rsl_rl (FastSAC v1)

Adds a SAC off-policy algorithm as a drop-in alternative to PPO for massively-parallel IsaacLab locomotion, targeting the rsl_rl 5.2.0 model API. Ported math from the rsl_rl_sac lineage; integration rewritten for the current MLPModel/distribution_cfg API and grouped (dict) observations.

What's here (9 commits, clean stack on feature/locomotion)

  • Replay buffer (storage/replay_buffer.py): per-env circular TensorDict buffer with n-step return assembly.
  • SAC models (models/sac_mlp_model.py): tanh-Gaussian actor + twin-Q critic on the 5.2.0 MLPModel. Overrides output_std/output_entropy for torch Normal (.stddev / .entropy()), which the 5.2.0 base assumes as attributes.
  • SAC algorithm (algorithms/sac.py): clipped-double-Q via a q_aggregation (min/avg) seam, auto-alpha entropy tuning, n-step returns, gamma-consistency guard, warp→torch conversion in action scaling, and a safe fallback (warn + terminal treatment) when time_outs_obs is absent.
  • OffPolicyRunner (runners/off_policy_runner.py): 5.2.0 Logger integration; version bump to 5.3.0.

Correctness-critical design

  • Timeout bootstrapping: consumes the env-side time_outs_obs (true pre-reset terminal obs) so truncations bootstrap and terminations don't. bootstrap_mask = bootstrap + 1 - dones.
  • Grouped obs: per-set obs_groups routing (actor vs critic); >2D obs-leaf mask broadcast handled for height-scan groups.

Testing

  • 15 Tier-0 unit tests (replay buffer + SAC math), all passing (Isaac-free CPU venv).
  • Adversarial review (3 defects found + fixed: dual-gamma assert, silent-timeout fallback, >2D mask broadcast).
  • Flat Anymal-D velocity bring-up: reward -1.0 -> +21 stable, vel-track 0.93 / err 0.22 over 600 iters @ 4096 envs; bit-exact determinism.

Companion IsaacLab integration PR: UW-Lab/IsaacLab (branch rosario/fastsac-v1).

romesco added 9 commits August 9, 2026 21:43
Newer IsaacLab (Newton/warp backend) exposes soft_joint_pos_limits and
default_joint_pos as warp arrays, not torch tensors; the ported
_compute_action_scaling indexed them torch-style and raised IndexError.
Convert via wp.to_torch when needed. Found during the 128-env smoke.
…eatment)

The env-side pre-reset obs stash is not always active (e.g. when isaaclab
core loads from an editable install that lacks it). Rather than raise or
bootstrap from the post-reset observation, degrade safely to terminal
treatment and warn once. Correct bootstrapping still applies whenever
time_outs_obs is present.
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