TL;DR
Reinforcement learning needs a reward function, and writing one that makes a robot do a hard task well is slow, expert work. Eureka hands that job to a coding language model: it reads the simulator's source code, writes candidate reward functions in Python, trains a policy with each one on a GPU, and feeds a summary of the training back to the model so it can edit the best candidate. Over 29 benchmark tasks, its rewards beat the expert-written rewards on 83 percent of tasks, and with curriculum learning it produced the first simulated pen-spinning skill on a five-finger hand.
Builds on: Reinforcement Learning, Reward Shaping, In-Context Learning, Genetic Algorithm, Proximal Policy Optimization (PPO) · Leads to: Reward Model
Why it mattered
Reward design is a known bottleneck. The paper cites a survey in which 92 percent of polled reinforcement learning researchers and practitioners reported manual trial-and-error reward design, and 89 percent said their rewards were sub-optimal. Rewards also cause unintended behaviour when they are slightly wrong.
Before Eureka, language models had been used for reward design in a limited way. The L2R approach asks an LLM to fill in a motion template and then to call hand-written reward primitives, so it can only express what its template allows. Eureka removes that limit by asking for free-form Python, with no task-specific template and no few-shot examples, and it showed that the generated rewards could beat expert ones on hard dexterous tasks where earlier LLM approaches lagged.
The paper also opened a route to human input without retraining the model. A person can give a reward as a starting point, or describe in words what a good behaviour should look like, and Eureka folds that into its next round of reward writing. The authors show this produced a safer gait for a simulated humanoid.
The problem
Formally, the paper frames reward design as a reward generation problem. A task is described in a string . Every part of the environment is code, and the goal is to output a reward function , as code, such that a learning algorithm trained on produces a policy that scores highly under a fitness function . The fitness function is the true measure of success, and it can only be queried by training a policy and scoring it. It is not a differentiable signal the learner can follow. The reward is the designer's proxy for .
Three obstacles make this hard for a language model. First, the first reward it writes may not run. Second, even a runnable reward is usually far from the best one. Third, the fitness score alone says little about why a reward failed. Prompts with task-specific hints fix the first two for one task, but they do not scale to new tasks. That gap is what Eureka tries to close without human hints.
The paper also notes that reward design interacts with the reinforcement learning algorithm. The same reward can perform very differently under different hyperparameters. This makes a single number from one training run a noisy guide to a reward's quality.
How it works
Eureka runs a loop of three steps. Each step has a clear input and output, and the loop repeats for a fixed number of rounds.
flowchart LR A[Task text and environment code] --> B[Coding LLM writes K reward functions] B --> C[Train a policy with each reward on a GPU simulator] C --> D[Score each policy with the fitness function] D --> E[Reflection: summarise reward components over training] E --> F[Next prompt holds the best reward and its reflection] F --> B
Here is one round, traced with small round numbers. The numbers are illustrative; they are not from the paper.
- Start with the environment as context. The prompt contains the task description and the raw environment code, with only the parts that expose the state and action variables. Check: the model sees the variables a reward can use, and nothing about the simulator's internals.
- Sample reward functions. Suppose the model returns three Python functions. One fails to run, and two run. The paper uses samples per round, which makes it very likely that at least one runs. Check: three candidates, one error, two usable.
- Train a policy for each usable reward. Each reward is used to train a policy with the same reinforcement learning algorithm and the same hyperparameters. Suppose the two policies score and on the fitness function. Check: the scores are measured on the true task fitness, not on the reward itself.
- Reflect on the best candidate. The system records the values of each reward component across training checkpoints and writes a short text summary. Suppose the best reward has a penalty term that stays near zero for the whole run. The reflection says so. Check: the reflection names a specific component and what it did.
- Ask for an edit. The next prompt contains the best reward so far, its reflection, and an instruction to improve it. The model returns new candidates, which may change a weight, a function shape, or add a term. Check: each new candidate starts from the best one, not from scratch.
- Keep the best and repeat. If the new best score beats the stored score, it replaces it. The paper runs iterations per run and independent runs per task. Check: the stored reward never gets worse.
Step 4 is what separates Eureka from a plain search. A score of says that a reward is worse, but not why. The reflection points at the component that helped or hurt.
The math
The paper's setting extends the reward design problem of Singh and colleagues. In their notation, a world model has states , actions and transition function . The learner maps a reward to a policy , which is a probability distribution over actions in each state. The learner turns a reward into a Policy (Reinforcement Learning) by solving the Markov decision process defined by and .
Step 1 in symbols: the sample
Each round draws candidate rewards from the language model, conditioned on the prompt :
The independence matters. If each sample fails to run with probability , and samples are independent, then all fail with probability . With and that is . The paper's claim is this exponential decrease, and it reports that 16 samples gave at least one executable reward in the first round for every environment it considered.
Step 2 in symbols: score and select
Each runnable candidate gets a score , the fitness of the policy trained on it. The round's best candidate is the one with the highest score:
The prompt for the next round uses , and a stored best reward is replaced only when beats the stored score. This is the elitism rule in Algorithm 1 of the paper, and it is why the stored reward never gets worse.
Step 3 in symbols: the reflection
The reflection is a text summary of the component values logged at intermediate checkpoints of the policy's training, together with the fitness value. Its purpose is to give the next round a signal that separates the components. The fitness score alone is one number per run; the reflection gives a trajectory per component.
Step 4 in symbols: the human normalised score
For the Isaac tasks, where the fitness metric changes meaning from task to task, the paper reports a normalised score relative to the sparse benchmark reward and the human reward:
A score of means the method matches the human reward, and a score above means it beats it. The denominator is the gap the human reward closes, so it scales the comparison across tasks. For the 52 percent average in the abstract, the paper clips each task's score to the range 0 to 3 before averaging over all 29 tasks, so a few very large outliers do not dominate.
Illustration with round numbers. If Method , Sparse and Human , then the normalised score is . This is our arithmetic on invented values, not a figure from the paper.
Results
The results below come from the paper's experiments section and abstract. Policies were trained with PPO, using hyperparameters tuned for the human rewards, and each final reward was trained with five PPO runs.
| Evaluation | Tasks | Result | Where it is reported |
|---|---|---|---|
| Overall | 29 tasks, 10 robot morphologies | Outperforms human rewards on 83 percent of tasks; average normalised improvement of 52 percent | Abstract |
| Isaac benchmark | 9 | Matches or exceeds human level on all tasks | Section 4.3 |
| Dexterity benchmark | 20 | Exceeds or matches human level on 15 of 20 tasks | Section 4.3 |
| Ablation: no reward reflection | Isaac | Average normalised score lower by 28.6 percent | Section 4.3 |
| Ablation: GPT-3.5 instead of GPT-4 | Isaac | Degrades, but matches or exceeds human level on most tasks | Section 4.3 |
| Pen spinning, fine-tuned after curriculum | Shadow Hand | Spins the pen for many cycles in a row | Section 4.3 |
| Pen spinning, from scratch or pre-trained only | Shadow Hand | Cannot complete a single cycle | Section 4.3 |
The paper also reports that Eureka improves steadily across its evolution iterations, and that a control which spends the same reward budget on 32 first-attempt samples, with no evolution, scores lower after two iterations of Eureka. So the gain comes from the iterative edits, not from sampling more.
Human-in-the-loop results are reported more qualitatively. Starting Eureka from a human reward gave rewards that beat both Eureka alone and the human reward on the chosen tasks. In a user study with 20 people, users preferred the policy trained on a reward that was edited from human reward reflection, which the paper describes as a large majority.
What they mean. Free-form reward code, written from the source of the environment, can match or beat expert design across a broad set of benchmarks, and the iterative loop is what drives the gains. The paper finds that Eureka rewards are mostly weakly correlated with the human rewards, and least correlated on the harder tasks, which suggests the model is finding reward structures the human did not write. The pen-spinning result shows the method can reach a skill that earlier reward design had not.
Limits. The benchmarks are simulated, and the policy learner is PPO with hyperparameters tuned on the human rewards, which favours the human baseline. The main backbone was GPT-4 at a fixed snapshot, and results with GPT-3.5 are lower. The benchmark tasks were released concurrently with or after GPT-4's knowledge cut-off, which the paper uses as evidence against memorisation. Finally, the paper evaluates against a single task fitness, and for tasks where that fitness is missing or misaligned, the human feedback route is a separate, less measured step.
Reading guide
The paper has a short introduction, a formal setting, a method with three parts, an experiments section, related work, a conclusion, and a long appendix. Read them in this order.
- Section 1, Introduction. Motivation, the reward design survey, and the three design choices. Needs Reinforcement Learning, Reward Shaping and Sparse Reward Problem. The sparse reward problem explains why shaping is needed in the first place.
- Section 2, Problem setting. The reward design problem and the reward generation problem. Needs Markov Decision Process and Policy (Reinforcement Learning).
- Section 3.1, Environment as context. How the environment code is passed to the model. Needs Language Model and In-Context Learning, because the method depends on the model reading code in its prompt.
- Section 3.2, Evolutionary search. Sampling candidates, selecting the best, and mutating it. Needs Genetic Algorithm and Evolution Strategies.
- Section 3.3, Reward reflection. The text summary of component values. Needs Reward Shaping.
- Section 4, Experiments. Baselines, training details, and the results. Needs Proximal Policy Optimization (PPO) for the learner and Curriculum Learning for the pen-spinning setup.
- Section 5, Related Work. Manual reward design, evolutionary reward search and inverse reinforcement learning. The paper contrasts Eureka with Inverse Reinforcement Learning, which learns rewards from demonstrations instead of writing them.
- Appendices. Appendix A has the full prompts and is the place to look if you want the exact wording. Appendix H discusses limitations.
Check yourself
QuestionWhy does Eureka sample many reward functions per round instead of one?Show answer
QuestionA round has three candidate rewards with fitness scores , and . Which one is kept, and what happens if the stored best so far is ?Show answer
QuestionWhy does the reflection report the values of individual reward components instead of only the fitness score?Show answer
QuestionUsing the normalised score formula, a method scores on a task where the sparse reward is and the human reward is . What is the normalised score, and is the method better than the human reward?Show answer
Sources
- Ma et al., Eureka: Human-Level Reward Design via Coding Large Language Models, arXiv:2310.12931: arxiv.org/abs/2310.12931
- DOI record: doi.org/10.48550/arXiv.2310.12931