Repository navigation
[docs][serve][llm] Reorganize Ray Serve LLM documentation with user guides and improved navigation - #57787
Merged
kouroshHakha merged 24 commits intoOct 18, 2025
Conversation
Convert the Ray Serve LLM quickstart documentation from RST to MyST Markdown format. Changes: - Convert quick-start.rst to quick-start.md using MyST syntax - Apply Ray docs style guide (contractions, active voice, sentence case) - Convert all RST directives to MyST equivalents (tab-sets, code blocks, cross-refs) - No content changes, pure format conversion - Verified: builds successfully with no errors or warnings This is Phase 0 of the LLM docs reorganization plan. Signed-off-by: Kourosh Hakhamaneshi <[email protected]>
Create the directory structure for Ray Serve LLM documentation reorganization. Changes: - Add user-guides/ directory for user guide content - Add architecture/ directory for architecture docs - Add api/ directory for API reference This is Phase 1 of the LLM docs reorganization plan. Signed-off-by: Kourosh Hakhamaneshi <[email protected]>
Create a simple examples landing page that lists all available LLM tutorials. Changes: - Add examples.md with flat list of tutorial links - Include all 7 existing deployment tutorials - Follow style guide (sentence case, active voice) This is part of Phase 2 of the LLM docs reorganization plan. Signed-off-by: Kourosh Hakhamaneshi <[email protected]>
Extract FAQ section from quick-start and create dedicated troubleshooting page. Changes: - Create troubleshooting.md with 3 FAQs: - How to use gated Huggingface models - Why is downloading the model so slow - How to configure tokenizer pool size - Add 'Get help' section with community links - Follow style guide (sentence case, contractions, active voice) This is part of Phase 2 of the LLM docs reorganization plan. Signed-off-by: Kourosh Hakhamaneshi <[email protected]>
Extract Multi-LoRA documentation from quick-start into dedicated user guide. Changes: - Create user-guides/multi-lora.md with: - Overview of multi-LoRA deployment and when to use it - How request routing works with adapter caching - Configuration sections (LoRA config and engine arguments) - Complete server and client examples - Example queries for base model and adapters - Follow Ray docs style guide (sentence case, contractions, active voice) This is part of Phase 3 of the LLM docs reorganization plan. Signed-off-by: Kourosh Hakhamaneshi <[email protected]>
Remove Multi-LoRA deployment section from quick-start as it's now a dedicated user guide. Changes: - Remove Multi-LoRA deployment section (server + client examples) - Content moved to user-guides/multi-lora.md This reduces quick-start.md from 917 to ~850 lines. Signed-off-by: Kourosh Hakhamaneshi <[email protected]>
Create user guide and architecture docs for request routing policies. Changes: - Add user-guides/prefix-aware-routing.md: - Overview and when to use prefix-aware routing - How it works (load balance, prefix matching, fallback) - Deployment example with corrected import path - Configuration parameters and best practices - Add architecture/routing-policies.md: - Routing vs ingress distinction - Request routing architecture - Available policies (Power of Two, Prefix-aware) - Design patterns (centralized store, broadcast metrics) - Custom routing policies with proper links to Ray Serve docs - Utility mixins documentation - Implementation details (async operations, state management) - Add routing policy diagrams (request_router_1.png, request_router_2.png) - Follow Ray docs style guide (sentence case, contractions, active voice) This is part of Phase 3 of the LLM docs reorganization plan. Signed-off-by: Kourosh Hakhamaneshi <[email protected]>
Add index files and update main index to include new documentation sections. Changes: - Update serve/llm/index.md toctree to include: - Examples - User Guides (with index) - Architecture (with index) - Troubleshooting - Create user-guides/index.md with links to: - Multi-LoRA deployment - Prefix-aware routing - Create architecture/index.md with link to: - Request routing This resolves the 'document isn't included in any toctree' warnings. Signed-off-by: Kourosh Hakhamaneshi <[email protected]>
Apply Ray docs style guide and improve clarity in routing-policies.md. Style improvements: - Use active voice and direct address (you/your) - Add code backticks for technical terms (model_id, OpenAiIngress, etc.) - Improve conversational tone - Change 'Choosing' to 'Choose' for imperative mood Image improvements: - Rename request_router_1.png → routing_centralized_store.png - Rename request_router_2.png → routing_broadcast_metrics.png - Update all image references in documentation These changes improve readability and align with Ray documentation standards. Signed-off-by: Kourosh Hakhamaneshi <[email protected]>
Replace implementation-focused prefix-aware-request-router.md with the user-focused prefix-aware-routing.md in user guides. Changes: - Delete prefix-aware-request-router.md (implementation details) - Remove toctree entry from index.md - User guide (user-guides/prefix-aware-routing.md) is now the primary documentation for prefix-aware routing The new user guide focuses on practical usage (when to use, how to deploy, configuration) rather than implementation details, which aligns better with user needs. Signed-off-by: Kourosh Hakhamaneshi <[email protected]>
Create user-guides/prefill-decode.md to replace pd-dissagregation.md. Changes: - Create user-guides/prefill-decode.md with improved structure - Apply Ray docs style guide (active voice, contractions, you/your) - Remove VLLM_USE_V1 mention (v1 is now default) - Improve section organization and headings (sentence case, imperative) - Reorganize structure: Deploy with NIXLConnector → Deploy with LMCacheConnectorV1 - Add 'When to use' and 'Best practices' sections - Enhance troubleshooting section with specific guidance - Update user-guides/index.md to include new guide - Remove pd-dissagregation.md from main index.md toctree - Delete old pd-dissagregation.md file The new guide focuses on practical deployment steps while maintaining all technical content from the original. Signed-off-by: Kourosh Hakhamaneshi <[email protected]>
Create user-guides/vllm-compatibility.md to document vLLM feature support. Changes: - Create user-guides/vllm-compatibility.md with comprehensive coverage - Document embeddings, structured output, vision models, and reasoning models - Highlight Ray Serve LLM alignment with vLLM OpenAI-compatible server - Apply Ray docs style guide (active voice, you/your, sentence case) - Include practical examples for each feature with server/client code - Update user-guides/index.md to include new guide The guide emphasizes that users can switch between vllm serve and Ray Serve LLM with no code changes while gaining Ray Serve's production features (autoscaling, multi-model serving, advanced routing). Signed-off-by: Kourosh Hakhamaneshi <[email protected]>
Signed-off-by: Kourosh Hakhamaneshi <[email protected]>
Create user-guides/model-loading.md for configuring model sources. Changes: - Create user-guides/model-loading.md with comprehensive coverage - Document loading from Hugging Face Hub with fast download - Document gated model authentication with HF_TOKEN - Document loading from S3/GCS remote storage - Include AWS credentials configuration (env vars and IAM roles) - Add cluster-wide environment variable configuration with ray.init - Include best practices for security, performance, and source selection - Add troubleshooting for slow downloads and access errors - Apply Ray docs style guide (active voice, contractions, 'such as') - Update user-guides/index.md to include new guide The guide consolidates model loading patterns extracted from quick-start FAQs and remote storage sections into a focused, practical resource. Signed-off-by: Kourosh Hakhamaneshi <[email protected]>
Remove sections moved to dedicated user guides, reducing file by 53%. Removed sections: - Embeddings → moved to vllm-compatibility.md - Structured output → moved to vllm-compatibility.md - Vision language models → moved to vllm-compatibility.md - Fractional GPU serving → moved to fractional-gpu.md - Remote storage → moved to model-loading.md - Gated models FAQ → moved to model-loading.md - Fast download FAQ → moved to model-loading.md Changes: - Reduced from 845 to 398 lines (447 lines removed, 53% reduction) - Kept tokenizer pool size FAQ (not moved to user guides) - Maintained clean flow from multi-model section to FAQs - No linter errors The quick-start now focuses on core deployment patterns with links to dedicated user guides for advanced topics. Signed-off-by: Kourosh Hakhamaneshi <[email protected]>
Signed-off-by: Kourosh Hakhamaneshi <[email protected]>
Signed-off-by: Kourosh Hakhamaneshi <[email protected]>
Remove placeholder files in preparation for PR. Changes: - Remove .gitkeep from user-guides/ - Remove .gitkeep from architecture/ - Remove api/.gitkeep and empty api/ directory The api/ directory will be added in a future PR focused on API reference documentation. This PR focuses on user guides. Signed-off-by: Kourosh Hakhamaneshi <[email protected]>
Signed-off-by: Kourosh Hakhamaneshi <[email protected]>
Signed-off-by: Kourosh Hakhamaneshi <[email protected]>
Complete final missing pieces of documentation reorganization. Changes: - Create user-guides/observability.md: - Extract observability content from quick-start.md - Service-level metrics and engine metrics - Grafana dashboard documentation - Configuration examples for log_engine_metrics - Usage data collection information - Best practices for monitoring - Update quick-start.md: - Remove observability section (moved to user guide) - Remove gen_config CLI section (deprecated feature) - Add link to observability user guide - Streamline quick-start content - Update index.md with improved overview: - Better positioning: 'high-performance, scalable framework' - Add 'Why Ray Serve LLM?' section highlighting distributed workloads - Emphasize key differentiators (parallelism, PD disaggregation, routing) - Update features list to include new capabilities - Remove outdated 'Key Components' and 'Configuration' sections - Update user-guides/index.md to include observability guide Full Ray docs style guide compliance maintained throughout. Signed-off-by: Kourosh Hakhamaneshi <[email protected]>
kouroshHakha
marked this pull request as ready for review
October 17, 2025 01:40
1 task
angelinalg
reviewed
Oct 17, 2025
angelinalg
approved these changes
Oct 17, 2025
Co-authored-by: angelinalg <[email protected]> Signed-off-by: kourosh hakhamaneshi <[email protected]>
Co-authored-by: angelinalg <[email protected]> Signed-off-by: kourosh hakhamaneshi <[email protected]>
Signed-off-by: Kourosh Hakhamaneshi <[email protected]>
kouroshHakha
enabled auto-merge (squash)
October 18, 2025 01:58
xinyuangui2
pushed a commit
to xinyuangui2/ray
that referenced
this pull request
Oct 22, 2025
…uides and improved navigation (ray-project#57787) Signed-off-by: Kourosh Hakhamaneshi <[email protected]> Signed-off-by: kourosh hakhamaneshi <[email protected]> Co-authored-by: angelinalg <[email protected]> Signed-off-by: xgui <[email protected]>
elliot-barn
pushed a commit
that referenced
this pull request
Oct 23, 2025
…uides and improved navigation (#57787) Signed-off-by: Kourosh Hakhamaneshi <[email protected]> Signed-off-by: kourosh hakhamaneshi <[email protected]> Co-authored-by: angelinalg <[email protected]> Signed-off-by: elliot-barn <[email protected]>
landscapepainter
pushed a commit
to landscapepainter/ray
that referenced
this pull request
Nov 17, 2025
…uides and improved navigation (ray-project#57787) Signed-off-by: Kourosh Hakhamaneshi <[email protected]> Signed-off-by: kourosh hakhamaneshi <[email protected]> Co-authored-by: angelinalg <[email protected]>
Future-Outlier
pushed a commit
to Future-Outlier/ray
that referenced
this pull request
Dec 7, 2025
…uides and improved navigation (ray-project#57787) Signed-off-by: Kourosh Hakhamaneshi <[email protected]> Signed-off-by: kourosh hakhamaneshi <[email protected]> Co-authored-by: angelinalg <[email protected]> Signed-off-by: Future-Outlier <[email protected]>
ArturNiederfahrenhorst
added a commit
to ArturNiederfahrenhorst/ray
that referenced
this pull request
Oct 5, 2026
The prefix-aware routing docs stopped including snippets of this file when they were reorganized in ray-project#57787, so no literalinclude uses these tags. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Signed-off-by: Artur Niederfahrenhorst <[email protected]>
ArturNiederfahrenhorst
added a commit
to ArturNiederfahrenhorst/ray
that referenced
this pull request
Oct 24, 2026
Resolves the conflicts with ray-project#66671, which moved the router's tree lookup into one non-blocking prefix_match_or_smallest_tenants call: - The router passes the request's key prefix to that call. The tree counts only text matched after the key prefix toward the match rate, which this PR did in the router before. - The prefix tree insert stays fire-and-forget and keeps the key prefix. - Drops the Sphinx tags ray-project#66671 moved: no docs include them since ray-project#57787. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Artur Niederfahrenhorst <[email protected]>
ArturNiederfahrenhorst
added a commit
that referenced
this pull request
Oct 24, 2026
Before this PR: choose_replicas called apply_multiplex_routing or apply_locality_routing twice per attempt: once inside PowerOfTwoChoicesRequestRouter's choose_replicas for the fallback, then again for prefix matching. Both advance per-request state, so the second call returned the next tier's candidates. A multiplexed request, such as one for a LoRA adapter, was prefix-matched among the replicas with the fewest models loaded instead of the replicas that have the adapter. That spread adapters across replicas by accident and hid two more problems. Serve loads a multiplexed model onto more replicas only when the replicas that have it reject requests, and with Serve LLM's default max_ongoing_requests they never do, so a popular adapter's traffic queues on the replicas that loaded it first. And the prefix tree keyed on prompt text only, so a LoRA request could match text cached under another adapter, which saves nothing because vLLM's prefix cache keys blocks by LoRA ID. After this PR: Compute the candidates once, so prefix matching and the power of two choices fallback use the same candidates. The fallback is only drawn when prefix matching finds no replica. With availability zone locality on, the default for DeploymentHandles, the first attempt now prefix-matches among replicas in the caller's zone instead of all replicas. When the replicas chosen for a multiplexed request have more than `multiplex_spill_threshold` (default 64) more ongoing requests than the least busy candidate or replica with the fewest models loaded, the request is routed among those by load, so a busy adapter spreads to more replicas. A multiplexed request's text goes into the prefix tree under its model ID, and only text matched under the model counts toward the match rate. On a low match rate, the fallback picks the smallest tenant among this attempt's candidates instead of among all replicas. Also removes the router's unused Sphinx tags: the docs stopped including this file in #57787. ### Benchmark This PR adds a weekly release test, `llm_serve_prefix_router_lora_benchmark` (`release/llm_tests/serve/prefix_router_lora_benchmark.py`), that sends LoRA traffic through the router to fake Ray Serve LLM replicas on Serve's real `@serve.multiplexed`, on a CPU node. 4 replicas, 32 adapters, at most 16 loaded per replica, 2 s to download an adapter (a replica loads one at a time), vLLM-style `max_loras=4` and a prefix cache keyed by adapter, replicas never reject. Open-loop Poisson traffic at 40 req/s for 180 s, identical for both routers; `cold` is the first 60 s, `last-60s` the final 60 s. Workloads: `uniform`, `zipf` (the top adapter gets 28% of traffic) and `shared-prompt` (all adapters share 2 system prompts). Below is the release test on its setup (Anyscale m5.2xlarge, `anyscale/ray-llm:nightly-py312-cu130` at master `0fe2388b9d`) with master's router and with this PR's (its `prefix_aware_router.py` and `prefix_tree.py` copied over the installed ones), 3 seeds; placement metrics (after the cold start) are means, latencies medians. Master → this PR: | workload | adapter ready | evictions | KV hit | busiest replica | cold p99 s | last-60s p50 s | last-60s p99 s | |---|---|---|---|---|---|---|---| | uniform | 67% → 100% | 1422 → 0 | 79% → 100% | 33% → 30% | 57.7 → 60.9 | 3.9 → 1.9 | 7.2 → 5.6 | | zipf | 87% → 100% | 554 → 0 | 90% → 100% | 51% → 29% | 46.9 → 43.1 | 1.0 → 1.1 | 4.9 → 5.0 | | shared-prompt | 49% → 100% | 1875 → 0 | 56% → 100% | 26% → 30% | 66.3 → 60.2 | 5.0 → 1.9 | 8.6 → 5.2 | The cold start is 6% slower on uniform traffic: the spill downloads adapters onto more replicas while queues build. `multiplex_spill_threshold` (the release test's `--multiplex-spill-threshold`), as uniform / zipf / shared-prompt: | threshold | evictions | busiest replica | replicas per adapter | cold p99 s | last-60s p99 s | |---|---|---|---|---|---| | 16 | 66 / 5 / 77 | 28% / 28% / 28% | 2.77 / 2.08 / 2.92 | 57.4 / 39.2 / 57.1 | 5.2 / 5.2 / 5.4 | | 32 | 8 / 0 / 18 | 30% / 32% / 29% | 2.18 / 1.84 / 2.35 | 58.1 / 39.7 / 57.8 | 5.6 / 5.2 / 5.5 | | **64** (default) | 0 / 0 / 0 | 30% / 29% / 30% | 1.97 / 1.98 / 1.96 | 60.9 / 43.1 / 60.2 | 5.6 / 5.0 / 5.2 | | 128 | 0 / 0 / 0 | 30% / 29% / 30% | 1.98 / 1.86 / 2.00 | 64.6 / 44.4 / 62.7 | 5.4 / 4.7 / 5.7 | | inf (no spill) | 0 / 0 / 0 | 31% / 70% / 31% | 1.77 / 1.16 / 1.79 | 98.6 / 138.1 / 93.5 | 5.8 / 42.4 / 6.0 | 64 is the lowest tested threshold that evicts no adapters in any workload. Lower thresholds keep spilling after the cold start, which costs evictions for a 2–4 s faster cold start. Without the spill, the hot zipf adapter stays on one replica: the busiest replica takes 70% of requests and the last-60s p99 is 42.4 s (12.2–67.3 s across seeds). ### Tests ``` python -m pytest --noconftest --import-mode=importlib -q \ python/ray/llm/tests/serve/cpu/deployments/test_prefix_aware_request_router.py \ python/ray/llm/tests/serve/cpu/deployments/test_prefix_tree.py 69 passed ``` Run locally on macOS (`--noconftest` because the llm `conftest.py` imports vLLM). New tests, all fail on master: `TestPrefixAwareLogic::test_multiplexed_request_matches_replicas_with_model`, `TestPrefixAwareLogic::test_image_only_request_uses_smallest_tenant`, `TestMultiplexedRouting::test_prefix_match_is_per_model`, `TestMultiplexedRouting::test_low_match_rate_uses_smallest_candidate`, `TestMultiplexedRouting::test_spills_from_busy_replica` (2 cases), `TestMultiplexedRouting::test_spill_reaches_replica_without_cached_queue_len` (with Serve's queue length cache on) and `TestPrefixTreeGetSmallestTenants::test_get_smallest_tenants_among_available`. The prefix-aware routing guide documents `multiplex_spill_threshold`. The release test passes on its setup with both routers and every threshold above, in about 10 of its 60 minutes, and `ray_release` validates the new `release_tests.yaml` entry. No existing issue or PR covers this (searched open PRs for `PrefixCacheAffinityRouter`, `prefix_aware_router`, multiplex, `get_smallest_tenants`). #66671 adds the same `get_smallest_tenants(available_tenants)` for its own fallback, so whichever lands second needs a rebase: the router conflicts, and this PR's adapter-key match rate moves into #66671's combined tree lookup. Written with AI assistance (Claude Code). 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Signed-off-by: Artur Niederfahrenhorst <[email protected]> Signed-off-by: Artur Niederfahrenhorst <[email protected]> Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]> Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR reorganizes the Ray Serve LLM documentation to improve discoverability and usability. The main changes include:
Motivation
The previous documentation structure had several issues:
Changes
New User Guides (6 files)
Created focused, practical guides for common deployment scenarios:
user-guides/model-loading.md- Loading models from HuggingFace, S3/GCS, gated repositoriesuser-guides/vllm-compatibility.md- Using vLLM features (embeddings, structured output, vision, reasoning models)user-guides/fractional-gpu.md- Cost-efficient serving on fractional GPUsuser-guides/prefill-decode.md- Prefill/decode disaggregation with NIXLConnector and LMCacheuser-guides/prefix-aware-routing.md- Cache-aware request routinguser-guides/multi-lora.md- Multi-LoRA deploymentArchitecture Documentation
architecture/routing-policies.md- Comprehensive request routing architecture including centralized store and broadcast metrics patternsSupporting Files
examples.md- Flat list of tutorial linkstroubleshooting.md- FAQs extracted from quick-startFiles Deleted
pd-dissagregation.md→ replaced byuser-guides/prefill-decode.mdprefix-aware-request-router.md→ replaced byuser-guides/prefix-aware-routing.mdBefore/After Comparison
Before
After
Not Included (Future PRs)
This PR focuses on user guides. Follow-up PRs will add:
overview.md,core.md,serving-patterns.md)Screenshots
Side bar
Before:

After:
