[data][llm] Add per-stage map kwargs for build_llm_processor preprocess/postprocess#57826
Merged
kouroshHakha merged 6 commits intoray-project:masterfrom Oct 18, 2025
Merged
Conversation
…ss/postprocess Addresses ray-project#57812. Enable users to control resources and concurrency of preprocess/postprocess stages independently from the main LLM stage by passing Dataset.map() kwargs. - Add preprocess_map_kwargs and postprocess_map_kwargs parameters to build_llm_processor() and all builder functions - Update Processor class to store and apply map kwargs to dataset.map() calls - Add validation for map kwargs with warnings on unknown keys - Unit tests + Update docstrings Users can now provision fractional CPU resources and tune parameters per stage without workarounds- improving utilization. Signed-off-by: Nikhil Ghosh <nikhil@anyscale.com>
Signed-off-by: Nikhil Ghosh <nikhil@anyscale.com>
Signed-off-by: Nikhil Ghosh <nikhil@anyscale.com>
Comment on lines
+385
to
+410
| @classmethod | ||
| def validate_map_kwargs(cls, map_kwargs: Optional[Dict[str, Any]]) -> None: | ||
| """Validate map kwargs contain only supported Dataset.map parameters. | ||
|
|
||
| Args: | ||
| map_kwargs: Optional kwargs to pass to Dataset.map(). | ||
|
|
||
| Note: | ||
| Unknown keys will trigger a warning as they'll be passed as ray_remote_args. | ||
| """ | ||
| if map_kwargs is None: | ||
| return | ||
|
|
||
| # Supported Dataset.map parameters | ||
| supported_keys = { | ||
| "compute", | ||
| "fn_args", | ||
| "fn_kwargs", | ||
| "fn_constructor_args", | ||
| "fn_constructor_kwargs", | ||
| "num_cpus", | ||
| "num_gpus", | ||
| "memory", | ||
| "concurrency", | ||
| "ray_remote_args_fn", | ||
| } |
Contributor
There was a problem hiding this comment.
this list is dynamic and i don't think it's easy to maintain this one. We should just leave it up to the user to read the docs and provide the right map kwargs.
Contributor
Author
There was a problem hiding this comment.
good point, resolved
kouroshHakha
approved these changes
Oct 17, 2025
Contributor
|
@nrghosh tests are failing. |
dc0b178 to
ca429d4
Compare
- parameters change over time, don't enforce statically - remove validation from llm.py::build_llm_processor Signed-off-by: Nikhil Ghosh <nikhil@anyscale.com>
ca429d4 to
21b95e4
Compare
kouroshHakha
approved these changes
Oct 18, 2025
justinyeh1995
pushed a commit
to justinyeh1995/ray
that referenced
this pull request
Oct 20, 2025
…ss/postprocess (ray-project#57826) Signed-off-by: Nikhil Ghosh <nikhil@anyscale.com>
xinyuangui2
pushed a commit
to xinyuangui2/ray
that referenced
this pull request
Oct 22, 2025
…ss/postprocess (ray-project#57826) Signed-off-by: Nikhil Ghosh <nikhil@anyscale.com> Signed-off-by: xgui <xgui@anyscale.com>
elliot-barn
pushed a commit
that referenced
this pull request
Oct 23, 2025
…ss/postprocess (#57826) Signed-off-by: Nikhil Ghosh <nikhil@anyscale.com> Signed-off-by: elliot-barn <elliot.barnwell@anyscale.com>
6 tasks
landscapepainter
pushed a commit
to landscapepainter/ray
that referenced
this pull request
Nov 17, 2025
…ss/postprocess (ray-project#57826) Signed-off-by: Nikhil Ghosh <nikhil@anyscale.com>
Aydin-ab
pushed a commit
to Aydin-ab/ray-aydin
that referenced
this pull request
Nov 19, 2025
…ss/postprocess (ray-project#57826) Signed-off-by: Nikhil Ghosh <nikhil@anyscale.com> Signed-off-by: Aydin Abiar <aydin@anyscale.com>
Future-Outlier
pushed a commit
to Future-Outlier/ray
that referenced
this pull request
Dec 7, 2025
…ss/postprocess (ray-project#57826) Signed-off-by: Nikhil Ghosh <nikhil@anyscale.com> Signed-off-by: Future-Outlier <eric901201@gmail.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.
Description
Enable users to control resources and concurrency of preprocess/postprocess stages independently from the main LLM stage by passing Dataset.map() kwargs.
Users can now provision fractional CPU resources and tune parameters per stage without workarounds- improving utilization.
Related issues
Addresses #57812
Additional information
Example usage:
instead of