Guide for adding dynamic/filter hooks in slime rollout pipeline. Use when user wants sample-group selection during rollout, buffer filtering before training, or per-sample masking/processing hooks.
Add filtering hooks in rollout and buffer stages while preserving sample-group contracts.
Use this skill when:
--dynamic-sampling-filter-path--buffer-filter-path--rollout-sample-filter-path--rollout-all-samples-process-pathDynamic sampling filter (called in slime/rollout/sglang_rollout.py):
def filter_function(args, samples, **kwargs):
# return DynamicFilterOutput or bool
Preferred return type:
from slime.rollout.filter_hub.base_types import DynamicFilterOutput
return DynamicFilterOutput(keep=True, reason=None)
Buffer filter (called in slime/rollout/data_source.py):
def buffer_filter(args, rollout_id, buffer, num_samples):
return selected_groups
Rollout sample filter:
def rollout_sample_filter(args, samples):
# modify sample.remove_sample in-place where needed
All-samples process:
def process_all_samples(args, all_samples, data_source):
...
list[list[Sample]] structure intact where required.sample.remove_sample=True over deleting objects.Example wiring:
--dynamic-sampling-filter-path slime.rollout.filter_hub.dynamic_sampling_filters.check_reward_nonzero_std
--buffer-filter-path <module>.buffer_filter
--rollout-sample-filter-path <module>.rollout_sample_filter
--rollout-all-samples-process-path <module>.process_all_samples
rollout_batch_size expectations.slime/rollout/filter_hub/base_types.pyslime/rollout/filter_hub/dynamic_sampling_filters.pyslime/rollout/sglang_rollout.pyslime/rollout/data_source.py