Skip to content

Add a placement-success benchmark with run comparison - #1497

Open
zhx06 wants to merge 10 commits into
mainfrom
zxiao/feature/placement-success-benchmark
Open

zhx06 wants to merge 10 commits into
mainfrom
zxiao/feature/placement-success-benchmark

Conversation

@zhx06

@zhx06 zhx06 commented Oct 21, 2026 •

Copy link
Copy Markdown
Collaborator

Add a placement-success benchmark script that measures how often relation placement succeeds across the RoboLab and KitchenBench specs, writes a results file and compares two runs. Add ArenaEnvBuilder.prepare_live_placement_inputs() so the script places exactly what an environment build places, without building the environment.

Why this change?

Placement changes, such as oriented bounding boxes for collision checks (#1480), need a number to compare before and after. Until now, success rates were measured with one-off scripts, so results from different PRs were hard to compare and their noise was unknown.

What changes?

isaaclab_arena/scripts/placement_success_benchmark.py builds each spec's placement inputs, places --num_layouts layouts for each seed in --placement_seeds, and validates them without stepping physics. It reports two rates per environment and per suite:

  • Layout success: the share of layouts whose best of max_placement_attempts candidates passes every required pre-physics check, as ObjectPlacer.place() does.
  • Valid candidates: the share of all solved candidates that pass. It moves before layout success does, because best-of-K hides moderate changes.

CandidatePlacer gives each environment its own block of candidate seeds, and each seed its own range within it.

  • Tasks that share a scene, as many RoboLab tasks do, therefore sample it independently instead of repeating the same candidates.
  • A run filtered with --env solves the same candidates for its specs as a full run.

The robot is placed and checked whenever a spec places it by relations, as in a real build. This includes the 11 KitchenBench specs that place only the robot. Specs that place nothing other than anchors are skipped. Specs that fail are recorded with their error, and the script exits non-zero after writing the results file.

--compare BEFORE AFTER compares two results files without starting the simulator. It reports:

  • each suite's change, with a 95% interval;
  • the environments whose change stays significant after a Holm adjustment, which keeps the chance of any false flag across all environments and rates at or below 5%;
  • the environments not scored in both runs;
  • any settings that differ;
  • the environments where a check required in only one run rejected candidates in that run. Their success criteria differ, so they are left out of the suite rates and significance tests.

isaaclab_arena/offline_placement/placement_success.py owns the data and statistics, with no simulator dependency:

  • PlacementBenchmarkSettings: the measurement settings, with their defaults and validation;
  • PlacementBenchmarkResults: provenance, settings and one EnvironmentRecord per environment, saved to and loaded from JSON;
  • summarize_suites() and compare_results(), with format_results() and format_comparison() for the printed tables.

ArenaEnvBuilder.prepare_live_placement_inputs() applies build-time variations and reachability constraints and returns a LivePlacementInputs. It asserts that no Hydra overrides or recorded replay are set, since it does not apply them. _prepare_relation_placement() now uses the same code. The moved lines are unchanged; they were written by Xinjie Yao, Clemens Volk and qianlin.

A new docs page, object_placement/placement_success_benchmark, explains how to run the benchmark, compare runs, read the results file and add a suite.

The PR is about 1,490 lines: about 320 are tests and 175 are docs. I kept the comparison in the same PR, because a benchmark is only useful once two runs can be compared.

Follow-ups this leaves room for

  • KPI tracking: a follow-up can read results files with PlacementBenchmarkResults.load() and export summarize_suites() or compare_results() without changing the benchmark. A field added later with a default still loads older files.
  • OSMO runs: each job can run a subset with --env and --output. The commit is not recorded in an image without .git, so that MR would need to pass it in.
  • New scenes: add the specs and append a suite to SUITE_SPEC_GLOBS; the other specs keep their candidates.

Usage example

# Before and after the change, for example on main and on your branch.
python isaaclab_arena/scripts/placement_success_benchmark.py --output outputs/placement_success/before.json
python isaaclab_arena/scripts/placement_success_benchmark.py --output outputs/placement_success/after.json

# Compare without starting the simulator.
python isaaclab_arena/scripts/placement_success_benchmark.py \
    --compare outputs/placement_success/before.json outputs/placement_success/after.json

@zhx06

zhx06 commented Oct 21, 2026

Copy link
Copy Markdown
Collaborator Author

/review

count = len(changes)
baseline = sum(change.baseline for change in changes) / count
candidate = sum(change.candidate for change in changes) / count
centre = sum((change.low + change.high) / 2 for change in changes) / count

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.

🟡 Suite interval shifts when run sizes differ

Each Agresti–Caffo centre is pulled toward 50% by about 1/(n+2). When the two runs have different trial counts, that shift is the same in every environment, so averaging doesn't cancel it while the suite half-width keeps shrinking. With 37 environments at 100% in both runs, seeds 0 1 2 against seed 0 prints 100.0% → 100.0% | [-1.9, -0.6] pts (p ≈ 1e-4). A change to max_placement_attempts causes a smaller shift in the valid-candidates column, with no settings warning.

Could the suite interval be centred on the observed change, keeping the current half-width? The rst sentence saying intervals "need not be centered on the observed change" would then apply only to per-environment intervals.

Suggested change
centre = sum((change.low + change.high) / 2 for change in changes) / count
centre = candidate - baseline

try:
arena_env = ArenaEnvGraphSpec.from_yaml(spec_path).to_arena_env()
inputs = ArenaEnvBuilder(arena_env, ArenaEnvBuilderCfg()).prepare_live_placement_inputs()
placed_objects = [asset for asset in inputs.assets if not asset.is_anchor and asset is not arena_env.embodiment]

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.

🔵 Why skip robot-only specs?

A real build still places the robot in these specs (11 of the 31 KitchenBench specs, such as kitchen_bench_lightwheel_open_fridge), and the robot's relations already count in the other 20. Skipping them drops the most direct robot-placement signal. Is there a reason not to score them? Skipping only when every asset is an anchor (all(asset.is_anchor for asset in inputs.assets)) would match the case where a build has nothing to place.

if best.success:
record.layout_successes += 1
else:
for check in validation.get_failed_validation_check_names:

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.

🔵 failed_checks counts checks that never ran

PlacementValidationRunner._run_expensive_checks() records ik_reachable as False for every candidate that failed a cheaper required check, without running IK (placement_validation_runner.py:130). So in the cuRobo image, failed_checks["ik_reachable"] always equals the number of failed layouts and points at IK even when IK never ran.

Could this leave out checks whose validator has run_after_inexpensive_checks when a required cheaper check already failed? Or, at least, could the EnvironmentRecord.failed_checks docstring say so? Also, test_seed_results_count_each_layout_by_its_best_candidate passes ik_reachable=True for candidates that fail no_overlap, which the runner never produces.

environments: list[EnvironmentComparison]
"""One entry per environment scored in both runs with the same checks."""

unpaired: list[tuple[str, str, str, str]]

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.

🔵 Positional tuples in RunComparison

format_comparison() unpacks unpaired, settings_differences and check_differences by position. _status_name() also turns EnvironmentStatus into strings, plus a "missing" value, before formatting. The rest of the result already uses dataclasses (RateChange, SuiteComparison, EnvironmentComparison). Could these be small dataclasses too, for example UnpairedEnvironment(suite, environment, baseline_status: EnvironmentStatus | None, candidate_status: EnvironmentStatus | None), CheckDifference and SettingDifference, with "missing" printed only in format_comparison()?

A suite has no rate metrics when any of its environments failed, and the
script exits with an error after writing the file.

The file also records whether the checkout had uncommitted changes. Only the

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.

🔵 The examples mark the next run as dirty

The commands on this page write results into the checkout root. In a single checkout, the second run, or a full run after the quick check, then records dirty: true. *outputs/ is already gitignored, so mkdir -p outputs and --output outputs/placement_main.json avoid that.

Also, dirty isn't printed anywhere: format_run() shows only the commit and branch, and format_comparison() shows neither run's commit. Could the comparison print each run's commit and dirty flag?

assert "| robolab | 1 | 90.0% → 100.0% |" in completed.stdout


def test_cli_rejects_repeated_seeds_without_simulator():

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.

🔵 This check can run in-process

The assert fails before SimulationAppContext with an AssertionError, not SystemExit, so it doesn't need a child interpreter. As written, if the assert regressed, the child would start Isaac Sim on all 69 specs and only fail at the 300 s timeout. test_environment_runner.py already calls main() in-process this way (this needs import sys):

def test_cli_rejects_repeated_seeds_without_simulator(monkeypatch):
    """A repeated seed would count the same candidates twice, so the CLI rejects it before starting the simulator."""
    from isaaclab_arena.scripts import placement_success_benchmark

    # A filter that matches no spec stops a regression before the simulator starts.
    argv = ["placement_success_benchmark.py", "--placement_seeds", "0", "0", "--env", "no_such_spec"]
    monkeypatch.setattr(sys, "argv", argv)
    with pytest.raises(AssertionError, match="--placement_seeds must be distinct"):
        placement_success_benchmark.main()

@arena-review-bot

arena-review-bot Bot commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

🤖 Isaac Lab-Arena Review Bot

Summary

This PR adds three things:

  • a placement-success benchmark script;
  • a module that stores results and compares two runs;
  • ArenaEnvBuilder.prepare_live_placement_inputs(), so the benchmark places the same inputs a build places.

Since the last review, the settings live in PlacementBenchmarkSettings. --compare now leaves an environment out only when a check that only one run requires rejected candidates in that run. Most points from the earlier review are fixed: the suite interval, robot-only specs, the comparison types, and the doc paths and provenance. Two issues remain in the new rule for leaving environments out of the comparison. There is also one seeding issue that no current spec triggers.

Findings

🟡 Warning: isaaclab_arena/offline_placement/placement_success.py:500: IK counts as failing on every candidate it skipped. So the exception for a required check that rejected nothing almost never applies to ik_reachable. Comparing a run from the cuRobo image with one from the base image leaves out every environment that has the IK check and where any candidate failed a cheaper check. The fix is to count only the candidates a check actually ran on.

🔵 Improvement: isaaclab_arena/offline_placement/placement_success.py:440: environments left out because their checks differ are listed by check name only. Suppose the change under test adds a required check. --compare then shows no rates for exactly the environments that check affects.

🔵 Improvement: isaaclab_arena/scripts/placement_success_benchmark.py:286: a RigidObjectSet with random_choice=True keeps the members chosen by the first seed. Results for later seeds then depend on the order of --placement_seeds. No spec uses one yet.

The PR description has no Validation section. Please add a line on what you ran, for example a full run's time and the baseline rates. That would help reviewers judge the defaults (50 layouts, seeds 0 1 2).

Test Coverage and CI Cost

test_comparison_leaves_out_environments_whose_success_criteria_changed sets candidate_failures_per_check by hand. No test passes records built by add_seed_results() into compare_results(), so the first finding goes unnoticed. Once that's fixed, a test with verdicts like the ones the runner produces would cover it.

Pre-commit passed on this head. The image builds were still queued and the test jobs had been skipped, so the new tests have not run in CI yet. I didn't run the tests or the benchmark. I checked the statistics with a separate re-implementation, and it matched the test values.

Verdict

Minor fixes needed

@zhx06 zhx06 changed the title Add a placement-success benchmark with KPI output Add a placement-success benchmark with run comparison Oct 22, 2026
@zhx06
zhx06 force-pushed the zxiao/feature/placement-success-benchmark branch from 9b7481f to 9644d3c Compare October 23, 2026 00:55
zhx06 added a commit that referenced this pull request Oct 26, 2026
Use oriented bounding boxes for placement collision loss and validation.
Keep the existing interval calculation for axis-aligned boxes and batch
collision checks across candidates. This builds on `OrientedBoundingBox`
from #1477.

## Why this change?

Enclosing AABBs can overlap even when rotated objects are separate.
Placement previously penalized and rejected those layouts, although the
oriented geometry was available.

## What changes?

- Preserve each candidate's rotation and assigned object geometry
through solving, filtering, ranking and validation.
- **Loss for rotated boxes:** multiply the interval overlaps along each
box's face axes, and penalize the harmonic mean of the two volumes.
- It is zero exactly when a face axis separates the boxes by at least
`clearance_m`, and it equals the intersection volume for axis-aligned
pairs.
- When only one box's projections sit inside the other's, the other
box's volume still gives a gradient.
- `CachedOverlapVolumeUpperBound` caches the rotation-dependent terms
once per solve. Its `compute()` still returns the smaller volume, a true
upper bound.
- Validate with the separating-axis test.
- Keep the axis-aligned loss, directed gradients and existing mesh
checks. Use matching collision geometry for meshless background
obstacles.
- `RelationSolver` prepares pair routing for the box and mesh losses
once per solve.
- In the oriented loss, used when any collision box in a solve is
rotated, boxes thinner than 2 mm count as 2 mm thick. A flat object that
overlaps an obstacle therefore still has an overlap volume to reduce.

`collision_bboxes` stores oriented geometry once per batch, and each
candidate's enclosing AABBs are derived from it. Those AABBs remain
available for relation constraints and mesh proxies. For rotated rows
they can differ from the previous rotation code by up to about 2e-7 m.

`CollisionMode.BBOX` uses this automatically. Arbitrary-yaw results can
change, including existing clutter examples. Support containment and
clutter release initialization remain AABB-based; the existing
rotated-support and `On(overlap=True)` containment issues need a
separate correction.

## Results

The placement-success benchmark (#1497) ran every RoboLab and
KitchenBench spec on main and on this branch, with 50 layouts × 3 seeds
per spec.

| Setting | Suite | Layout success, main → this PR | Change (95%
interval) | Valid candidates, main → this PR | Change (95% interval) |
| --- | --- | ---: | ---: | ---: | ---: |
| Random yaw | RoboLab (38) | 64.6% → 76.4% | +10.9 to +12.3 pts | 36.2%
→ 64.6% | +28.0 to +28.7 pts |
| Random yaw | KitchenBench (20) | 31.8% → 33.1% | −0.1 to +2.6 pts |
8.2% → 8.5% | −0.1 to +0.7 pts |
| As authored | RoboLab (38) | 94.2% → 94.2% | −0.8 to +0.8 pts | 67.0%
→ 67.6% | +0.2 to +1.0 pts |
| As authored | KitchenBench (20) | 84.2% → 84.2% | −1.6 to +1.7 pts |
27.3% → 27.3% | −0.7 to +0.6 pts |

- **Random yaw:** 24 RoboLab tasks improve significantly after a Holm
adjustment, and none get worse. Bin and clutter tasks gain the most:
- `throw_away_snacks`: layout success goes from 28% to 100%, and valid
candidates from 3% to 68%;
  - `marker_in_mug`: valid candidates go from 7% to 82%.
- **KitchenBench is unchanged.** Random yaw also turns its robot away
from the fixture it is placed next to, and that dominates its failures,
so its random-yaw row says little about oriented boxes.
- **As authored:** no suite gets worse. Two RoboLab tasks improve,
`food_packing_1_boxes` and `food_packing_1_cans` (valid candidates 75% →
84%).
- **Why it improves:** the separating-axis test is exact for boxes, so
rotated layouts that enclosing AABBs falsely rejected now pass.
- **Exact quarter turns** are unchanged: positions, losses and verdicts
match main.

## Limitations

- **Tilted boxes:** the loss can penalize tilted boxes that the
separating-axis test finds separate.
- **Crossed rods:** when two long, thin boxes cross in an X, both
face-axis volumes are flat and the gradient is zero. In a probe with two
0.5 m rods at random yaw, 73.4% of candidates were valid, against 78.7%
with the enclosing-AABB loss under the same validator. A follow-up adds
an in-plane enclosing-box term to rotated pairs, which reached 84.5% in
the same probe.
- **Near-quarter yaws:** robot yaws such as `yaw_rad: 1.57` in
KitchenBench are not exact quarter turns, so those scenes take the
oriented path. Positions matched main in a probe; only the cost differs.

## Performance

- **Per solver iteration:** cost rises in rotated scenes, because each
directed pair stores a rotation per candidate. Caching the
rotation-dependent terms makes iterations 6–26% faster on CPU and lowers
peak memory by 16–22%, compared with recomputing them. The harmonic mean
adds 4–10% per iteration on CPU over the smaller volume.

  | Scene (objects × candidates) | CPU per iteration | Peak GPU memory |
  | --- | ---: | ---: |
  | 6 × 640 | 3.2 → 3.5 ms | 2.4 → 6.6 MiB |
  | 12 × 1024 | 7.3 → 9.8 ms | 15.2 → 44.4 MiB |
  | 25 × 1024 | 26.5 → 37.0 ms | 65.8 → 194.6 MiB |

- **Validation** is batched across candidates, which offsets much of the
solver cost.
- **Full-suite wall time** was noisy on a shared machine. Random-yaw
RoboLab went from 979 to 802 s. As authored, the median spec took 16%
longer.

These are placement measurements, not physics-acceptance rates.

## Validation

- **Benchmark:** the runs above compare main at `88f83c967a` with this
branch's final loss, before rebasing onto the Isaac Lab 3.0 update
(#1481). All 69 specs ran with no failures in both settings.
- **CI:** every check passes on `16e712dce3`, including both test jobs.
- **Local tests:**
- 392 placement, geometry and collision tests pass, including the
relation-solver visualization example;
- 24 simulator tests pass, covering clutter placement, embodiment
collision meshes, placement after build-time variations, and relation
placement from YAML;
  - pre-commit passes.
- **Stuck gradient:** a test places a yawed bar whose own-axis volume is
constant against a cube. It checks that the smaller volume has zero
gradient there, while the loss pushes the bar out.
- **Exact quarter turns:** candidate positions, losses and verdicts
match the AABB baseline exactly. The harmonic mean equals the exact
volume for axis-aligned pairs.
- **Zero thickness:** a test checks that a zero-thickness panel
overlapping a fixed block gets a loss and is pushed clear; it fails
without the 2 mm minimum.
- **Loss vs validator:** in 1.6M random pairs, yaw-only and tilted, at
margins 0 and 0.01, the validator accepted every layout the loss treats
as clear. The harmonic mean is zero exactly where the smaller volume is,
so this still holds.

---------

Signed-off-by: zhx06 <zihaox@nvidia.com>
@zhx06
zhx06 force-pushed the zxiao/feature/placement-success-benchmark branch from 9644d3c to 01381e9 Compare October 26, 2026 17:39
@zhx06
zhx06 marked this pull request as ready for review October 26, 2026 17:39
@greptile-apps

greptile-apps Bot commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge; no actionable issues were established.

Summary

Adds a placement-success benchmark for RoboLab and KitchenBench, plus saved results and run comparisons.

  • Placement runs now produce success rates for RoboLab and KitchenBench tasks.
  • Saved placement runs now show how suite and task success rates changed.

No actionable issues were established. Review checks were static; tests were not run.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart LR
  Specs[YAML specs] --> Inputs[Shared live placement inputs]
  Inputs --> Candidates[Seeded candidates]
  Candidates --> Checks[Pre-physics checks and ranking]
  Checks --> Counts[Layout and candidate counts]
  Counts --> Results[Saved results]
  Results --> Compare[Suite and environment comparisons]
Loading

Reviews (1) · Last reviewed commit: "Add PlacementBenchmarkSettings, drop KPI..." · Reviewed by Greptile

required_after = after.checks.get(check, False)
if required_before != required_after:
record_requiring_check = before if required_before else after
if record_requiring_check.candidate_failures_per_check.get(check, 0) > 0:

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.

🟡 The exception rarely applies to IK

This follows up on the earlier note about skipped IK counts. add_seed_results() counts ik_reachable as failing on every candidate that failed a cheaper required check. So this condition is true whenever any candidate failed no_overlap or on_relation, even if IK passed every candidate it actually ran on. Comparing a run from the cuRobo image with one from the base image leaves out every environment that has the IK check and any cheap failure.

PlacementValidationRunner.validate_candidates() already builds evaluated_layout_indices_by_check and then discards it. Could it record which checks a candidate skipped, so add_seed_results() counts only the candidates a check ran on? Counting only the candidates whose single failure is that check won't work. A skipped IK check always fails alongside the cheap check that caused the skip.

for excluded in comparison.check_differences:
lines.append(
f"- {excluded.suite}/{excluded.environment}: before {_format_checks(excluded.before.checks)};"
f" after {_format_checks(excluded.after.checks)}"

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.

🔵 Show rates for environments left out?

Suppose the change under test adds a required check. This list then holds exactly the environments that check affects, but --compare prints only their check names. Could each line also show the layout-success and valid-candidate rates before and after, without an interval or significance flag? Then the size of the effect is visible without opening the JSON files.

inputs.assets, inputs.scene_assets, params.solver_params.collision_mode
)
self._num_layouts = settings.num_layouts
self._first_seed = seed_block_index * _SEEDS_PER_ENVIRONMENT

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.

🔵 Object-set members depend on seed order

ObjectPlacer._place_ranked() calls assign_variants_for_envs(), which does nothing once a RigidObjectSet has members assigned for the same num_envs. A set with random_choice=True therefore keeps the members chosen by the first seed. Seed 1 gets different members with --placement_seeds 0 1 than with --placement_seeds 1. No spec uses an object set yet. Could __init__ choose the members once from this environment's seed block? This also needs from isaaclab_arena.relations.bounding_box_helpers import assign_variants_for_envs next to the other imports.

Suggested change
self._first_seed = seed_block_index * _SEEDS_PER_ENVIRONMENT
self._first_seed = seed_block_index * _SEEDS_PER_ENVIRONMENT
# An object set keeps its first member assignment, so draw it from this environment's seed block.
assign_variants_for_envs(self._assets, self._num_layouts, placement_seed=self._first_seed)

@zhx06
zhx06 force-pushed the zxiao/feature/placement-success-benchmark branch from 00b91f8 to ed92e28 Compare October 27, 2026 20:41
``isaaclab_arena/scripts/placement_success_benchmark.py`` measures how often
relation placement succeeds across the RoboLab and KitchenBench environment
specs. Run it before and after a change to the placement pipeline, then compare
the two runs to check for regressions.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Can we add as an automated unit test that fails if there's regression? Then we won't have to run and compare manually
If the runtime is too long for a unit tests we could add a limited experiment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Addressed. The new commit contains a unit test for the regression.

@zhx06
zhx06 force-pushed the zxiao/feature/placement-success-benchmark branch from ed92e28 to f7a76f7 Compare October 28, 2026 16:54
zhx06 added 9 commits October 28, 2026 19:46
Signed-off-by: zhx06 <zihaox@nvidia.com>
Signed-off-by: zhx06 <zihaox@nvidia.com>
Signed-off-by: zhx06 <zihaox@nvidia.com>
Signed-off-by: zhx06 <zihaox@nvidia.com>
Signed-off-by: zhx06 <zihaox@nvidia.com>
Signed-off-by: zhx06 <zihaox@nvidia.com>
Signed-off-by: zhx06 <zihaox@nvidia.com>
Signed-off-by: zhx06 <zihaox@nvidia.com>
Signed-off-by: zhx06 <zihaox@nvidia.com>
Signed-off-by: zhx06 <zihaox@nvidia.com>
@zhx06
zhx06 force-pushed the zxiao/feature/placement-success-benchmark branch from 3c5288b to df180f9 Compare October 29, 2026 03:05
#
# SPDX-License-Identifier: Apache-2.0

"""Placement-success benchmark results: settings, results files, suite summaries and run comparisons.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

AI-drafted (Claude Code), reviewed by me.

Suggestion (non-blocking): split this PR into four stacked PRs

At df180f9 the PR adds about 2,000 lines across 15 files. Changes to core placement code sit next to a benchmark runner, the comparison statistics and a regression baseline, which makes it hard to review each part properly. The parts depend on each other in order, so they stack:

  1. Placement diagnostics (~250 lines)
    • relations/placement_diagnostics.py.
    • The changes to ObjectPlacer, PooledObjectPlacer and PlacementValidationRunner.validate_candidates.
    • The ArenaEnvBuilder.placement_diagnostics field.
    • Tests: test_placement_diagnostics.py, test_a_failed_rebuild_clears_the_placement_diagnostics, and the updates to the clutter, face-to and heterogeneous-placement tests.
  2. Benchmark runner and results file (~800 lines)
    • scripts/placement_success_benchmark.py, without --compare.
    • From this file: PlacementBenchmarkSettings, EnvironmentRecord, PlacementBenchmarkResults, summarize_suites and format_results.
    • The seed, provenance, spec-discovery and round-trip tests.
    • The docs, except the comparison section.
  3. Run comparison (~550 lines)
    • compare_results and format_comparison.
    • The RateChange and *Comparison types.
    • The interval, Holm and p-value helpers.
    • --compare, the comparison tests and the comparison section of the docs.
  4. Baseline regression test (~150 lines)
    • test_placement_success_matches_the_baseline and test_data/placement_success_baseline.json.

Why split it this way:

  • PR 1 is the only part that changes core placement code, so it needs the most careful review. It is also useful by itself: pool RuntimeErrors then report per-check rejection counts.
  • PR 3 is plain Python that runs without the simulator, so the statistics can be reviewed without the runner around them.
  • PR 4 should go last, with the baseline generated from the merged code. The current baseline records commit f7a76f7 with dirty: true, and that commit isn't in the branch history.

The commits don't follow this split (db2c569 touches parts 1–3), so rebuilding the branches from the final tree is probably easier than cherry-picking.



@dataclass
class ValidatedBatch:

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

AI-drafted (Claude Code), reviewed by me.

Suggestion (non-blocking): rename ValidatedBatch and CheckCounts

ValidatedBatch reads like the batch of candidates after validation, but it holds only counts. As a result, ObjectPlacer.validated_batches (object_placer.py:64) looks like it keeps candidate batches alive. CheckCounts is vague on its own, because "check" could mean anything.

Suggest these names, so the three types form one diagnostics family:

PlacementDiagnostics                                       one per pool fill
  └─ batches: list[BatchValidationDiagnostics]             one per validated batch
       └─ checks: dict[str, ValidationCheckDiagnostics]    one per check
  • ValidatedBatch → BatchValidationDiagnostics
  • CheckCounts → ValidationCheckDiagnostics
  • ObjectPlacer.validated_batches → batch_validation_diagnostics

#
# SPDX-License-Identifier: Apache-2.0

"""Placement-success benchmark results: settings, results files, suite summaries and run comparisons.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

AI-drafted (Claude Code), reviewed by me.

Design: move the benchmark into a new isaaclab_arena_benchmarking package

Right now the benchmark code is split between two places that don't fit it:

  • offline_placement/placement_success.py: offline_placement/ holds the offline settled-placement code (settling, recording, pool validation). The benchmark now measures the live build path instead. Also, this file is results-file I/O plus comparison statistics, not placement code.
  • scripts/placement_success_benchmark.py: this holds library code beside the CLI (measure_environment, get_placement_seed, add_build_results, discover_specs, get_git_provenance). The tests import those functions from isaaclab_arena.scripts.

I'd move all the benchmarking code into a new top-level package with an object_placement subfolder:

isaaclab_arena_benchmarking/
  object_placement/
    measurement.py                        # measure_environment, seeds, spec discovery, provenance
    results.py                            # settings, EnvironmentRecord, results file, summaries
    comparison.py                         # compare_results, intervals, Holm, format_comparison
    run_placement_success_benchmark.py    # CLI only: argument parsing and main()
  tests/
    test_object_placement_benchmark.py
    test_data/placement_success_baseline.json

These stay in core, because the build uses them:

  • relations/placement_diagnostics.py
  • ArenaEnvBuilder.placement_diagnostics
  • test_placement_diagnostics.py and test_a_failed_rebuild_clears_the_placement_diagnostics

Why do it this way:

  • It keeps the code that measures the library apart from the library itself.
  • It matches the other first-party packages (isaaclab_arena_gr00t, isaaclab_arena_curobo, ...), each of which has its own tests/.
  • It gives other benchmarks a home too.

Splitting placement_success.py into results.py and comparison.py also lines up with the suggested PR split.

Two things to do along with the move:

  • CI: .github/workflows/ci.yml lists test directories explicitly. Add isaaclab_arena_benchmarking/tests/ there, or the baseline regression test stops running. That's a workflow change, so please flag it in the PR description.
  • Packaging: add the package to [tool.setuptools.packages.find] in pyproject.toml, and declare the baseline JSON as package data.

This branch has not been deployed

No deployments
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.

3 participants