Skip to content

FE-1536: Contour surface for optimization studies with local recompute - #9398

Merged
kube merged 2 commits into
cf/fe-1535-sweep-parameters-as-intervals-with-a-range-sliderfrom
cf/fe-1536-contour-surface-for-optimization-studies-with-local
Sep 3, 2026
Merged

FE-1536: Contour surface for optimization studies with local recompute#9398
kube merged 2 commits into
cf/fe-1535-sweep-parameters-as-intervals-with-a-range-sliderfrom
cf/fe-1536-contour-surface-for-optimization-studies-with-local

Conversation

@kube

@kube kube commented Aug 28, 2026

Copy link
Copy Markdown
Collaborator

Important

Experimental
Behind the Optimization surface feature flag.

Summary

Before this PR, Optuna-style contour surface existed only in the Experiments drawer. An optimization study is where it matters most. It already declares bounded parameters and an objective. Its trials stream back with parameter and objective values.

This adds a Surface section to the optimization detail drawer. Study trials draw as markers over a contour computed locally. Sliders and clicks navigate it. Objective mean and median stream at the selected point.

Links

Changes

UI

  • optimization-surface.tsx renders in the drawer after Steps

    Gated on two non-boolean optimized parameters. X/Y pickers and one slider per optimized parameter, initialized from the best trial, else the domain midpoint.

  • Coarse-to-fine local walk feeds the contour

    Positions are cached with ladder seeds. Common random numbers follow the sweep rule.

  • Readout streams objective mean, median, and runs at the selected point
  • Completed trials draw as rings, best highlighted

    Projected the way Optuna's plot_contour projects.
    Clicking the surface navigates to the clicked position.

  • ds Slider gains step and onChangeEnd pass-throughs

Core

  • sampleDetachedObjective runs local compute against any net snapshot

    Lives on the experiments context, on a serialized single-worker lane.
    Compilation is cached per study, HIR artifacts plus scenario HIR.
    Objective runs as an expression metric.
    Booleans coerce to the engine's 0/1 encoding.

  • Study runs its frozen input.model.definition

    Not the live editor net. Both drift the moment the user edits after launching.

  • react/optimizations/surface-grid.ts builds quantized axes from the study's domains

    Log-scale domains quantize in log space. Integer domains snap to their declared step.

Known issues

Local batches queue on one serialized lane. On heavy nets the selected point's readout can wait behind walk cells. It should jump the queue. Tracked in the ticket.

Test coverage

  • surface-grid.test.ts:

    Log-space quantization and integer step snapping.

How to test

  • Open Petrinaut preview on Vercel
  • Viewport controls > Settings > Simulation > Optimization surface
  • Optimizations tab needs a deployment with the optimizer service on the /optimization route
  • Local fallback: turbo run dev --filter @apps/petrinaut-website -- --with-optimizer-service
  • Load example > Supply Chain Profit
  • Simulate > Optimizations > Create
  • Pick scenario, Optimize two numeric parameters with a search range, choose objective, Run
  • Open study drawer
  • Expect Surface section with sliders at best trial values and trial rings across the plane
  • Expect contour filling from local simulations of the frozen snapshot
  • Expect readout streaming mean and median for the selected point
  • Click surface
  • Expect sliders move to the clicked position

@kube kube self-assigned this Aug 28, 2026
@vercel

vercel Bot commented Aug 28, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
hash Ready Ready Preview Sep 3, 2026 4:26pm UTC
petrinaut Ready Ready Preview Sep 3, 2026 4:26pm UTC
petrinaut-docs Ready Ready Preview Sep 3, 2026 4:26pm UTC
1 Skipped Deployment
Project Deployment Actions Updated
hashdotdesign-tokens Ignored Ignored Preview Sep 3, 2026 4:26pm UTC

Request Review

@github-actions github-actions Bot added area/infra Relates to version control, CI, CD or IaC (area) area/libs Relates to first-party libraries/crates/packages (area) type/eng > frontend Owned by the @frontend team type/eng > backend Owned by the @backend team area/apps > hash.design Affects the `hash.design` design site (app) labels Aug 28, 2026
@kube
kube force-pushed the cf/fe-1536-contour-surface-for-optimization-studies-with-local branch from efd2c5b to c382f61 Compare August 30, 2026 13:08
@kube
kube force-pushed the cf/fe-1536-contour-surface-for-optimization-studies-with-local branch from c382f61 to f0fdf39 Compare September 1, 2026 23:17
@kube
kube force-pushed the cf/fe-1536-contour-surface-for-optimization-studies-with-local branch from f0fdf39 to db46a9e Compare September 2, 2026 15:04
@kube
kube force-pushed the cf/fe-1536-contour-surface-for-optimization-studies-with-local branch from db46a9e to 5dd4d15 Compare September 2, 2026 16:12
YannisZa
YannisZa previously approved these changes Sep 3, 2026
@kube
kube added this pull request to the merge queue Sep 3, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to a manual request Sep 3, 2026
@kube
kube force-pushed the cf/fe-1536-contour-surface-for-optimization-studies-with-local branch from 6f16f76 to 339f88e Compare September 3, 2026 13:03
@kube
kube requested a review from TimDiekmann September 3, 2026 13:03
TimDiekmann
TimDiekmann previously approved these changes Sep 3, 2026

@TimDiekmann TimDiekmann left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

re-approval of pre-rebase

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 2 potential issues.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 339f88e. Configure here.

@hash-release hash-release Bot mentioned this pull request Sep 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/apps > hash.design Affects the `hash.design` design site (app) area/infra Relates to version control, CI, CD or IaC (area) area/libs Relates to first-party libraries/crates/packages (area) type/eng > backend Owned by the @backend team type/eng > frontend Owned by the @frontend team

Development

Successfully merging this pull request may close these issues.

4 participants