Repository navigation
[RLlib] Style-edit the converted RLlib doc pages against the Ray writing-style guide - #66239
Conversation
| **RLlib overview:** The central component of RLlib is the {py:class}`~ray.rllib.algorithms.algorithm.Algorithm` | ||
| class, acting as a runtime for executing your RL experiments. | ||
| Your gateway into using an {ref}`Algorithm <rllib-key-concepts-algorithms>` is the | ||
| {py:class}`~ray.rllib.algorithms.algorithm_config.AlgorithmConfig` (cyan) class, allowing | ||
| you to manage available configuration settings, for example learning rate or model architecture. | ||
| class, which acts as a runtime for your RL experiments. | ||
| Your gateway into an {ref}`Algorithm <rllib-key-concepts-algorithms>` is the | ||
| {py:class}`~ray.rllib.algorithms.algorithm_config.AlgorithmConfig` (cyan) class, where you | ||
| manage configuration settings such as the learning rate or model architecture. | ||
| Most {py:class}`~ray.rllib.algorithms.algorithm.Algorithm` objects have | ||
| {py:class}`~ray.rllib.env.env_runner.EnvRunner` actors (blue) to collect training samples | ||
| from the {ref}`RL environment <rllib-key-concepts-environments>` and | ||
| {py:class}`~ray.rllib.core.learner.learner.Learner` actors (yellow) | ||
| to compute gradients and update your {ref}`models <rllib-key-concepts-rl-modules>`. | ||
| The algorithm synchronizes model weights after an update. | ||
| ``` |
There was a problem hiding this comment.
Make this regular text rather than subtext for an image and apply softwrap.
|
|
||
| :::{note} | ||
| {py:class}`~ray.rllib.connectors.connector_v2.ConnectorV2` documentation is work in progress. The Ray team links to the correct documentation page here, once it has completed this work. | ||
| {py:class}`~ray.rllib.connectors.connector_v2.ConnectorV2` documentation is in progress. The Ray team adds a link here once it's complete. |
There was a problem hiding this comment.
I think these docs should be complete and so should just be linked here.
dstrodtman
left a comment
There was a problem hiding this comment.
Three pre-existing technical questions surfaced while reviewing the prose changes in this PR. None were introduced by these edits (the wording is unchanged from before the pass) — flagging them for a maintainer to confirm the intended fact, since I can't verify which reading is correct from the docs alone. The prose review otherwise found no unresolved meaning changes.
Raised with AI assistance.
| For a runnable example, see [logging inside training_step()](https://github.com/ray-project/ray/blob/master/rllib/examples/metrics/custom_metrics_in_algorithm_training_step.py). | ||
|
|
||
|
|
||
| ## Migrating to Ray 2.53 |
There was a problem hiding this comment.
Version mismatch: this heading says Ray 2.53, but the section body says 2.52 — the next line reads "If you used the MetricsLogger API before Ray 2.52" and a bullet below says "after you upgrade to 2.52." Should the heading be 2.52, or should the body say 2.53? (Pre-existing, not changed by this PR.)
There was a problem hiding this comment.
Applied in d2628b9 — updated the body's two "2.52" references to 2.53 to match the heading. Thanks for confirming.
|
|
||
| :::{note} | ||
| Even though the new API stack still provides rudimentary support for [TensorFlow](https://tensorflow.org), RLlib supports a single deep learning framework, the [PyTorch](https://pytorch.org) framework, dropping TensorFlow support entirely. Note, though, that the Ray team continues to design RLlib to be framework-agnostic and may add support for additional frameworks in the future. | ||
| Even though the new API stack still provides rudimentary support for [TensorFlow](https://tensorflow.org), RLlib supports a single deep learning framework, [PyTorch](https://pytorch.org), and drops TensorFlow support entirely. The Ray team continues to design RLlib to be framework-agnostic and might add support for other frameworks. |
There was a problem hiding this comment.
This sentence says the new API stack "still provides rudimentary support for TensorFlow" and, in the same sentence, that RLlib "drops TensorFlow support entirely." Those read as contradictory — which is right? (Pre-existing, not changed by this PR.)
There was a problem hiding this comment.
Tensorflow support is dropped completely
There was a problem hiding this comment.
Applied in d2628b9 — removed the "still provides rudimentary support for TensorFlow" clause here and in the framework() section, so both now just say RLlib drops TensorFlow support entirely.
| RLlink messages consist of a header and a body: | ||
|
|
||
| - **Header**: 8-byte length field indicating the size of the body, for example `00000016` for a body of length 16 (thus, in total, the message size). | ||
| - **Header**: An 8-byte length field giving the size of the body. For example, `00000016` indicates a body of length 16, and thus the total message size. |
There was a problem hiding this comment.
The header is 8 bytes and here encodes a body length of 16 (00000016), but the sentence calls that "the total message size." With an 8-byte header the total would be 24, not 16 — is the length field the body size or the total message size? (Pre-existing, not changed by this PR.)
There was a problem hiding this comment.
Proposed update
- Header: 8-byte length field holding the size of the body in bytes as an ASCII decimal number, left-padded with zeros, for example
00000011for a body of 11 bytes. The header isn't included in this count, so the total frame is 8 + body-length bytes. - Body: msgpack-encoded dict with a mandatory
typefield indicating the message type.
There was a problem hiding this comment.
Applied your proposed header/body wording in d2628b9, and switched the section to msgpack throughout: the key-feature bullet, the PING example frame (b"00000011" + b"\x81\xa4type\xa4PING"), and the EPISODES_AND_GET_STATE example.
| - **Strict request-response design**: Every exchange goes from a client request to a server response. Because the client simulation runs in its own execution loop, the server never sends unsolicited messages to clients. | ||
| - **RL-specific capabilities**: Tailored for RL workflows, including episode handling, model weight updates, and configuration management. | ||
| - **Flexible sampling**: Supports both on-policy and off-policy data collection modes. | ||
| - **JSON**: To simplify debugging and speed up iteration, the first versions of RLlink are entirely JSON-based, unencrypted, and insecure. |
There was a problem hiding this comment.
Turns out the implementation actually uses msgpack
- msgpack: Message bodies are
msgpack <https://msgpack.org/>__-encoded. The first versions of RLlink are non-encrypted and non-secure.
| RLlink messages consist of a header and a body: | ||
|
|
||
| - **Header**: 8-byte length field indicating the size of the body, for example `00000016` for a body of length 16 (thus, in total, the message size). | ||
| - **Header**: An 8-byte length field giving the size of the body. For example, `00000016` indicates a body of length 16, and thus the total message size. |
There was a problem hiding this comment.
Proposed update
- Header: 8-byte length field holding the size of the body in bytes as an ASCII decimal number, left-padded with zeros, for example
00000011for a body of 11 bytes. The header isn't included in this count, so the total frame is 8 + body-length bytes. - Body: msgpack-encoded dict with a mandatory
typefield indicating the message type.
| #### Example messages: PING and EPISODES_AND_GET_STATE | ||
|
|
||
| Here is a complete simple example message for the `PING` message. Note the 8-byte header encoding the size of the following body to be of length `16`, followed by the message body with the mandatory "type" field. | ||
| Here is a complete example of the `PING` message. The 8-byte header encodes the size of the following body as length `16`, followed by the message body with the mandatory "type" field. |
There was a problem hiding this comment.
Here is a complete example frame for the PING message. The body is the msgpack encoding of
the dict {"type": "PING"}, which is 11 bytes long, hence the header 00000011:
| Here is a complete example of the `PING` message. The 8-byte header encodes the size of the following body as length `16`, followed by the message body with the mandatory "type" field. | ||
|
|
||
| ``` | ||
| 00000016{"type": "PING"} |
There was a problem hiding this comment.
b"00000011" + b"\x81\xa4type\xa4PING"
| The client sends the `PING` message after initiating a new connection. The server then responds with: | ||
|
|
||
| ``` | ||
| 00000016{"type": "PONG"} |
There was a problem hiding this comment.
b"00000011" + b"\x81\xa4type\xa4PING"
There was a problem hiding this comment.
Used the actual PONG frame here — b"00000011" + b"\x81\xa4type\xa4PONG" (your snippet pasted the PING bytes). Verified with msgpack.packb({"type": "PONG"}) → 11 bytes, parallel to PING.
There was a problem hiding this comment.
.. code-block:: python
send_rllink_message(
sock,
{
"type": "EPISODES_AND_GET_STATE",
# One `SingleAgentEpisode.get_state()` dict per episode chunk.
"episodes": [episode.get_state() for episode in episodes],
"timesteps": 128,
},
)
There was a problem hiding this comment.
Applied the send_rllink_message(...) example in d2628b9. One thing I left for you to confirm rather than guess: the Body description just below still lists weights_seq_no and enumerates obs/actions/rewards/is_terminated/is_truncated keys, but this example now uses episode.get_state() dicts and a timesteps field (no weights_seq_no). Should the Body list timesteps and describe the SingleAgentEpisode.get_state() shape instead? I didn't want to fabricate the wire fields.
There was a problem hiding this comment.
Code Review
This pull request performs a comprehensive set of documentation updates and copy-editing across RLlib's markdown guides to improve clarity, flow, and alignment with the new API stack. The review comments correctly identify a few minor typos in package and class paths (such as using ray.rllib.envs instead of ray.rllib.env and a truncated RLModule class path) and provide helpful suggestions to fix them.
| **EnvRunner with gym.Env setup:** Environments in RLlib live within the {py:class}`~ray.rllib.envs.env_runner.EnvRunner` actors. Scale their | ||
| number `n` through the `config.env_runners(num_env_runners=..)` setting. Each {py:class}`~ray.rllib.envs.env_runner.EnvRunner` actor |
There was a problem hiding this comment.
The package path ray.rllib.envs contains a typo. It should be ray.rllib.env (singular) to correctly reference the EnvRunner class.
| **EnvRunner with gym.Env setup:** Environments in RLlib live within the {py:class}`~ray.rllib.envs.env_runner.EnvRunner` actors. Scale their | |
| number `n` through the `config.env_runners(num_env_runners=..)` setting. Each {py:class}`~ray.rllib.envs.env_runner.EnvRunner` actor | |
| **EnvRunner with gym.Env setup:** Environments in RLlib live within the {py:class}`~ray.rllib.env.env_runner.EnvRunner` actors. Scale their | |
| number `n` through the `config.env_runners(num_env_runners=..)` setting. Each {py:class}`~ray.rllib.env.env_runner.EnvRunner` actor |
| 1. **Distribute across multiple processes:** RLlib creates multiple {py:class}`~ray.rllib.envs.env_runner.EnvRunner` instances, each a Ray actor, for experience collection, controlled through your {py:class}`~ray.rllib.algorithms.algorithm_config.AlgorithmConfig`: `config.env_runners(num_env_runners=..)`. | ||
|
|
||
| 2. **Vectorization within a single process:** Many environments achieve high frame rates per core but are limited by policy inference latency. To address this limitation, create multiple environments per process to batch the policy forward pass across these vectorized environments. Set `config.env_runners(num_envs_per_env_runner=..)` to create more than one environment copy per {py:class}`~ray.rllib.envs.env_runner.EnvRunner` actor. Additionally, you can make the individual sub-environments within a vector independent processes through Python's multiprocessing used by gymnasium. Set `config.env_runners(remote_worker_envs=True)` to create individual subenvironments as separate processes and step them in parallel. | ||
| 1. **Vectorization within a single process:** Many environments achieve high frame rates per core, but policy inference latency limits them. To address this limitation, create multiple environments per process to batch the policy forward pass across these vectorized environments. Set `config.env_runners(num_envs_per_env_runner=..)` to create more than one environment copy per {py:class}`~ray.rllib.envs.env_runner.EnvRunner` actor. You can also run the individual sub-environments within a vector as separate processes, using the Python multiprocessing that gymnasium provides. Set `config.env_runners(remote_worker_envs=True)` to create individual subenvironments as separate processes and step them in parallel. |
There was a problem hiding this comment.
The package path ray.rllib.envs contains a typo. It should be ray.rllib.env (singular) to correctly reference the EnvRunner class.
| 1. **Distribute across multiple processes:** RLlib creates multiple {py:class}`~ray.rllib.envs.env_runner.EnvRunner` instances, each a Ray actor, for experience collection, controlled through your {py:class}`~ray.rllib.algorithms.algorithm_config.AlgorithmConfig`: `config.env_runners(num_env_runners=..)`. | |
| 2. **Vectorization within a single process:** Many environments achieve high frame rates per core but are limited by policy inference latency. To address this limitation, create multiple environments per process to batch the policy forward pass across these vectorized environments. Set `config.env_runners(num_envs_per_env_runner=..)` to create more than one environment copy per {py:class}`~ray.rllib.envs.env_runner.EnvRunner` actor. Additionally, you can make the individual sub-environments within a vector independent processes through Python's multiprocessing used by gymnasium. Set `config.env_runners(remote_worker_envs=True)` to create individual subenvironments as separate processes and step them in parallel. | |
| 1. **Vectorization within a single process:** Many environments achieve high frame rates per core, but policy inference latency limits them. To address this limitation, create multiple environments per process to batch the policy forward pass across these vectorized environments. Set `config.env_runners(num_envs_per_env_runner=..)` to create more than one environment copy per {py:class}`~ray.rllib.envs.env_runner.EnvRunner` actor. You can also run the individual sub-environments within a vector as separate processes, using the Python multiprocessing that gymnasium provides. Set `config.env_runners(remote_worker_envs=True)` to create individual subenvironments as separate processes and step them in parallel. | |
| 1. **Distribute across multiple processes:** RLlib creates multiple {py:class}`~ray.rllib.env.env_runner.EnvRunner` instances, each a Ray actor, for experience collection, controlled through your {py:class}`~ray.rllib.algorithms.algorithm_config.AlgorithmConfig`: `config.env_runners(num_env_runners=..)`. | |
| 1. **Vectorization within a single process:** Many environments achieve high frame rates per core, but policy inference latency limits them. To address this limitation, create multiple environments per process to batch the policy forward pass across these vectorized environments. Set `config.env_runners(num_envs_per_env_runner=..)` to create more than one environment copy per {py:class}`~ray.rllib.env.env_runner.EnvRunner` actor. You can also run the individual sub-environments within a vector as separate processes, using the Python multiprocessing that gymnasium provides. Set `config.env_runners(remote_worker_envs=True)` to create individual subenvironments as separate processes and step them in parallel. |
|
|
||
| :::{note} | ||
| Typically, increasing the number of CPUs is sufficient for performance tuning in the post-processing stage of your pipeline. GPUs are only needed in specialized cases, such as in customized pipelines. For example, RLlib’s {py:class}`~ray.rllib.algorithms.marwil.marwil.MARWIL` implementation uses the {py:class}`~ray.rllib.connectors.learner.general_advantage_estimation.GeneralAdvantageEstimation` connector in its {py:class}`~ray.rllib.connectors.connector_pipeline_v2.ConnectorPipelineV2` to apply [General Advantage Estimation](https://arxiv.org/abs/1506.02438) on experience batches. In these calculations, the value model of the algorithm's {py:class}`~ray.rllib.core.rl_module.RLModule` is applied, which you can accelerate by running on a GPU. | ||
| Typically, increasing the number of CPUs is enough to tune the post-processing stage. You need GPUs only in specialized cases, such as customized pipelines. For example, RLlib's {py:class}`~ray.rllib.algorithms.marwil.marwil.MARWIL` implementation uses the {py:class}`~ray.rllib.connectors.learner.general_advantage_estimation.GeneralAdvantageEstimation` connector in its {py:class}`~ray.rllib.connectors.connector_pipeline_v2.ConnectorPipelineV2` to apply [General Advantage Estimation](https://arxiv.org/abs/1506.02438) to experience batches. These calculations apply the value model of the algorithm's {py:class}`~ray.rllib.core.rl_module.RLModule`, which you can accelerate by running on a GPU. |
There was a problem hiding this comment.
The class path {py:class}~ray.rllib.core.rl_module.RLModule is missing the module name `.rl_module`. It should be `{py:class}`~ray.rllib.core.rl_module.rl_module.RLModule to be consistent with other references in the documentation.
| Typically, increasing the number of CPUs is enough to tune the post-processing stage. You need GPUs only in specialized cases, such as customized pipelines. For example, RLlib's {py:class}`~ray.rllib.algorithms.marwil.marwil.MARWIL` implementation uses the {py:class}`~ray.rllib.connectors.learner.general_advantage_estimation.GeneralAdvantageEstimation` connector in its {py:class}`~ray.rllib.connectors.connector_pipeline_v2.ConnectorPipelineV2` to apply [General Advantage Estimation](https://arxiv.org/abs/1506.02438) to experience batches. These calculations apply the value model of the algorithm's {py:class}`~ray.rllib.core.rl_module.RLModule`, which you can accelerate by running on a GPU. | |
| Typically, increasing the number of CPUs is enough to tune the post-processing stage. You need GPUs only in specialized cases, such as customized pipelines. For example, RLlib's {py:class}`~ray.rllib.algorithms.marwil.marwil.MARWIL` implementation uses the {py:class}`~ray.rllib.connectors.learner.general_advantage_estimation.GeneralAdvantageEstimation` connector in its {py:class}`~ray.rllib.connectors.connector_pipeline_v2.ConnectorPipelineV2` to apply [General Advantage Estimation](https://arxiv.org/abs/1506.02438) to experience batches. These calculations apply the value model of the algorithm's {py:class}`~ray.rllib.core.rl_module.rl_module.RLModule`, which you can accelerate by running on a GPU. |
0bdcc69 to
3b3d785
Compare
Deterministic Layer 0 of the RLlib docs style pass: fix spelling (reused, preempted, ones) and apply the shared Ray/RLlib Vale term swaps (utilize/leverage->use, via->through, in order to->to, multiagent->multi-agent, RL module->RLModule, and reference-sense refer to->see). Prose only; code, roles, anchors, and URLs untouched. Co-Authored-By: Claude Opus 4.8 <[email protected]> Signed-off-by: Douglas Strodtman <[email protected]>
Comprehensive prose pass against the Ray writing-style guide: active voice, second person, present tense, no first-person plural, cut filler, "such as" not "like", direct advice over hedging, and remove the "See here for ..." link antipattern. Meaning preserved; code, role targets, and anchors unchanged. Co-Authored-By: Claude Opus 4.8 <[email protected]> Signed-off-by: Douglas Strodtman <[email protected]>
Comprehensive prose pass against the Ray writing-style guide on offline, metrics-logger, multi-agent-envs, replay-buffers, examples, single-agent-episode, index, rl-modules, and dev: active voice, second person, present tense, no first-person plural, filler cut, "such as" not "like", direct advice over hedging, parentheticals and long sentences restructured, inline enumerations turned into lists, headings to sentence case. Meaning preserved; code, role targets, anchors, and URLs unchanged. Co-Authored-By: Claude Opus 4.8 <[email protected]> Signed-off-by: Douglas Strodtman <[email protected]>
Comprehensive prose pass on learner, new-api-stack-migration-guide, checkpoints, algorithms, env-to-module-connector, env, advanced-api, and external-envs: active voice, second person, present tense, no first-person plural, filler cut, "such as" not "like", direct advice over hedging, parentheticals and long sentences restructured, headings to sentence case. Meaning preserved; code, role targets, anchors, and URLs unchanged. Co-Authored-By: Claude Opus 4.8 <[email protected]> Signed-off-by: Douglas Strodtman <[email protected]>
Comprehensive prose pass on learner-connector, callback, algorithm-config,
connector-v2, scaling-guide, hierarchical-envs, fault-tolerance, and
user-guides: active voice, second person, present tense, no first-person
plural, filler cut, "such as" not "like", direct advice over hedging,
parentheticals restructured, headings and landing-page card text to
sentence case. Also repairs an invalid `ref:` cross-reference to `{ref}`
in callback (target unchanged). Meaning preserved; code, role targets,
anchors, and URLs otherwise unchanged.
Co-Authored-By: Claude Opus 4.8 <[email protected]>
Signed-off-by: Douglas Strodtman <[email protected]>
Targeted cleanup pass over the seam the comprehensive pass leaves: list
lead-ins made complete sentences that state the count, list-item
punctuation made consistent, decorative body-prose bold removed, suspended
compound hyphens closed ("state- and constructor" -> "state and
constructor"), and figure-caption/admonition prose tightened. Meaning
preserved; code, role targets, anchors, and URLs unchanged.
Co-Authored-By: Claude Opus 4.8 <[email protected]>
Signed-off-by: Douglas Strodtman <[email protected]>
Second half of the cleanup pass: normalize ordered-list markers to `1.`,
make list-item punctuation consistent, close suspended compound hyphens
("actor- and critic-networks" -> "actor and critic networks"), make
"Example:" task headings imperative after the colon label, strip
decorative body-prose bold, and tighten figure-caption and admonition
prose. Meaning preserved; code, role targets, anchors, and URLs unchanged.
Co-Authored-By: Claude Opus 4.8 <[email protected]>
Signed-off-by: Douglas Strodtman <[email protected]>
`Algorithm.config[“explore”]` used typographic quotes inside an inline code span, which aren't valid Python string delimiters and render literally. Replace with straight quotes. Co-Authored-By: Claude Opus 4.8 <[email protected]> Signed-off-by: Douglas Strodtman <[email protected]>
Fixes pre-existing bugs surfaced during the style pass, each verified
against the Ray source tree:
- Broken `{py:class}` targets: `~®ay...OfflineData` -> `~ray...`,
`OffLinePreLearner` -> `OfflinePreLearner` (x2),
`~ray.train._internals.backend_executor_BackendExecutor` ->
`~ray.train._internal.backend_executor.BackendExecutor`, and
`default_model_cnofig` -> `default_model_config`.
- Three `{ref}`Ray Data ...`` cross-references were written as inline
code and rendered literally; restored the role syntax.
- OpenSpiel section referenced the `PettingZooEnv` wrapper; the code
uses `OpenSpielEnv`, so point the prose at `OpenSpielEnv`.
- SAC architecture caption said "makes DQN sample-efficient" (copied
from the DQN caption); corrected to SAC.
- DeepMind Control Suite figure caption said "Atari 100k tasks" (copied
from the Atari figure); corrected to DeepMind Control Suite tasks.
- Scaling guide: fractional-GPU example referenced EnvRunner and
Algorithm where `num_gpus_per_learner` makes it Learner instances.
- Stray trailing backticks on a pip command; a "replace" -> "replaced"
code-comment typo.
Co-Authored-By: Claude Opus 4.8 <[email protected]>
Signed-off-by: Douglas Strodtman <[email protected]>
A meaning-diff review of the prose pass found five edits where concision or an active-voice rewrite made a claim more certain than the original: - fault-tolerance: "a machine is pre-empted" had become "Ray preempts one machine", misassigning preemption to Ray rather than the cloud/spot provider; restore the passive and the "can continue" hedge. - fault-tolerance self-recovery: "RLlib restores" -> "RLlib tries to restore" (best-effort, not guaranteed). - replay-buffers: "retaining compatibility" -> "trying to retain compatibility". - examples: seeded runs "become repeatable" -> "should become repeatable" (asynchronous algorithms stay stochastic). - rl-modules: the algorithm "affects the structure" -> "affects the structure to some extent" (it fixes a required API set, not the whole structure). Co-Authored-By: Claude Opus 4.8 <[email protected]> Signed-off-by: Douglas Strodtman <[email protected]>
…tion The instruction for setting only the RLModule's weights said to call `Learner.get_state` and pass a state dict; setting state uses `Learner.set_state` (`get_state` reads). Verified against rllib/core/learner/learner.py. Co-Authored-By: Claude Opus 4.8 <[email protected]> Signed-off-by: Douglas Strodtman <[email protected]>
The rST->MyST conversion mapped each top-level section underline to its own H1, leaving dev, learner, and single-agent-episode with several H1s per page. Keep the first H1 on each page and demote the rest by one level, cascading their subsections down to match, so each page has a single H1 and a consistent tree. Also fix one stray heading level in offline: "Actor pool size" was an H3 among its H4 siblings under "How to tune updating (Learner)". Heading markers only; no prose, anchors, or cross-references changed. Co-Authored-By: Claude Opus 4.8 <[email protected]> Signed-off-by: Douglas Strodtman <[email protected]>
Resolve the reviewer questions and suggestions on the style-pass PR: - metrics-logger: the migration section targets Ray 2.53 (maintainer confirmed); fix the body's stale "2.52" references. - new-api-stack-migration-guide: RLlib drops TensorFlow support completely (maintainer confirmed), so remove the contradictory "still provides rudimentary support for TensorFlow" clause in both spots. - external-envs: RLlink encodes bodies with msgpack, not JSON. Rewrite the key-feature bullet, the header/body description (the length field is the body size, not the total frame), and the PING/PONG example frames (11-byte msgpack body, header `00000011`), and show the EPISODES_AND_GET_STATE example as a send_rllink_message() call. - key-concepts: move the architecture-figure caption out to regular soft-wrapped prose, and replace the "ConnectorV2 docs in progress" placeholder with a link to the now-complete ConnectorV2 page. Co-Authored-By: Claude Opus 4.8 <[email protected]> Signed-off-by: Douglas Strodtman <[email protected]>
The published RLlink section described message bodies that don't exist
in the code. Rewrite the section against rllib/env/external/rllink.py,
env_runner_server_for_external_inference.py, and the reference client so
every claim is grounded:
- SET_STATE carries `state` = {`rl_module` (RLModule.get_state()),
`weights_seq_no`}, not an `onnx_file`/`mlir_file`.
- SET_CONFIG carries `config` = a pickled AlgorithmConfig, not
`env_steps_per_sample`/`force_on_policy` fields.
- EPISODES_AND_GET_STATE carries `episodes` (SingleAgentEpisode
get_state() dicts) and `timesteps`, not raw obs/actions/rewards.
- Document the two missing current message types, EPISODES and
GET_STATE, and correct "strict request-response" (a bare EPISODES
message draws no reply).
- Keep the msgpack framing (8-byte body-length header) and the verified
PING/PONG example frames.
Co-Authored-By: Claude Opus 4.8 <[email protected]>
Signed-off-by: Douglas Strodtman <[email protected]>
The maintainer confirmed weights_seq_no signals how on-policy the collected data is, but couldn't confirm a client-facing dedup contract. Describe it as the model-weights version whose comparison reveals on- policyness, and drop the unverified "client and server skip redundant updates" claim. Co-Authored-By: Claude Opus 4.8 <[email protected]> Signed-off-by: Douglas Strodtman <[email protected]>
42a6281 to
caf1ec0
Compare
Resolve the review-flagged issues from this PR and the earlier stack PRs:
- env.md: correct the EnvRunner xref from the non-existent
`ray.rllib.envs.env_runner.EnvRunner` (plural) to
`ray.rllib.env.env_runner.EnvRunner` (singular), five occurrences. The
plural package doesn't exist, so the `{py:class}` role didn't resolve.
- offline.md: complete the RLModule xref to
`ray.rllib.core.rl_module.rl_module.RLModule`, matching the form used
everywhere else in the docs.
- env-to-module-connector.md: fix a run-on in a code comment
("connector. so construct" -> "connector, so construct").
- env.md, scaling-guide.md: normalize the `=..` placeholder to `=...` so
the illustrative snippets are valid Python `Ellipsis`, matching the
convention already used in the sibling guide pages.
Co-Authored-By: Claude Opus 4.8 <[email protected]>
Signed-off-by: Douglas Strodtman <[email protected]>
#66214 soft-wrapped the converted RLlib doc pages to one sentence per line. That reflow is whitespace-only but rewrites every line, so `git blame` on those pages now attributes every line to the reflow commit instead of the real authorship underneath. This adds that squash commit to `.git-blame-ignore-revs`, the same mechanism the repo already uses for the Black reformat commit. `git blame --ignore-revs-file .git-blame-ignore-revs` and GitHub's blame UI then skip the reflow and surface the underlying edits. The grammar and style pass (#66239) is deliberately left out of this file: those are real edits that should stay attributable. Signed-off-by: Douglas Strodtman <[email protected]>
…ing-style guide (ray-project#66239) ## Summary Two things across the converted RLlib documentation pages under `doc/source/rllib/`: a prose/style pass against the [Ray writing-style guide](https://docs.ray.io/en/latest/ray-contribute/writing-style.html), and a set of technical corrections surfaced during that pass and by RLlib-maintainer review. This is the style-pass layer of the RLlib IA pilot stack, sitting on top of the soft-wrap PR (ray-project#66214) and the Vale-rules PR (ray-project#66236), whose warn-first rules this pass uses as its deterministic net. Opening as a **draft** for review. All 26 pages have had the pass; the stack still needs a rebase as the lower PRs merge. ## How the style pass runs A deterministic-first pipeline, so the model never spends effort on what a linter catches: - **Layer 0 (deterministic, no model):** `codespell` for typos, then the shared `Ray/` and `RLlib/` Vale term swaps applied to prose only (code, inline code, MyST roles, anchors, and URLs are shielded). Two semantic false positives were caught by hand: `refer to → see` is correct for a reference but wrong for the "pertain to" sense, and a `N(ot)` math token inside inline code isn't a typo. - **Comprehensive pass (per page):** active voice, second person, present tense, no first-person plural, filler cut, "such as" not "like", hedges turned into direct advice, parentheticals and long sentences restructured, headings to sentence case. Meaning is held invariant; code, role targets, and anchors are never touched, and soft-wrap is preserved. - **Cleanup pass (per page):** list punctuation, parentheticals, and the prose inside figure captions, admonition bodies, and `list-table` cells — the seam the comprehensive pass misses. Every prose edit is verified against the `git diff`, not the editor's self-report: code-fence counts, `{ref}`/`{py:*}` role targets, `(label)=` anchors, and URLs are diffed to confirm they didn't move. ## Technical corrections (from maintainer review and code introspection) The prose pass is meaning-preserving by design, but reviewing it surfaced pre-existing technical errors in the docs. These are **not** style edits, and each one is validated against the RLlib source rather than guessed: - **Broken cross-references and copy-paste errors:** dead `{py:class}`/`{ref}` targets (for example a Unicode `®ay`, `OffLinePreLearner`, `default_model_cnofig`), a SAC diagram captioned "DQN", a DeepMind Control Suite figure captioned "Atari 100k tasks", and an OpenSpiel section that pointed at the `PettingZooEnv` wrapper. Each corrected form was confirmed against the source tree before applying. - **`external-envs.md` RLlink protocol section, rewritten:** the published section described message bodies that don't exist in the code. @pseudo-rnd-thoughts flagged the section as materially wrong during review; the rewrite is validated through direct discussion with him and by introspecting the implementation (`rllib/env/external/rllink.py`, `env_runner_server_for_external_inference.py`, and the reference client). It corrects the wire format (msgpack, with a body-length header), the `SET_STATE` body (`rl_module` state plus `weights_seq_no`, not an `onnx_file`/`mlir_file`), the `SET_CONFIG` body (a pickled `AlgorithmConfig`, not `env_steps_per_sample`/`force_on_policy`), and the `EPISODES_AND_GET_STATE` body (`SingleAgentEpisode.get_state()` dicts plus `timesteps`), and documents the previously omitted `EPISODES` and `GET_STATE` message types. External-environment support is an early, still-changing area of RLlib. This PR corrects the docs to match the current implementation and keeps the section's "early draft" note; deeper protocol tech debt is expected to be follow-up work for eng. The three open questions the review raised (a Ray 2.52/2.53 version mismatch, a TensorFlow-support contradiction, and the RLlink framing) were answered by the maintainer and are resolved in the commits above. ## Scope and status All 26 soft-wrapped RLlib pages are in scope for the prose pass; the technical corrections touch the subset where review found errors. Vale enforcement (widening the hook and CI paths) stays deferred to ray-project#66236's plan. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Signed-off-by: Douglas Strodtman <[email protected]> Co-authored-by: Claude Opus 4.8 <[email protected]>
…ect#66285) ray-project#66214 soft-wrapped the converted RLlib doc pages to one sentence per line. That reflow is whitespace-only but rewrites every line, so `git blame` on those pages now attributes every line to the reflow commit instead of the real authorship underneath. This adds that squash commit to `.git-blame-ignore-revs`, the same mechanism the repo already uses for the Black reformat commit. `git blame --ignore-revs-file .git-blame-ignore-revs` and GitHub's blame UI then skip the reflow and surface the underlying edits. The grammar and style pass (ray-project#66239) is deliberately left out of this file: those are real edits that should stay attributable. Signed-off-by: Douglas Strodtman <[email protected]>
Summary
Two things across the converted RLlib documentation pages under
doc/source/rllib/: a prose/style pass against the Ray writing-style guide, and a set of technical corrections surfaced during that pass and by RLlib-maintainer review. This is the style-pass layer of the RLlib IA pilot stack, sitting on top of the soft-wrap PR (#66214) and the Vale-rules PR (#66236), whose warn-first rules this pass uses as its deterministic net.Opening as a draft for review. All 26 pages have had the pass; the stack still needs a rebase as the lower PRs merge.
How the style pass runs
A deterministic-first pipeline, so the model never spends effort on what a linter catches:
codespellfor typos, then the sharedRay/andRLlib/Vale term swaps applied to prose only (code, inline code, MyST roles, anchors, and URLs are shielded). Two semantic false positives were caught by hand:refer to → seeis correct for a reference but wrong for the "pertain to" sense, and aN(ot)math token inside inline code isn't a typo.list-tablecells — the seam the comprehensive pass misses.Every prose edit is verified against the
git diff, not the editor's self-report: code-fence counts,{ref}/{py:*}role targets,(label)=anchors, and URLs are diffed to confirm they didn't move.Technical corrections (from maintainer review and code introspection)
The prose pass is meaning-preserving by design, but reviewing it surfaced pre-existing technical errors in the docs. These are not style edits, and each one is validated against the RLlib source rather than guessed:
{py:class}/{ref}targets (for example a Unicode®ay,OffLinePreLearner,default_model_cnofig), a SAC diagram captioned "DQN", a DeepMind Control Suite figure captioned "Atari 100k tasks", and an OpenSpiel section that pointed at thePettingZooEnvwrapper. Each corrected form was confirmed against the source tree before applying.external-envs.mdRLlink protocol section, rewritten: the published section described message bodies that don't exist in the code. @pseudo-rnd-thoughts flagged the section as materially wrong during review; the rewrite is validated through direct discussion with him and by introspecting the implementation (rllib/env/external/rllink.py,env_runner_server_for_external_inference.py, and the reference client). It corrects the wire format (msgpack, with a body-length header), theSET_STATEbody (rl_modulestate plusweights_seq_no, not anonnx_file/mlir_file), theSET_CONFIGbody (a pickledAlgorithmConfig, notenv_steps_per_sample/force_on_policy), and theEPISODES_AND_GET_STATEbody (SingleAgentEpisode.get_state()dicts plustimesteps), and documents the previously omittedEPISODESandGET_STATEmessage types.External-environment support is an early, still-changing area of RLlib. This PR corrects the docs to match the current implementation and keeps the section's "early draft" note; deeper protocol tech debt is expected to be follow-up work for eng.
The three open questions the review raised (a Ray 2.52/2.53 version mismatch, a TensorFlow-support contradiction, and the RLlink framing) were answered by the maintainer and are resolved in the commits above.
Scope and status
All 26 soft-wrapped RLlib pages are in scope for the prose pass; the technical corrections touch the subset where review found errors. Vale enforcement (widening the hook and CI paths) stays deferred to #66236's plan.
🤖 Generated with Claude Code