Skip to content

[tune] Modernize AxSearch for Ax Platform 1.0.0+ - #60522

Merged
matthewdeng merged 22 commits into
ray-project:masterfrom
ans9868:fix/ax-search-modern-api
Apr 17, 2026
Merged

matthewdeng merged 22 commits into
ray-project:masterfrom
ans9868:fix/ax-search-modern-api

Conversation

@ans9868

@ans9868 ans9868 commented Jan 27, 2026

Copy link
Copy Markdown
Contributor

Update AxSearch to work with modern Ax versions (1.0.0+) which have:

  • Stricter error checking (AssertionError instead of ValueError)
  • New objectives API replacing deprecated objective_name/minimize params

Changes:

  • Import ObjectiveProperties from ax.service.ax_client
  • Update create_experiment() to use objectives={metric: ObjectiveProperties(...)}
  • Handle AssertionError when checking for existing experiment (Ax 1.0+)

Fixes part of #60512

@ans9868
ans9868 requested a review from a team as a code owner January 27, 2026 02:57

@gemini-code-assist gemini-code-assist Bot left a comment

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.

Code Review

This pull request effectively modernizes the AxSearch integration to support Ax platform versions 1.0.0 and newer. The changes correctly adopt the new objectives API, replacing deprecated parameters, and properly handle the new AssertionError for checking experiment existence, ensuring compatibility across different Ax versions. The addition of defensive error handling when accessing the experiment post-setup is a good improvement for robustness. Overall, the changes are clear, correct, and well-executed.

@ray-gardener ray-gardener Bot added tune Tune-related issues community-contribution Contributed by the community labels Jan 27, 2026
@edoakes

edoakes commented Feb 2, 2026

Copy link
Copy Markdown
Collaborator

@justinvyu PTAL

@github-actions

Copy link
Copy Markdown

This pull request has been automatically marked as stale because it has not had
any activity for 14 days. It will be closed in another 14 days if no further activity occurs.
Thank you for your contributions.

You can always ask for help on our discussion forum or Ray's public slack channel.

If you'd like to keep this open, just leave any comment, and the stale label will be removed.

@github-actions github-actions Bot added the stale The issue is stale. It will be closed within 7 days unless there are further conversation label Feb 17, 2026
@ans9868

ans9868 commented Feb 17, 2026

Copy link
Copy Markdown
Contributor Author

Note stale.

@ans9868

ans9868 commented Feb 18, 2026

Copy link
Copy Markdown
Contributor Author

To ensure stability across the modern Ax API, I have verified these fixes using Ray Tune’s smoke tests and a custom test suite across key stable releases in the Ax 1.x ecosystem:

  • Ax 1.0.0
  • Ax 1.1.2
  • Ax 1.2.1
    The tests confirm that the create_experiment API modernization and updated error handling function consistently across all tested versions. Most importantly, without these changes, Ray Tune currently fails or crashes when used with Ax 1.0+ due to legacy API calls and unhandled exceptions.

@github-actions github-actions Bot added unstale A PR that has been marked unstale. It will not get marked stale again if this label is on it. and removed stale The issue is stale. It will be closed within 7 days unless there are further conversation labels Feb 18, 2026

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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Thanks @matthewdeng. I updated tune-requirements.txt to pin ax-platform==1.2.1 (with a note on the >=1.0.0 compatibility requirement).

I also rebased the branch to fix the missing DCO sign-offs. Ready for review.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Ah, the cursor-bot had a good catch. I am updating the test files to match the new API and removing the redundant error handling now. Will push a fix shortly.

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.

Sweet. I think one other thing you'll have to do is to get the compiled dependencies (which you can get from the Buildkite job) and update the requirements_compiled.txt file.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Thanks for the tip. My local build environment is acting up, so I will grab the generated requirements_compiled.txt from the Buildkite artifacts once this run finishes and push that update tonight/tomorrow.

@ans9868 ans9868 Feb 19, 2026 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Ray Requirements Compilation Update

TLDR: If I can't get the requirements_compiled.txt from BuildKite artifacts, can I hack a version using pip-tools on ARM64, or do I need access to an AMD64/x86_64 system due to platform-specific GPU dependencies?

Update on Requirements Compilation

Hey @matthewdeng, thanks for the guidance! I'm still working on getting the dependencies sorted out properly.

Background:
I discovered that Ray uses a monolithic requirements_compiled.txt that includes dependencies from all modular requirements files (base, tune, serve, llm, test, cloud, etc.), rather than separate compiled files.

The core issue:
When BuildKite tried to build with just the updated tune-requirements.txt (ax-platform==1.2.1), it failed with a constraint conflict:

ERROR: Cannot install ax-platform==1.2.1 because these package versions have conflicting dependencies.
The conflict is caused by:
    The user requested ax-platform==1.2.1
    The user requested (constraint) ax-platform==0.3.2

This happened because requirements_compiled.txt still had the old constraint while the source file specified the new version.

Compilation challenges on ARM64:
Ray's official compilation script skips ARM64 platforms (I am currently using a mac mini):

$ ./ci/ci.sh compile_pip_dependencies
+ [[ arm64 == \a\a\r\c\h\6\4 ]]
+ echo 'Skipping for aarch64'
Skipping for aarch64

Current approach (manual hack):
I'm using pip-tools locally to regenerate requirements, but this approach has limitations:

  • Platform differences: ARM64 vs x86_64 dependency resolution may differ
  • Missing GPU packages: Many packages like torch+cu121 aren't available for ARM64
  • Ray's custom logic: Official compilation may have specific handling I'm missing

Looking at dl-gpu-requirements.txt, Ray uses complex platform-specific dependencies:

torch==2.3.0+cu121
tensorflow-macos==2.15.1; sys_platform == 'darwin' and platform_machine == 'arm64'
cupy-cuda12x>=13.4.0; sys_platform != 'darwin'

These won't resolve correctly on my ARM64 Mac.

Backup plan:
If the manual approach fails, I can use NYU's HPC cluster (AMD64) to run Ray's official compilation process:

./ci/ci.sh compile_pip_dependencies

Question: Is the manual pip-tools approach acceptable as a quick fix, or should I prioritize using the official compilation on x86_64 hardware?

Thanks for your patience.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Quick update: The manual pip-tools approach is creating version conflicts.

I'm going to compile properly on NYU's HPC (AMD64) using ./ci/ci.sh compile_pip_dependencies to avoid ARM64/platform issues. Should have the correct requirements_compiled.txt shortly.

@matthewdeng matthewdeng left a comment

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.

thanks so much!

@matthewdeng
matthewdeng enabled auto-merge (squash) April 13, 2026 16:32
@github-actions github-actions Bot added the go add ONLY when ready to merge, run all tests label Apr 13, 2026
auto-merge was automatically disabled April 13, 2026 17:07

Head branch was pushed to by a user without write access

ans9868 added 3 commits April 13, 2026 16:47
Add a Linux x86_64 lower bound (>=2.26.2,<3) in dl-cpu/dl-gpu and py313 mirrors so pip-compile constraints match cu128 torch. Update requirements_compiled.txt and requirements_compiled_py3.13.txt to nvidia-nccl-cu12==2.26.2, fixing pip/uv conflicts with requirements_compiled used as -c during ray-ml Docker installs and raydepsets.

Signed-off-by: Adel Nour <[email protected]>
Pin ax-platform==1.2.1, bayesian-optimization==1.4.3, nevergrad==0.4.3.post7, and ConfigSpace==0.7.1 to match tune-requirements.txt. Omit jaxtyping cap for Python 3.13 (cap remains in default file for Python 3.10). Regenerate requirements_compiled_py3.13.txt if included in this commit.

Signed-off-by: Adel Nour <[email protected]>
@ans9868
ans9868 force-pushed the fix/ax-search-modern-api branch from dd4f73c to e2abdf2 Compare April 13, 2026 20:49
ans9868 added 4 commits April 13, 2026 19:27
Gate torchtext==0.18.0 to python_version < 3.13 in dl-cpu and py313/dl-cpu because 0.18.0 has no cp313 wheels. Set nevergrad to 0.4.3.post7 in requirements_compiled_py3.13.txt so it matches tune-requirements and avoids uv unsat with -c during raydepsets.

Signed-off-by: Adel Nour <[email protected]>
jaxlib only publishes cp313 wheels from 0.4.34 onward; jax 0.4.33 caps
jaxlib at 0.4.33, so older pins fail pip resolution on 3.13. Align
dl-cpu, dl-gpu (CUDA jaxlib), and data-test py313 files with comments.

Signed-off-by: Adel Nour <[email protected]>
…txt; seeing if they pass tests

compiled_requirements.txt was grabed as an artifact from  build: pip-compile dependencies [g8_s0]

Signed-off-by: Adel Nour <[email protected]>
…PU jaxlib)

Pin jax/jaxlib to 0.9.2 on CPU/data-test; replace jaxlib+X+cuda12.cudnn89 with
jax-cuda12-plugin[with-cuda]==0.9.2 for CUDA 12 (cp313; legacy GCS cudnn89 path
has no viable GPU wheels for 3.13).

Signed-off-by: Adel Nour <[email protected]>
@ans9868
ans9868 force-pushed the fix/ax-search-modern-api branch 3 times, most recently from 5e7296d to 5104552 Compare April 17, 2026 05:15
from ax.generation_strategy.generation_strategy import GenerationStrategy
except ImportError:
# ax 0.x
from ax import Models

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Inconsistent fallback import path for older Ax Models

Low Severity

The fallback import for older Ax versions in test_sample.py uses from ax import Models, while test_tune_restore_warm_start.py correctly uses from ax.modelbridge.registry import Models. The from ax import Models shortcut is not guaranteed to work across all older Ax versions — the canonical import path for pre-1.0 Ax is ax.modelbridge.registry. This inconsistency means the fallback branch in testSampleBoundsAx could raise an ImportError on some older Ax installations.

Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 5104552e9a9dddc604a4580a04e3c4ed8b4509aa. Configure here.

@ans9868
ans9868 force-pushed the fix/ax-search-modern-api branch 2 times, most recently from f1152f3 to 4ea61a3 Compare April 17, 2026 06:01

@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 1 potential issue.

There are 2 total unresolved issues (including 1 from previous review).

Fix All in Cursor

Reviewed by Cursor Bugbot for commit 4ea61a3121741b5a6cdb377b9ee41ad61867604a. Configure here.

Comment thread python/ray/tune/search/ax/ax_search.py Resolved
@ans9868
ans9868 force-pushed the fix/ax-search-modern-api branch from 4ea61a3 to ad541d5 Compare April 17, 2026 06:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

community-contribution Contributed by the community go add ONLY when ready to merge, run all tests tune Tune-related issues unstale A PR that has been marked unstale. It will not get marked stale again if this label is on it.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants