Skip to content

[ci][llm] Migrate LLM tests to the reserved H100 cluster - #67525

Merged
jeffreywang88 merged 14 commits into
masterfrom
llm-tests-h100
Nov 3, 2026
Merged

jeffreywang88 merged 14 commits into
masterfrom
llm-tests-h100

Conversation

@jeffreywang88

@jeffreywang88 jeffreywang88 commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

Overview

  • Move LLM GPU CI/doc coverage and existing release tests to rkn-gpu-cloud H100s. No more GPU CIs.
  • Keep mocked tests in CPU CI.
  • Size clusters by GPU requirements, use default-queue, and cap release concurrency at 4.
  • Use Qwen3.5-0.8B for generic tests and public S3 adapters for serve LoRA tests.

Manual permissions

The H100 operator role received:

  • sts:AssumeRole on the Firehose writer role; that role’s trust policy now accepts the H100 operator.
  • s3:GetObject and s3:PutObject on s3://rayllm-ci-results/vllm_perf_results/*; the bucket policy grants matching access.

Test changes

LoRA test changes

Replace gated Llama serve LoRA fixtures with Qwen3.5-0.8B and adapters we generated at s3://air-example-data/rayllm-ossci/lora/qwen3.5-0.8b/v2/. Public artifacts remove the HF-secret requirement. Retain 4 adapter aliases and verify adapter-specific output against the base model.

Custom vLLM plugin

Replace ci/docker/custom-vllm-plugin.build.Dockerfile with plugin installation in llm_doc_tests's run.prepare. Both custom-vLLM examples stay in place and run through doc/test_llm_examples.py on 1 H100 using the release LLM image.

RLHF test changes

In release/llm_tests/serve/test_llm_serve_rlhf.py, switch OPT to Qwen3.5-0.8B and mark the 3-GPU requirement (2 inference + 1 trainer). Ship rlhf_utils.py through Ray's runtime environment so remote actors can import it. Propagate pytest's exit code so failures fail the release job instead of reporting success.

Test migration

Coverage checklist: 77/77 source test functions, 24 doc examples, and 2 notebooks.

Batch: source paths below are under python/ray/llm/tests/batch/gpu/. CPU counterparts keep the relative path under batch/cpu/; release destinations are under release/llm_tests/batch/.

  • processor/test_serve_deployment_proc.py: 3 tests → CPU counterpart; 3 → test_batch_serve_deployment.py.
  • processor/test_sglang_engine_proc.py: all 4 → CPU counterpart.
  • processor/test_vllm_engine_proc.py: 8 → CPU counterpart; 6 → test_batch_vllm.py. test_generation_model consolidates into test_chat_template_with_vllm, retaining all 3 executor backends.
  • stages/test_serve_deployment_stage.py: all 11 → CPU counterpart.
  • stages/test_sglang_engine_stage.py: all 5 → CPU counterpart.
  • stages/test_vllm_engine_stage.py: 13 → CPU counterpart; 7 → test_batch_vllm_engine.py.

Serve: source paths below are under python/ray/llm/tests/serve/gpu/. Release destinations are under release/llm_tests/serve/.

  • deployments/llm/vllm/test_config_congruence.py: 1 → test_llm_serve_config_congruence.py.
  • deployments/llm/vllm/test_vllm_engine_gpu.py: 1 → test_llm_serve_resource_bundles.py.
  • deployments/llm/prefill_decode_disagg/test_prefill_decode_disagg_gpu.py: 1 → CPU counterpart, renamed test_prefill_decode_disagg.py.
  • integration/test_openai_compatibility.py: all 11 → CPU counterpart; normal and direct-streaming targets retained.
  • integration/test_openai_compatibility_no_accelerator_type.py: all 3 → CPU counterpart.

Docs: all 24 Python examples and 2 notebooks remain in place; doc/test_llm_examples.py replaces their Bazel GPU execution.

  • 21 single-GPU cases → llm_doc_tests, including both custom-vLLM examples and both batch notebooks.
  • 2 multi-GPU cases → llm_doc_2GPU_tests.
  • 3 multi-GPU cases → llm_doc_4GPU_tests.
  • Existing release cases stay in place; vLLM/SGLang *_llama_parallel tests are renamed *_qwen_parallel with their parameterizations retained.

Additional information

Validation: Kicked off release tests under group llm-serve, llm-batch, and a new grouping llm-doc.

This PR is assisted by Claude, and I reviewed every line of changes.

@jeffreywang88 jeffreywang88 added the go add ONLY when ready to merge, run all tests label Oct 29, 2026
@jeffreywang88
jeffreywang88 requested review from a team as code owners October 29, 2026 01:21

@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 migrates LLM tests and benchmarks to run on H100 GPUs (rkn-gpu-cloud) and updates the default test model to Qwen/Qwen3.5-0.8B across various configurations, documentation examples, and test suites. It also introduces a new CI script and Dockerfile to manage these H100 test runs. Feedback on the changes highlights critical runtime issues in rlhf_utils.py where an incorrect model class (AutoModelForImageTextToText) is used for the text-only Qwen model. Additionally, potential KeyError crashes were identified in llm_tests_h100.py when run outside of Buildkite, and in run_llm_serve_test_and_bms.py if an unsupported number of GPUs is encountered.

Comment thread release/llm_tests/serve/rlhf_utils.py Resolved
Comment thread release/llm_tests/serve/rlhf_utils.py Resolved
Comment thread ci/ray_ci/llm_tests_h100.py Outdated
print("No LLM GPU tests selected; skipping the H100 job.")
return

image_uri = get_docker_image(f"{build_name}-h100-{os.environ['BUILDKITE_JOB_ID']}")

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.

medium

Using os.environ['BUILDKITE_JOB_ID'] directly will raise a KeyError if the script is run locally or in a non-Buildkite environment. It is safer to use os.environ.get('BUILDKITE_JOB_ID', 'local') or define a fallback variable.

    buildkite_job_id = os.environ.get("BUILDKITE_JOB_ID", "local")
    image_uri = get_docker_image(f"{build_name}-h100-{buildkite_job_id}")

Comment thread ci/ray_ci/llm_tests_h100.py Outdated
bazel_runfile(f"release/llm_tests/cluster_compute/{args.gpus}xh100.yaml")
)
config = {
"name": f"llm-ci-{os.environ['BUILDKITE_JOB_ID']}",

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.

medium

Use the buildkite_job_id variable defined earlier to avoid raising a KeyError when running outside of Buildkite.

Suggested change
"name": f"llm-ci-{os.environ['BUILDKITE_JOB_ID']}",
"name": f"llm-ci-{buildkite_job_id}",

Comment on lines +225 to +229
instance_types = {
1: "23CPU-240GB-1xH100",
2: "46CPU-480GB-2xH100",
4: "92CPU-960GB-4xH100",
}

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.

medium

If num_gpus is not 1, 2, or 4 (for example, if it is 8), accessing instance_types[num_gpus] will raise a KeyError. It is safer to validate num_gpus and raise a descriptive error message.

    instance_types = {
        1: "23CPU-240GB-1xH100",
        2: "46CPU-480GB-2xH100",
        4: "92CPU-960GB-4xH100",
    }
    if num_gpus not in instance_types:
        raise ValueError(
            f"Unsupported number of GPUs: {num_gpus}. "
            f"Supported values are {list(instance_types.keys())}."
        )

@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.

Stale Bugbot comment from a previous run.

Comment thread doc/BUILD.bazel Resolved
Comment thread ci/ray_ci/llm_h100.env.Dockerfile Resolved

@kouroshHakha kouroshHakha 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.

LGTM

@jeffreywang88 jeffreywang88 changed the title Migrate LLM tests to the reserved H100 cluster [ci][llm] Migrate LLM tests to the reserved H100 cluster Oct 29, 2026

@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.

Stale Bugbot comment from a previous run.

@ray-gardener ray-gardener Bot added the devprod label Oct 29, 2026
@jeffreywang88

Copy link
Copy Markdown
Contributor Author

@elliot-barn will set up a new GPU buildkite queue, and I'll update this PR to use that queue instead.

@dstrodtman

Copy link
Copy Markdown
Contributor

A few things from a docs and CI-routing read, beyond what the bots already flagged:

1. Changes to the new launcher won't run the tests it launches. In .buildkite/test.rules.txt, ci/ray_ci/llm_tests_h100.py, ci/ray_ci/llm_h100.env.Dockerfile, and ci/ray_ci/BUILD.bazel match the ci/ray_ci/ rule, which emits only tools. release/llm_tests/cluster_compute/*xh100.yaml matches release/*.yaml, which also emits only tools. A later PR that edits the launcher, its image, or a compute config runs no LLM GPU step in premerge, so a break first shows up post-merge. A rule ahead of the ci/ray_ci/ block would fix it:

ci/ray_ci/llm_tests_h100.py
ci/ray_ci/llm_h100.env.Dockerfile
release/llm_tests/cluster_compute/*xh100.yaml
@ llm tools
;

The compute-config pattern would also need to come before release/*.yaml. It's worth adding the matching expectations to .buildkite/test.rules.test.txt.

2. Some doc example edits change the published pages but don't help CI. qwen_example.py and transcription_example.py already set accelerator_type = None before running in CI, and llm_yaml_config_example.py pops it. So changing A10G to H100 in those files only changes what readers see, and it leaves the surrounding pages inconsistent:

  • serve/llm/user-guides/sglang.md: the Server tab now deploys qwen3.5-0.8b, but the inline cURL tab still sends "model": "Llama-3.1-8B-Instruct", so a reader who copies both gets a model-not-found error.
  • serve/llm/quick-start.md: the Builder tab, which is included from qwen_example.py, now shows H100 and qwen3.5-0.8b. The inline Bind tab, the client and cURL snippets, and the multi-file YAML still use A10G and qwen-0.5b, and the prose says the examples "fit on a single A10G or L4."
  • basic_llm_example.py: __parallel_config_example__ never runs. It illustrates TP=2 × PP=2 "for larger models," and now shows a 0.8B model on H100.

+1 to dropping accelerator_type from the examples, as suggested above. Where an example does need a specific GPU in CI, it would help to keep the reader-facing value generic and update the inline siblings to the new model IDs in the same PR.

3. Test failure logs stay on the remote node. ci/run/bazel_export_options points the failure-log archive and the test summaries at /artifact-mount, which is now on the H100 job's node. Only the streamed --test_output=errors reaches Buildkite, so the per-test failure logs and summaries probably don't come back.

4. Queue time counts against the timeout. Only release tests get the llm-h100 concurrency cap. PR submissions to the Kueue pool have no limit, and anyscale.job.wait(timeout_s=7500) includes time spent queued. Under load, a job can time out before it starts, and that will look like a flaky test.

5. Minor: docker build ... . sends the whole repo as build context, but the Dockerfile copies nothing from it. An empty context directory, or - with the Dockerfile on stdin, skips that upload.

6. A question on the IAM policy in the description: it's attached to the whole bk-runner-queue-medium-pr role, so every PR job on medium runners can read the release-automation Anyscale token, not just these steps. I assume the dedicated GPU queue mentioned above replaces this. Can you confirm?

Separately, I opened #67557. It adds a skip-gpu-tests PR label for docs and CI infrastructure changes, such as edits to doc/BUILD.bazel, that select GPU steps only incidentally. It keys on the existing gpu tag, so it covers the new 2-GPU step here without any change to this PR.

@jeffreywang88

jeffreywang88 commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor Author

Chatted with @elliot-barn @sai-miduthuri offline -- the current CI infra assumes tests run in containers on plain EC2 instances, which doesn't align with how the reserved H100 pool is set up. All reserved H100 instances are managed by an EKS cluster.

I'll move all LLM GPU CI tests to release tests so they can run on the H100 EKS cluster, and audit which tests should always run, acting like premerge although they are under release/.

cc: @kouroshHakha

dstrodtman added a commit that referenced this pull request Oct 30, 2026
## Why are these changes needed?

Some docs and CI infrastructure files select GPU test steps even though
a change to them can't affect GPU behavior. The clearest case is
`doc/BUILD.bazel`: `.buildkite/test.rules.txt` routes it to `core_doc
data_doc ml_doc rllib_doc serve_doc llm`, so a one-line edit there
starts the Ray Data and Ray Serve docs example GPU steps and every LLM
GPU step, plus the GPU images they need. #67525 moves the LLM GPU steps
onto a reserved H100 pool that release tests also use, so an incidental
run now costs pool capacity, not only runner time.

rayci v0.51.0, the version `.rayciversion` pins, supports
`skip_tags_when_present` in `.buildkite/*.labels.yaml`. This PR uses it
to add an opt-out label.

## What changes

- **Adds a `skip-gpu-tests` rule** to `.buildkite/docs.labels.yaml`.
With the label, rayci skips every step tagged `gpu`, in every library,
along with the images only those steps need. Because label rules apply
before rayci marks step dependencies, the GPU images don't build either.
Without the label, nothing changes.
- **Documents the `skip_tags_when_present` mode** in the file's header
comment, next to the two modes it already describes.
- **Documents the label** in `doc/source/ray-contribute/ci.md`: a new
"Skipping GPU tests" section, with when not to use it, and a mention in
"Why some steps show as broken".

## Scope decision to review

The rule skips the shared `gpu` tag, not an LLM-only tag. `gpu` is on 19
steps across core, data, ml, rllib, serve, and llm. For the case this
targets, a `doc/BUILD.bazel` edit, that's the right scope, because the
same edit also selects the Data and Serve docs example GPU steps. An
LLM-only valve would need a new tag on the LLM GPU steps, which #67525
is rewriting. If reviewers prefer that narrower scope, the rule can
switch to that tag once #67525 lands.

The label is a judgment call by whoever applies it, and it needs write
access. Scheduled post-merge builds carry no PR labels, so they still
run every GPU step. A GPU failure the label hides surfaces there, after
merge.

## Related issues

Related to #67525, which migrates the LLM GPU steps to H100s. This PR
doesn't depend on it: the new 2-GPU step in #67525 carries the `gpu`
tag, so the rule covers it once it lands.

## Duplicate check

No open PR adds a label rule or a GPU opt-out. I searched open PRs for
`labels.yaml` and for GPU-skip labels. #67341 introduced
`docs.labels.yaml` with the `docstring-only` and `docs-example-test`
rules, and this PR follows its pattern.

## Testing

I built rayci v0.51.0 locally and generated the PR pipeline for a
simulated PR that changes only `doc/BUILD.bazel`, with this branch's
`docs.labels.yaml` as the base:

| Labels | Selected tags | Steps |
|---|---|---|
| `go` | `always core_doc data_doc lint llm ml_doc rllib_doc serve_doc`
| 61 |
| `go`, `skip-gpu-tests` | same | 51 |

The label drops exactly these 10 steps, and the two pipelines are
otherwise identical:

- `:database: data: docs example gpu tests`
- `:ray-serve: serve: docs example gpu tests`
- `llm gpu tests`, `llm gpu tests (4 GPUs)`, `llm custom vllm plugin gpu
test`
- The images only they need: `oss-ci-base_gpu-py3.10`,
`oss-ci-base_cu130-py3.12`, `docgpubuild-py3.10`, `llmgpubuild`,
`custom-vllm-plugin-gpubuild`

`pre-commit run` on the changed files passes.

Two follow-ups if this merges:

- A maintainer needs to create the `skip-gpu-tests` label on the repo.
- `.buildkite/docs.labels.yaml` matches no rule in `test.rules.txt`, so
this PR falls through to the catch-all `*` and runs a broad premerge.
That's unchanged from #67341. A rule for `.buildkite/*.labels.yaml`
could narrow it, but it belongs in its own change.

This PR was prepared with AI assistance (Claude Code).

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Signed-off-by: Douglas Strodtman <[email protected]>
Co-authored-by: Claude Opus 5.5 <[email protected]>

@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.

Stale Bugbot comment from a previous run.

Comment thread release/release_tests.yaml Resolved

@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.

Stale Bugbot comment from a previous run.

Comment thread release/release_tests.yaml Resolved
Comment thread release/release_tests.yaml Resolved

@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

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

Reviewed by Cursor Bugbot for commit ce48c0d. Configure here.

Comment thread doc/test_llm_examples.py Resolved
@@ -350,249 +348,6 @@ async def test_vllm_wrapper_uses_explicit_multimodal_data():
assert request.multimodal_data == {"image": [sentinel_image]}


@pytest.mark.asyncio

@jeffreywang88 jeffreywang88 Nov 2, 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.

Note: These tests are all moved to release/llm_tests/batch/test_batch_vllm_engine.py.

@@ -1,621 +0,0 @@
import sys

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.

Note: These tests are moved to 2 places.

  • 8 CPU tests → python/ray/llm/tests/batch/cpu/processor/test_vllm_engine_proc.py
  • 6 GPU tests → release/llm_tests/batch/test_batch_vllm.py. test_generation_model was consolidated into test_chat_template_with_vllm, preserving all 3 executor backends (uni, mp, ray). I confirmed that no coverage was dropped.



@pytest.fixture
def create_model_opt_125m_deployment(gpu_type, model_opt_125m, serve_cleanup):

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.

Note: this test is rewritten and moved to create_model_qwen3_5_0_8b_deployment.

Comment on lines +13 to +14
min_nodes: 0
max_nodes: 1

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.

Why do we allow autoscaling?

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.

[claude] The CPU launcher and deployed service share this compute config. min_nodes: 0 keeps the launcher GPU-free; service demand adds at most 1 H100 worker. This does not enable model-replica autoscaling.

Comment on lines +12 to +14
- instance_type: 23CPU-240GB-1xH100
min_nodes: 0
max_nodes: 8

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.

Why do we allow autoscaling? Why don't we just use the 8xH100 instance? Which test uses this compute config?

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.

[claude] Used by the 2-prefill/6-decode tests: normal, direct-streaming, and manual LMCache. min_nodes: 0 keeps the CPU launcher GPU-free; the service requests 8 workers. A single 8-H100 worker could also work; separate workers are not required by these TP=1 configurations.

Comment thread release/llm_tests/serve/rlhf_utils.py Resolved
Comment on lines +118 to +120
ray.init(
runtime_env={"py_modules": [str(Path(__file__).with_name("rlhf_utils.py"))]}
)

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.

Why are we changing this and what happens in if __name__ == "__main__"?

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.

[claude] py_modules ships rlhf_utils.py to remote actors; otherwise they fail to import it. The marker records 2 inference GPUs + 1 trainer GPU. When run as a script, __main__ invokes pytest; SystemExit forwards its exit code so a failing test cannot report job success.

Comment thread release/release_tests.yaml Outdated
timeout: 3600
script: pytest -vs test_frontend_config.py

variations:

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.

[P1] Attach GPU variations to the KV-router suite

These variations are nested under llm_serve_kv_router_frontend_config, so they split the wrong test and replace that frontend job’s test_frontend_config.py command with the full suite. Meanwhile, the preceding llm_serve_kv_router job still runs the newly marked requires_2GPU classes on its single-H100 cluster. Please move this block to the preceding KV-router definition so each marker uses the matching cluster.

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.

good catch, fixed in 7a4451d

@jeffreywang88
jeffreywang88 enabled auto-merge (squash) November 2, 2026 22:00
@jeffreywang88
jeffreywang88 merged commit c554b43 into master Nov 3, 2026
7 checks passed
@jeffreywang88
jeffreywang88 deleted the llm-tests-h100 branch November 3, 2026 00:16
dstrodtman added a commit that referenced this pull request Nov 3, 2026
#67525 moved the Ray LLM docs examples off GPU CI and into the nightly
llm_doc_tests release test on H100s. ci.md still said the scheduled
post-merge builds run them, and listed a Ray LLM GPU docs step that no
longer exists.

Signed-off-by: Douglas Strodtman <[email protected]>
dstrodtman added a commit that referenced this pull request Nov 3, 2026
#67525 moved the Ray LLM docs examples off Bazel GPU targets and into the
nightly llm_doc_tests release tests, and deleted the batch notebooks'
BUILD.bazel. The doc/source/*/llm/*BUILD.bazel rule and its expectation
described a file that no longer exists by design, and the rules comments
still said the postmerge build runs these examples.

- Remove the llm BUILD.bazel rule and its test.rules.test.txt expectation.
- Say in both rules comments that the llm_doc_tests release tests run them.
- Point the GPU-target fixture in test_doc_example_targets.py at a real
  Ray Data GPU notebook target instead of the removed LLM one.

Signed-off-by: Douglas Strodtman <[email protected]>
dstrodtman added a commit that referenced this pull request Nov 4, 2026
Only the custom vLLM doc example Bazel target carried this tag, and #67525
deleted that target when it moved the LLM docs examples to the nightly
llm_doc_tests release tests. No target uses the tag now.

Signed-off-by: Douglas Strodtman <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

devprod go add ONLY when ready to merge, run all tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants