Skip to content

feat: Allow tuner warm start and custom constraint objective value#235

Draft
Copilot wants to merge 2 commits intomainfrom
copilot/feat-allow-initial-guess-for-tuner
Draft

feat: Allow tuner warm start and custom constraint objective value#235
Copilot wants to merge 2 commits intomainfrom
copilot/feat-allow-initial-guess-for-tuner

Conversation

Copy link
Contributor

Copilot AI commented Mar 24, 2026

Exposes OptunaSearch's points_to_evaluate for warm-starting the tuner, and extends ConstraintError to allow specifying a custom fallback objective value when a constraint is breached (instead of always defaulting to ±∞).

Summary

Two related tuner enhancements:

  1. Warm start: Pass initial parameter guesses to OptunaSearch via points_to_evaluate — useful in large or heavily constrained search spaces where finding a feasible solution from scratch is slow.
  2. Custom constraint penalty: ConstraintError now accepts an objective_value keyword arg, giving users control over the fallback metric value on constraint violation.

Changes

  • OptunaSpec (plugboard-schemas/plugboard_schemas/tune.py): Added points_to_evaluate: list[dict[str, Any]] | None = None, passed through to OptunaSearch automatically.

  • ConstraintError (plugboard/exceptions/__init__.py): Added objective_value: float | None = None keyword argument — fully backward compatible.

  • Tuner._build_objective (plugboard/tune/tune.py): When catching ConstraintError, uses objective_value from the first exception if set; falls back to ±∞ otherwise.

# Warm start
tuner = Tuner(
    ...,
    algorithm=OptunaSpec(
        points_to_evaluate=[{"component.model.arg.lr": 0.01, "component.model.arg.depth": 4}]
    ),
)

# Custom constraint penalty instead of -inf
class MyComponent(Component):
    async def step(self) -> None:
        if self.value > threshold:
            raise ConstraintError("Exceeded threshold", objective_value=0.0)
        ...

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • metadata.google.internal
    • Triggering command: /home/REDACTED/work/plugboard/plugboard/.venv/bin/python3 /home/REDACTED/work/plugboard/plugboard/.venv/bin/python3 /home/REDACTED/work/plugboard/plugboard/.venv/lib/python3.12/site-packages/ray/dashboard/dashboard.py --host=127.0.0.1 --port=8265 --port-retries=50 --temp-dir=/tmp/ray --log-dir=/tmp/ray/session_2026-03-24_21-00-28_914433_4186/logs --session-dir=/tmp/ray/session_2026-03-24_21-00-28_914433_4186 --logging-rotate-bytes=536870912 --logging-rotate-backup-count=5 --gcs-address=127.0.0.1:40589 --cluster-id-hex=969a8a9f5ae9b5f2d53dbf00cfe93d188387267675e097636f37106a --node-ip-address=127.0.0.1 --stdout-filepath=/tmp/ray/session_2026-03-24_21-00-28_914433_4186/logs/dashboard.out --stderr-filepath=/tmp/ray/session_2026-03-24_21-00-28_914433_4186/logs/dashboard.err (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Original prompt

This section details on the original issue you should resolve

<issue_title>feat: Allow tuner to accept an initial guess to give it a 'warm start'</issue_title>
<issue_description>### Summary

The OptunaSearch algo supports a points_to_evaluate argument, which can be populated with an initial guess. This is particularly useful when exploring large and heavily constrained search spaces, where it otherwise takes a long time for the tuner to find a feasible solution.

Feature request to to expose this argument, and update docs where necessary.

Example

No response

Alternatives

No response</issue_description>

<agent_instructions>Also implement a mechanism to set the objective to a value other than plus or minus infinity when a constraint is breached. This could be done by extending the ConstraintError class, allowing the user to pass in a value that they would like to give the objective. Make sure to preserve backwards compatibility with the current t behaviour. </agent_instructions>

Comments on the Issue (you are @copilot in this section)


⌨️ Start Copilot coding agent tasks without leaving your editor — available in VS Code, Visual Studio, JetBrains IDEs and Eclipse.

- Add points_to_evaluate field to OptunaSpec schema for warm-start
- Extend ConstraintError with optional objective_value parameter
- Update Tuner to use custom objective_value when constraint is breached
- Add unit tests for both features
- Add integration test for custom constraint objective value

Co-authored-by: toby-coleman <13170610+toby-coleman@users.noreply.github.com>
Agent-Logs-Url: https://github.com/plugboard-dev/plugboard/sessions/848acc70-821c-4f54-9f91-f5a89f2b57b5
Copilot AI changed the title [WIP] Add initial guess support for OptunaSearch tuner feat: Allow tuner warm start and custom constraint objective value Mar 24, 2026
Copilot AI requested a review from toby-coleman March 24, 2026 21:08
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.

feat: Allow tuner to accept an initial guess to give it a 'warm start'

2 participants