UX/Unintended bug: sample.reward is None on aborted sample
Author: casper-hansenCreated Aug 18, 2025Updated Sep 5, 2026
Hi @zhuzilin, I think I found a subtle unintended UX issue. If a sample is aborted, sample.reward will be None because that is the default. This can easily be caused by using a --custom-generate-function-path where you might want to abort certain samples like in Search-R1 if a tool call fails.
However, aborting a sample is not safe as it will trigger an error when converting the list of rewards to a PyTorch Tensor in GRPO:
I suggest a minor patch like below or another way to handle None reward values (pending further testing if this works).
diff --git a/slime/rollout/sglang_rollout.py b/slime/rollout/sglang_rollout.py
index 51150f3..5b46358 100644
--- a/slime/rollout/sglang_rollout.py
+++ b/slime/rollout/sglang_rollout.py
@@ -139,6 +139,7 @@ async def generate_and_rm(args, sample: Sample, sampling_params: dict, evaluatio
# generate
async with state.semaphore:
if state.aborted:
+ sample.reward = 0.0
sample.status = Sample.Status.ABORTED
return sampleSource: THUDM/slime