Eureka: Human-Level Reward Design via Coding Large Language Models
TL;DR GPT-4 writes RL reward functions as code from the environment's source, then rewrites them over several rounds using training statistics as feedback. Across 29 IsaacGym tasks the rewards beat expert human rewards on 83% of tasks, and with a curriculum they teach a simulated Shadow Hand to spin a pen.
What they do
Reward design for RL is mostly manual trial and error. Eureka hands it to a coding LLM (GPT-4): given the environment’s source code and the task description, it writes the reward as Python, trains policies on it and keeps improving it, with no task-specific prompts, reward templates or few-shot examples. It is evaluated on 29 IsaacGym tasks over 10 robots, including all 20 bimanual Shadow Hand tasks of the Dexterity benchmark.
How it works
- Environment as context. A script extracts the observation code that exposes the state variables; the LLM writes a reward over them and returns its components as a dictionary.
- Evolutionary search. Each iteration samples 16 reward candidates, trains a PPO policy on each in GPU-parallel IsaacGym, and mutates the best one. 5 iterations, 5 independent restarts per task.
- Reward reflection. The feedback prompt lists each reward component and the task metric at training checkpoints, so the LLM can edit the terms that are not being optimized.
- Human input. A human reward can seed the first iteration, or a person’s text feedback can replace the automatic reflection.
Results
- Eureka beats expert human rewards on 83% of the 29 tasks, an average normalized improvement of 52%. It matches or exceeds human level on all Isaac tasks and 15 of 20 Dexterity tasks; L2R lags behind on high-dimensional tasks.
- Dropping reward reflection lowers the average normalized score on Isaac tasks by 28.6%. Sampling 32 first-try rewards without evolution scores below Eureka after 2 iterations.
- Pen spinning: pretraining on random pen reorientation, then fine-tuning on spinning waypoints, spins the pen for many cycles in a row; the pretrained-only and from-scratch policies complete none.
- Starting from the human reward beats both Eureka and Human on every Dexterity task tested.
Limitations
Results are in simulation (one preliminary real-robot hopping experiment aside), on one simulator and one RL algorithm whose hyperparameters were tuned for the human rewards. Eureka needs a task fitness function that humans can write down; behaviors like a stable gait need human text feedback instead.
Videos
Figures



Abstract
Large Language Models (LLMs) have excelled as high-level semantic planners for sequential decision-making tasks. However, harnessing them to learn complex low-level manipulation tasks, such as dexterous pen spinning, remains an open problem. We bridge this fundamental gap and present Eureka, a human-level reward design algorithm powered by LLMs. Eureka exploits the remarkable zero-shot generation, code-writing, and in-context improvement capabilities of state-of-the-art LLMs, such as GPT-4, to perform evolutionary optimization over reward code. The resulting rewards can then be used to acquire complex skills via reinforcement learning. Without any task-specific prompting or pre-defined reward templates, Eureka generates reward functions that outperform expert human-engineered rewards. In a diverse suite of 29 open-source RL environments that include 10 distinct robot morphologies, Eureka outperforms human experts on 83% of the tasks, leading to an average normalized improvement of 52%. The generality of Eureka also enables a new gradient-free in-context learning approach to reinforcement learning from human feedback (RLHF), readily incorporating human inputs to improve the quality and the safety of the generated rewards without model updating. Finally, using Eureka rewards in a curriculum learning setting, we demonstrate for the first time, a simulated Shadow Hand capable of performing pen spinning tricks, adeptly manipulating a pen in circles at rapid speed.
Summaries are written automatically from each paper's text. Figures and videos come from the paper and its project page; all credit goes to the authors.
