bugger.
All challenges/Pythonmediumllm-grpo-advantages-v1
THE INVESTIGATION

Group-relative advantages for GRPO

Normalize rollout rewards within each prompt for a group-relative policy objective.

LLM ArchitecturePost-training

What’s going wrong

Original LLM Architecture lab. Implement the missing behavior in solve(data) and keep the supplied JSON interface. Use Python’s standard library.

Input groups is a list of reward lists (one list per prompt) and epsilon > 0. Return means and advantages in group order. Use population standard deviation inside each group and divide centered rewards by (std + epsilon). Empty groups have mean 0 and empty advantages. This lab implements the advantage normalization stage.

Small, well-formed JSON inputs and standard-library Python arithmetic. Keep full precision during computation. The supplied output wrapper rounds results to six decimal places.

Expected behavior

Normalize rollout rewards within each prompt for a group-relative policy objective.

Reproduction

01 Different reward scales must stay within groups
{"groups":[[1,2,3],[100,200]],"epsilon":0.001}
{"means":[2,150],"advantages":[[-1.223247,0,1.223247],[-0.99998,0.99998]]}
02 Empty prompt group
{"groups":[[]],"epsilon":0.001}
{"means":[0],"advantages":[[]]}
03 Identical rewards have zero advantage
{"groups":[[4,4]],"epsilon":0.001}
{"means":[4],"advantages":[[0,0]]}

Before you begin

  • Python functions, lists and dictionaries

Need a nudge?

Reveal one investigation hint at a time. Try each clue before opening the next.

    The bug is intentional. Run the starter code to see it fail, then work toward a fix. Difficulty is provisional.
    Read-only preview
    Ready when you are
    Every fix starts with a failing test.

    Read the report, then sign in to start your investigation.