Define the preference task
Specify what preferences mean for your domain (pairwise comparisons, ranking) and how they map to a reward signal the agent can use.
Simulate preference optimisation. Compare simple policies.
Preference optimisation in RLHF means learning from comparative human feedback to shape a reward signal and improve policy behaviour. Key challenges include reward misspecification, sample efficiency, and safe policy updates under noisy or sparse preference labels.
Learning concept · Not a validated service
Preference optimisation in RLHF means learning from comparative human feedback to shape a reward signal and improve policy behaviour. Key challenges include reward misspecification, sample efficiency, and safe policy updates under noisy or sparse preference labels.
A proposed extension: use human or synthetic preference comparisons to train a reward model and evaluate simple policy updates in a controlled simulator, while keeping humans in the loop for safety-critical decisions.
Specify what preferences mean for your domain (pairwise comparisons, ranking) and how they map to a reward signal the agent can use.
Use a simple multi-armed bandit or scripted policy to collect preference-style rewards and establish a performance baseline.
Fit a model that maps observations or trajectory features to scalar reward estimates using collected comparisons.
Report average return, regret and stability across seeds, and manually inspect cases where the reward model disagrees with human judgement.
The supplied starter runs an epsilon-greedy multi-armed bandit simulation using NumPy: four Bernoulli arms with fixed true reward rates, online sample-mean estimates, and an epsilon exploration policy. It prints action counts, estimated reward rates and the accumulated reward. The code does not implement RLHF (no reward model trained from human preferences, no policy gradient or value optimisation, and no preference dataset).
for step in range(1, 2001):
if rng.random() < epsilon:
action = rng.integers(len(true_reward_rates))
else:
action = int(np.argmax(estimated_values))
reward = 1 if rng.random() < true_reward_rates[action] else 0
action_counts[action] += 1
total_reward += reward
estimated_values[action] += (reward - estimated_values[action]) / action_counts[action]This starter is a simple epsilon-greedy bandit simulation with fixed Bernoulli reward rates. It does not use human preference data, does not train a reward model from pairwise comparisons, and does not perform policy optimisation steps used in RLHF (no policy network, no PPO/PG updates, no offline trajectory handling). Results from this small simulation cannot be taken as evidence for RLHF behaviour.
A proposed extension: collect pairwise preference labels (human or synthetic), train a reward model to predict which trajectory is preferred, then use that reward model to optimise a policy (e.g. via PPO) inside a simulator while logging safety checks.
This is a potential application pathway, not a delivered product. The supplied starter does not implement this service or validate it with real users.
Networkers Home runs this topic inside its AI Engineer Course, with placement support and hands-on labs.