Voyager

Voyager is a GPT-4 agent that plays Minecraft without end. It sets its own goals, writes code to reach them, and keeps every working program. It reaches iron tools 6.4 times faster than AutoGPT.

Pick an agent, then drag the iteration slider. Watch which tools the agent unlocks, and when. Then we build Voyager piece by piece: the goal-setter, the code, the debugging loop and the library of skills.

You need a feel for what a language model does (it reads text and writes the next text) and a little code reading. We build the rest from zero.

Paper by Guanzhi Wang, Yuqi Xie, Yunfan Jiang, Ajay Mandlekar, Chaowei Xiao, Yuke Zhu, Linxi “Jim” Fan and Anima Anandkumar (NVIDIA, Caltech, UT Austin, Stanford, UW Madison). Read it on arXiv 2305.16291 or the project page. This lesson is a reading for Week 5 of MAS.S62 AI4AI.

Race up the tech tree

0

The unlock points are Table 1 of the paper: mean prompting iterations over three runs, within a limit of 160. “Never” means 0 of 3 runs unlocked that level. Voyager reached diamond in 1 of 3 runs.

Chapter 0

A Game With No Goal

See why an agent that must keep learning forever breaks every method built for a fixed task

You spawn in a new Minecraft world. Your hands are empty. Nobody gives you a quest, a score or an ending. Trees stand to your left and a river runs to your right. What do you do first?

A human player knows. Punch a tree, collect wood and build a crafting table. Then make a pickaxe, dig for stone, and make a better pickaxe. Each step opens the next one. No one writes this order down. The player finds it by playing, and remembers it for the next world.

The Voyager paper asks a hard question. Can a program do the same? It must pick its own goals, learn from its own failures and keep what it learns. It must also get better each day, with nobody watching.

Three words in that question

An embodied agent is a program that acts inside a world and sees what its actions do. Think of a robot, or a game character, rather than a chatbot. Voyager’s body is a Minecraft player.

Lifelong learning means the agent keeps gaining skills over a long time and uses the old ones to learn the new ones. Think of a carpenter who never forgets how to cut a joint. The paper says earlier LLM agents were not lifelong learners: they could not progressively acquire, update and transfer knowledge.

Open-ended means the world has no final exam. Minecraft has no fixed end goal and no fixed story. Players explore a huge, randomly built 3D landscape and unlock a tech tree: a chain of tools where each tool needs an earlier tool to make. The chain runs wooden, stone, iron, diamond.

Why earlier methods fall short

Two older families of methods exist. In reinforcement learning (RL), an agent tries actions, gets a reward number, and slowly adjusts itself to earn more reward. In imitation learning, an agent copies recorded human play. Both work on primitive actions: move the mouse, press a key, one tiny step at a time.

The paper names three problems with that. Exploration is hard, because a random key press almost never makes a crafting table. Interpretability is poor, because nobody can read what a neural network decided. Generalisation is weak, because a policy trained in one place often fails in another.

A newer family uses a large language model (LLM), a program trained on huge amounts of text to predict the next word. An LLM already knows that wood comes before planks. Earlier LLM agents used this knowledge to write plans. But they treated each plan as a fresh start, and nothing they learned was kept.

Voyager keeps three promises that these methods could not. It proposes tasks that fit its current skill, so it explores on purpose. It saves every skill that works, so it can reuse it. And it needs no training of the model at all. It talks to GPT-4 through a plain text interface, a blackbox call: text goes in, text comes out, and the weights stay locked.

Why order matters: feel it first

Here is the idea behind the first of the three promises. In Minecraft, tasks depend on earlier tasks. You cannot mine iron before you own a stone pickaxe. You cannot smelt iron without a furnace and fuel. If an agent picks goals at random, it picks tasks it cannot do yet. Most attempts then fail.

See what a goal needs first

Each dot is one task. A line runs from a task to the tasks that need it. Pick a goal. The tasks you must finish first light up, and the rest stay grey.

The task graph follows the standard Minecraft recipes (a game rule, not a number from the paper). The paper’s own point is only the shape: later tasks need earlier ones. The ladder is simplified to 13 tasks.

Try the diamond. It has 12 tasks in front of it. If you pick one of the 13 tasks at random with no memory of progress, the chance of picking a doable next step is low early on. The paper tests this directly in Chapter 7: a random curriculum cuts the number of items found by 93%.

What Voyager is made of

Voyager has three parts, drawn in the paper’s Figure 2. The automatic curriculum is a goal-setter: it asks GPT-4 for the next task. The skill library is a memory: it stores every program that solved a task. The iterative prompting mechanism is a debugger: it writes code, runs it, reads what went wrong and tries again.

One design choice ties them together. The agent’s actions are code, not key presses. A program can say “mine three logs, then craft a table” in a few lines. That makes a skill something you can save, read, search and combine with other skills.

The paper tests Voyager in MineDojo, an open-source Minecraft research platform. It compares against ReAct, Reflexion and AutoGPT, three LLM agent methods. The headline result: 3.3 times more unique items, 2.3 times longer travel distance, and tech tree milestones up to 15.3 times faster than the best earlier method. The hero at the top of this page plays the last of those claims.

The road

  1. The loop: one pass through all three parts, with the data that moves between them.
  2. The automatic curriculum: how GPT-4 picks the next task, and the warm-up schedule.
  3. Code as the action space: why programs beat key presses, and what a skill looks like.
  4. Iterative prompting: three kinds of feedback and the four-round limit.
  5. The skill library: store by meaning, fetch the top five.
  6. The results: Table 1, Table 2 and the exploration figures, read closely.
  7. Ablations and limits: what each part is worth, and where Voyager breaks.
  8. Field guide: numbers, a checklist, the core code, and where to go next.

This paper is a reading for the lecture on harness engineering and multi-agent systems. That lecture treats Voyager as an agent that writes its own skill library. Here we open the paper itself.

Voyager never changes GPT-4’s weights. Where does its learning over time live?

Chapter 1

One Pass Through the Loop

Follow a single task from the goal-setter, through the code and the debugger, into the library

Your Voyager agent stands in a forest. Its backpack holds a few planks, some sticks, a crafting table and a wooden pickaxe. It has just finished its last task. What happens in the next few seconds, by text sent and text received?

Before the parts, learn the one tool they all use. A chat completion is a call to a language model: you send a list of messages and get one message back. Each message has a role. The system message sets standing rules. The user message holds the request. The assistant message is the model’s reply. To save tokens, Voyager does not hold a long conversation. It joins one system prompt and one user prompt, sends them, and reads one reply (paper, Appendix A.2).

Four roles, three models

Voyager runs four helpers. Each helper is a prompt, not a separate program. The curriculum agent proposes the next task. The action agent writes code for that task. The critic agent judges whether the task is done. The skill manager stores and fetches skills.

Three models serve them. GPT-4 (gpt-4-0314) runs the curriculum, the action agent and the critic. GPT-3.5 (gpt-3.5-turbo-0301) handles cheaper text jobs: it asks and answers helper questions, and it writes a short description of each new skill. An embedding model (text-embedding-ada-002) turns text into a list of numbers, so that texts with similar meaning get similar lists. Chapter 5 uses it.

The paper sets every temperature to 0, except the curriculum at 0.1. Temperature is the randomness dial of a language model: 0 means it always picks its most likely word. The curriculum gets a little noise so that its task choices vary.

The two loops

The paper gives the whole algorithm as pseudocode (Appendix A.1). Read it as two loops, one inside the other. The outer loop never ends. Each pass asks the curriculum for a task. The inner loop tries that task for at most four rounds. Each round makes one new program.

In each round, five things happen in order. The skill manager fetches skills that look useful. The action agent writes code, given the task, the last code, the last feedback and those skills. The environment runs the code. The critic reads the new state and says yes or no. On yes, the loop leaves. On no, the critic’s advice goes into the next round.

After the inner loop, the result is filed. A success adds the program to the skill library and the task to the completed list. A failure only adds the task to the failed list. The curriculum reads both lists the next time it proposes a task, so a failed task can come back later when the agent is stronger.

Walk one task end to end

The device below runs one task, “Craft 1 stone pickaxe”, through the loop. Press Step to move one stage at a time. The box under the diagram shows the text that moves at that stage.

Step through one task

The lit box is where the task is now. The arrow shows where its text goes next. Watch the round counter: a task gets four rounds at most.

The task and the prompt formats come from the paper (Figures 3, 5, 6 and Appendix A). This particular trace, with its inventory and its two rounds, is illustrative: it is written to show every stage, not copied from a real run.

Count the GPT-4 calls for this task: one for the task, two for code and two for the critic. That is five calls for a task that took two rounds. The cost is in these calls. Chapter 7 returns to that.

What each stage reads and writes

The data flow is simple, and every piece of it is plain text. Here is the full table. Nothing is a tensor: the only numbers that are vectors are the embeddings in the skill library.

StageReadsWrites
Curriculumagent state, completed and failed tasks, helper Q and Aone task, a short phrase such as “Craft 1 stone pickaxe”
Skill retrievalthe task, plus the last environment feedbackthe top 5 skills: five JavaScript programs
Action agenttask, last code, feedback, errors, critique, 5 skills, stateexplanation, plan, then one JavaScript function
Environmentthe codenew state, chat feedback lines, an error trace if any
Criticthe task and the new statesuccess true or false, and a critique
Skill managerverified codea vector entry: key is the embedding of a description, value is the code

One more point. Voyager keeps no memory inside the model between calls. Each prompt is built fresh from the state, the lists and the library. If a fact is not in the prompt, GPT-4 does not know it. That is why the paper works so hard on what goes into each prompt, and the next four chapters take those prompts apart.

The critic says the task failed in round 2. What does Voyager do next?

Chapter 2

The Automatic Curriculum

Learn how one prompt turns the agent’s situation into a task that is hard enough to teach and easy enough to finish

Two Voyager agents spawn. One stands in a forest. The other stands in a desert, with sand and cactus all around and not one tree in sight. Should they get the same first task? Obviously not. The forest agent should chop wood. The desert agent should harvest sand and cactus first, because that is what the desert gives.

The paper makes exactly this point in its introduction. A good goal depends on the world state and on the skills you already have. Who writes that goal? A person could write a fixed list. But a fixed list ignores where the agent is. It also needs Minecraft expertise and cannot adapt. Voyager asks GPT-4 instead.

Two ideas behind the goal-setter

A curriculum is an ordered list of lessons that go from easy to hard, the way a school teaches counting before algebra. An automatic curriculum writes that list on the fly. The paper wants a task that is challenging but manageable: too easy teaches nothing, too hard just fails.

Novelty search is an older idea: instead of chasing one fixed reward, an agent chases things it has not done before. Voyager’s overall goal is a single sentence in the prompt: discover as many diverse things as possible. The paper calls the result an in-context form of novelty search. The memory of what is new lives in the prompt as a list of finished tasks, not in a trained network.

What goes into the prompt

The curriculum prompt has five parts (paper Section 2.1 and Appendix A.3). Part one is the directives: the standing rules. Part two is the agent’s state. Part three is the lists of completed and failed tasks. Part four is extra context from a helper. Part five asks for chain of thought: GPT-4 must write its reasoning first, then the task.

The state is a block of plain text. It holds the inventory: item names and counts, such as {'oak_planks': 3, 'stick': 4}, out of 36 slots. It also holds the equipment and the nearby blocks and creatures within 32 blocks. The rest is the biome, the time of day, the health and hunger bars (maximum 20) and the 3D position.

The directives are blunt and specific. Act as a mentor. Name the exact resources. Use a short format such as “Mine [quantity] [block]” or “Craft [quantity] [item]”, and give one task only. Do not make the task too hard. Make it novel. Do not ask to build a shelter. And avoid any task that needs the screen to verify, such as placing torches or digging a 2 by 1 by 2 hole. Voyager has no vision, so a task it cannot check in text is a task it cannot learn from.

The helper in part four uses GPT-3.5. It self-asks: it writes questions about the current state, for example about what a biome offers, and it answers them. Each question comes with a concept. That concept fetches a page from the Minecraft wiki knowledge base, and GPT-3.5 reads the page to answer. The paper says the wiki is optional, because GPT-3.5 already knows the game. The wiki helps for domains the model was not trained on. The paper uses GPT-3.5 here for budget reasons.

Four tasks from the paper

Figure 3 of the paper shows GPT-4 answering from different states. Read each row as: this situation, this reasoning, this task.

SituationGPT-4’s reasoning, shortenedTask
Biome river; has a fishing rodNear a river with a rod: a chance to catch fish for food and experience.Catch 1 fish
Hunger 0; pigs nearbyHunger is at 0, so find food. Pigs are close.Kill 1 pig
Has raw iron, coal and a furnaceSmelt the iron into ingots for better tools and armor.Smelt 4 raw iron
Night; zombie near; has stone sword and shieldGood moment to fight a zombie with this gear.Kill 1 zombie

Every task here is something the agent can do right now with what it holds. None of them says “build a house” or “find diamonds”. That is the design working. The next task follows from the current state.

The warm-up schedule

Giving GPT-4 every field from the first minute has a cost. With an empty inventory, a long state block is mostly noise, and the paper wants the agent to start with basic skills. So Voyager uses a warm-up schedule: it adds fields to the prompt as the agent completes more tasks (Appendix A.3.3, Table A.1).

At the start only four fields appear: a short core inventory (log, planks, stick, crafting table, furnace, dirt, coal, pickaxe, sword and axe), equipment, nearby blocks and position. After 5 completed tasks nearby entities join. After 7 the full inventory joins. After 10 come recently seen blocks and the biome. After 15 come the health bar, the hunger bar, the time and the extra context.

Work the first call by hand. The agent has completed 0 tasks, so the prompt shows the core inventory, equipment, nearby blocks and position. The inventory is empty, trees are nearby. The paper’s own sample reply reads: “Reasoning: The inventory is empty now, chop down a tree to get some wood. Task: Obtain a wood log.”

Grow the prompt with experience

Each row is one field of the state block. Drag the number of completed tasks and watch the prompt gain fields at the thresholds in Table A.1.

0

The 12 fields and their thresholds are Table A.1 of the paper. The directives and the lists of completed and failed tasks are always in the prompt, so they are not rows here.

The paper does not report an ablation of the warm-up on its own, so we cannot say how many items it adds. What the paper does show is that the whole curriculum matters. A random curriculum cuts the discovered items by 93%, and a hand-written one falls short too (Chapter 7).

When the goal-setter is wrong

Here is the failure, in three steps. Symptom: the curriculum sometimes asks for something that does not exist. The paper gives “craft a copper sword” and “craft a copper chestplate”. No such items are in the game. Measurement: the paper reports this as an occasional hallucination and gives no rate. Fix: the loop copes. The action agent cannot finish the task in four rounds, so the task goes to the failed list. The prompt then tells GPT-4 about failed tasks that are too hard, and the curriculum may try the task again later.

Why does Voyager put the list of completed and failed tasks into the curriculum prompt?

Chapter 3

Code as the Action Space

See why Voyager writes programs instead of key presses, and how a saved program grows from smaller ones

Suppose you want a robot to fetch three iron ingots. You could send it a tape of tiny commands: turn left 4 degrees, walk forward one tick, swing the pickaxe, walk forward again. Thousands of lines, and not one of them says what it is for. Or you could hand it a short note: find iron ore, mine it, smelt it, repeat until you hold three. The second way is how people think. It is also how Voyager acts.

The set of things an agent is allowed to do is its action space. Classical RL and imitation methods use a tiny action space: a key, a mouse move. Voyager’s action space is code: GPT-4 writes a JavaScript function, and the game runs it. The paper gives three reasons. A program can describe actions that last a long time (temporally extended). It can be read by a person (interpretable). And it can call other programs (compositional).

The body: Mineflayer and the control primitives

Mineflayer is an open-source JavaScript library that lets a script control a Minecraft player, called bot. It handles the low-level motor control: pathfinding, digging, placing. Voyager does not use screen pixels. It calls Mineflayer’s high-level functions, and the paper says plainly that this is why a fair comparison with pixel-based agents such as VPT is not possible. Its stated focus is to push the limits of GPT-4 for lifelong learning, not to solve vision or fine motor control.

The authors add their own layer on top, eight control primitives. Each one wraps many Mineflayer calls and many safety checks:

  1. exploreUntil(bot, direction, maxTime, callback): walk in one direction until a stop test passes.
  2. mineBlock(bot, name, count): mine and collect blocks within 32 blocks.
  3. craftItem(bot, name, count): craft an item at a nearby crafting table.
  4. placeItem(bot, name, position): put a block down.
  5. smeltItem(bot, itemName, fuelName, count): smelt in a nearby furnace.
  6. killMob(bot, mobName, timeout): attack a creature and collect its drops.
  7. getItemFromChest and depositItemIntoChest: move items to and from a chest.

These functions also talk back. The authors put bot.chat() calls inside them, so a failed craft prints a sentence such as “I cannot make stick because I need: 2 more planks”. That sentence is the environment feedback of Chapter 4. They also added condition checks and try-catch blocks so a script can run to the end. If the bot dies, it respawns near the closest ground and keeps its inventory. After a program runs, the bot picks up its crafting table and furnace again.

The prompt for writing code

The action agent’s prompt has five parts (Section 2.2, Appendix A.4). Part one holds guidelines. Part two lists the control primitive APIs and the retrieved skills; showing working code is what lets GPT-4 learn the pattern in context, with no training. Part three carries the last round: the previous code, the feedback, the errors and the critique. Part four is the agent state. Part five asks for chain of thought.

The reply has a fixed shape. Explain says why the last code failed. Plan lists the steps. Code gives one async function that takes bot as its only argument. Asking for reasoning before code is the same trick as in the curriculum: the plan steers the code.

The guidelines teach good habits. Use the primitives, not raw calls: write mineBlock and not bot.dig. Never loop forever. Do not register event listeners. Use exploreUntil with a random direction when something is out of sight. Keep maxDistance at 32 for block searches, and the prompt says “Do not cheat”. Name the function after the task.

One guideline carries the whole idea of the library: “Your function will be reused for building more complex functions. Therefore, you should make it generic and reusable.” The prompt adds that the function must not assume what is in the inventory, because the inventory may differ later. If the function needs items, it should first collect them.

A skill is a function that calls functions

Here is what such a skill might look like. This code is our own illustration in the paper’s style, not a function copied from the paper. It checks the inventory first, calls two other skills, and uses a primitive.

javascript// illustrative skill, written in the style the prompt asks for
async function craftIronPickaxe(bot) {
  const have = bot.inventory.count(mcData.itemsByName.iron_ingot.id);
  if (have < 3) {
    await smeltIronIngots(bot, 3 - have);   // an earlier skill, fetched from the library
  }
  await craftSticks(bot, 2);                 // another earlier skill
  await craftItem(bot, "iron_pickaxe", 1);   // a control primitive
  bot.chat("Crafted an iron pickaxe");
}

The recipe in the comment is the one the paper’s Figure 4 mentions: an iron pickaxe needs 3 iron ingots and 2 sticks. Look at what is missing. There is no code for finding iron, no code for building a furnace. That work lives in smeltIronIngots, which was written earlier, tested earlier, and is fetched into the prompt now.

This is why the paper says skills compound. A new skill is short because it stands on old ones. The device below lets you feel that. Switch skills on and off in the library and see how many lines GPT-4 must write for the iron pickaxe.

Count the lines you must write

Purple skills are in the library, so calling one costs a single line. Pink skills are not, so GPT-4 must write them. Tap a skill to move it in or out of the library.

The skill tree and the line counts (6, 9, 7, 5, 4, 4, 4) are illustrative round numbers, chosen to show the effect. The paper reports no line counts. The point is the arithmetic of reuse.

With an empty library, the toy needs 39 lines. With every helper saved, it needs 8. Real Minecraft skills are longer, so the gap is bigger in practice. The shape is the same: each saved skill shrinks the next one.

The code prompt tells GPT-4 not to assume what is in the inventory. What is the reason?

Chapter 4

Iterative Prompting: Three Kinds of Feedback

Follow a broken program through the debugger and see which signal fixes which bug

GPT-4 is asked to craft an axe. It writes await craftItem(bot, "acacia_axe", 1) and the game answers with an error: No item named acacia_axe. There is no acacia axe in Minecraft. The model made up an item that sounds right.

A human programmer would read the error, see the mistake and write a wooden axe instead. Voyager does exactly this, on purpose. The paper starts from a plain fact: LLMs find it hard to write correct action code in one try. So Voyager does not ask for one try. It runs the code, gathers what went wrong, and shows the model the evidence.

Three signals

Environment feedback is text the game itself prints while the program runs. The authors wrote the control primitives to call bot.chat() at the right moments. A craft that lacks materials says what is missing, for example “I cannot make an iron chestplate because I need: 7 more iron ingots”. This tells GPT-4 the cause of a failure that would otherwise be silent.

Execution errors come from the JavaScript interpreter. They show invalid operations and syntax mistakes. They name the line: “at line 18: await craftItem(bot, "acacia_axe", 1)”. They are valuable for bug fixing, because they point at the exact code to change.

Self-verification checks whether the task is done. This is the new idea. The obvious design is to hand-write a success checker for each task, such as “does the inventory hold a stone pickaxe?” But the curriculum invents new tasks forever, and nobody can code a checker for each. So Voyager starts a second GPT-4 as a critic. It receives the agent’s state and the task. It replies with a verdict and, on failure, a critique that says how to finish.

The paper calls this more comprehensive than self-reflection (as in Reflexion). A self-reflection step only thinks about mistakes. The critic does that, and also decides whether the task is complete, which is what lets the loop stop.

The critic at work

Figure 6 of the paper shows four verdicts. The critic reads the inventory, so its judgement is only as good as the inventory text. Read the sheep case slowly, because it shows the reasoning pattern.

  1. Task: “Kill 3 sheep”.
  2. State: 2 white_wool and 6 mutton in the inventory.
  3. Reasoning: that stock means 2 sheep were killed. The task needed 3.
  4. Verdict: Success False.
  5. Critique: “Find and kill one more sheep to complete the task.”

The other three examples go the same way. “Mine 5 coal ores” with 5 coal in the inventory is a success. “Craft a spyglass” fails because the agent has 3 copper ingots but no amethyst shard, so the critique is to find and mine one underground. “Kill 1 zombie” succeeds because 1 rotten flesh sits in the inventory. In each case the evidence is an item count.

The round limit

The loop repeats until the critic says yes. But it cannot repeat forever. The paper caps it: if the agent is stuck after 4 rounds of code generation, the curriculum is asked for a different task. The stuck task joins the failed list. A task that fails does not hurt for long, because it costs at most four iterations.

Try the device below. It models a bug in three tasks, each of which only one signal can find easily. Switch the signals on and off and see how many rounds the loop needs.

Repair a buggy program

Pick a task, then switch signals on or off. The four cells are the four rounds. Pink-red means the code still has its bug. Green means fixed.

The three signal texts are from the paper’s Figures 5 and 6 where the paper shows them. The repair rule is a toy: the matching signal fixes the bug in round 2, the critic alone can fix the first two in round 3, and with no critic the loop cannot stop early. It illustrates the mechanism, not a measured rate.

Three lessons fall out of the toy. A signal helps only for bugs it can see: a clean run says nothing about a missing sheep. The critic is the only signal that can see every kind of bug, because it reads the final state. And without the critic the loop cannot tell “fixed” from “still broken”, so it wastes rounds or stops too late.

The paper’s ablation agrees. Removing self-verification costs 73% of the discovered items, the worst drop among the feedback types (Chapter 7). The critic also decides when to move on, so without it the agent cannot reliably leave a finished task.

Where the critic is wrong

The paper is honest about this. Symptom: the critic sometimes fails a task that was done. Its example is the string a spider drops: the critic did not accept spider string as proof that the agent beat a spider. Measurement: the paper reports it as an occasional failure with no rate. Fix: the loop still protects the library, since a skill is only saved after a yes. A false no wastes iterations. A false yes would save a wrong skill, which is why the critic matters so much.

A program for “Kill 3 sheep” runs with no error and prints nothing odd, but kills only 2 sheep. Which signal can catch this?

Chapter 5

The Skill Library

Store every working program by what it does, and fetch the five that best fit the next task

Imagine a shelf of 500 recipe cards in a kitchen. You want something with eggs and cheese. You do not know the card titles. You would not read all 500. You would ask a friend who knows the shelf, and the friend would hand you the five cards closest to what you want.

That is the skill library. After 60 skills, the prompt cannot hold every program. After 200, it surely cannot. So Voyager must search by meaning, not by name, and it must do so on every round.

Meaning as numbers: embeddings

An embedding is a list of numbers that stands for the meaning of a text. A model turns each text into a list, and it is trained so that texts with similar meaning get similar lists. Voyager uses OpenAI’s text-embedding-ada-002. That model returns a vector of 1,536 numbers per text. (The size is a known property of that model, not a figure from the paper.)

To compare two lists, take the angle between them. Two lists that point the same way are alike. Two that point in different directions are not. The standard measure is cosine similarity.

cos(a, b)
The similarity of the two lists. It is 1 when they point the same way, 0 when they are unrelated, and negative when they point apart.
a · b
The dot product: multiply the lists number by number, then add up the results.
‖a‖ ‖b‖
The length of each list: the square root of the sum of its squared numbers. Dividing by both lengths removes size and keeps only direction.

a = (3, 1), b = (2, 2): a · b = 3×2 + 1×2 = 8; length of a = √10 = 3.162; length of b = √8 = 2.828; cos = 8 / (3.162 × 2.828) = 0.894 (a small two-number example)

Adding a skill

The library is a vector database: a store of key-value pairs where the key is an embedding and lookup means “find the nearest keys”. The paper’s Figure 4 (top) shows the add path in four steps.

  1. Verified program: the critic said yes, so the code is trustworthy.
  2. Describe it: GPT-3.5 reads the code and writes a short description of at most six sentences. It must not mention the function name or bot.chat.
  3. Embed the description: text-embedding-ada-002 turns the description into the key, a list of numbers.
  4. Store: the key points to the program itself, the value.

Why index by a description and not by the code? The paper does not explain, but the reason is plausible. A search will start from a plain-language task, such as “craft an iron pickaxe”. A plain-language description sits near that query in meaning. Code does not.

Fetching skills

The retrieval path is Figure 4 (bottom). A bare task name is a short query, so Voyager enriches it. First GPT-3.5 writes a general suggestion for solving the task, for instance an answer to “How to craft an iron pickaxe in Minecraft?” Then the suggestion is joined with the current environment feedback. This text is embedded, and the database returns the top 5 nearest skills. Those five programs go into the action agent’s prompt.

Feedback is in the query on purpose. In round 2, the chat log may say “I need: 2 more planks”. That sentence pulls in a plank-crafting skill that the first query would not have found. So retrieval gets sharper as the debugging goes on.

Fetch the top skills

Each bar is the cosine similarity between the task query and one stored skill. The skills above the line are the ones that go into the prompt. Pick a task, then drag the number of skills to fetch.

5

The skills and the four-number vectors are a toy: the numbers stand for wood, mining, fire and combat. Real keys have 1,536 numbers. The accuracy figures in the read-out are Table A.4 (309 samples, top-5 stated as 96.5%). The paper’s table text came out scrambled in extraction, so the other columns are placed in rising order.

Now the paper’s own measure. On 309 retrieval samples, the right skill appears in the top 1 about 80.2% of the time, in the top 3 about 93.2%, and in the top 5 about 96.5%. That is why the prompt takes five: it catches the right skill in all but about 3.5 cases in 100, at a fixed prompt size.

Why this solves forgetting

In ordinary continual learning, a network learns task B and loses task A. This is catastrophic forgetting: new gradient steps overwrite old weights. Voyager sidesteps it. Skills are files in a database. Adding a skill never edits another one. The weights of GPT-4 never change at all.

The library also transfers. Table 2 of the paper (Chapter 6) hands the finished library to AutoGPT, a different agent, and AutoGPT improves. The paper calls the library a plug-and-play asset. In a brand new Minecraft world with an empty inventory, Voyager uses the saved skills to solve new tasks from scratch.

Why does the retrieval query add the latest environment feedback to the task text?

Chapter 6

Reading the Results

Check what each table and figure actually measures, and do the arithmetic behind the headline numbers

A paper says “15.3 times faster”. Faster than what, measured how, over how many runs? Before we trust a headline, we ask these three questions. This chapter answers them for Voyager, one result at a time.

The set-up

All agents run in MineDojo, an open-source Minecraft framework, with Mineflayer for motor control. Voyager uses gpt-4-0314 for the main work, gpt-3.5-turbo-0301 for cheap text jobs and text-embedding-ada-002 for embeddings. All temperatures are 0, except the curriculum at 0.1. Each method runs three trials. Every number below is an average over only three runs, so treat small gaps with care.

There was no LLM agent for Minecraft that worked out of the box, so the authors built three baselines, and each is a re-interpretation of a method made for text tasks.

For all three baselines, the task is the same sentence: explore the world and get as many items as possible. ReAct and Reflexion write code once from scratch and then refine it three times, and repeat. A baseline that gets the same feedback as Voyager but lacks a curriculum is the fair test of the curriculum.

The authors do not compare with pixel-input agents such as VPT. Those agents use screen pixels and low-level controls, while Voyager calls a high-level API. The paper calls that comparison not apples to apples.

Four evaluations

Exploration (Figure 1) counts unique items collected as the number of prompting iterations grows. Voyager finds 63 unique items within 160 iterations, 3.3 times more than the best baseline. The appendix lists every item in every trial. Counting them gives Voyager 63, 58 and 67 (mean 62.7); ReAct 4, 4 and 2; Reflexion 5, 5 and 5; AutoGPT 11, 22 and 25 (mean 19.3). The ratio of means, 62.7 divided by 19.3, is about 3.2 to 3.3.

Tech tree mastery (Table 1) records how many iterations each agent needs to first unlock wooden, stone, iron and diamond tools, with a limit of 160. Map coverage (Figure 7) draws the smallest circle around each agent’s path. Voyager covers 2.3 times the distance of the baselines, crossing different biomes, while the baselines stay near where they started. Zero-shot generalisation (Table 2, Figure 8) wipes the inventory, puts the agent in a new world and gives four unseen tasks with a limit of 50 iterations.

For the last test, both Voyager and AutoGPT get GPT-4 to break the task into subgoals first. This matters: Voyager’s advantage there comes from the library and the debugging loop, not from better planning.

Do the arithmetic yourself

Table 1 gives mean iterations to first unlock. The paper’s speed-up claims are plain divisions of AutoGPT’s number by Voyager’s:

wooden: 92 / 6 = 15.3  ·  stone: 94 / 11 = 8.5  ·  iron: 135 / 21 = 6.4

ReAct and Reflexion are not in the division, because they unlocked no level at all in any run. Only Voyager ever reached diamond, and only in 1 of 3 runs, at 102 iterations. So the diamond result is real but thin: one run.

One more detail hides in the spread. AutoGPT’s wooden time is 92 ± 72. The ± is the standard deviation across three runs, so its runs ranged very widely. Voyager’s is 6 ± 2. Voyager is faster and also steadier.

Compare the methods

Pick a table and a column. Each bar is the mean number of prompting iterations to first success. Shorter is better. A dashed empty bar means 0 of 3 runs got there in time.

All values are from Tables 1 and 2 of the paper: mean iterations over three runs, with the run count that succeeded. Whiskers show one standard deviation where the paper gives one.

What the second table adds

Look at the row “AutoGPT with our skill library”. Plain AutoGPT solves nothing in 50 iterations. Given Voyager’s finished library, it solves three of the four tasks in at least one run. The library is a reusable asset, not a trick tied to one agent. But Voyager still beats it everywhere: the debugging loop and the curriculum matter as well.

Now look at “Voyager without skill library”. It solves all four tasks in all three runs (except the diamond pickaxe, 2 of 3). But it needs more iterations, such as 36 against 19 for the diamond pickaxe. Without a library, each new task starts from scratch. With one, the new task stands on old skills.

Table 1 shows a hint of the same effect. Without the library, Voyager is nearly as fast at wooden (7 against 6) but slower at iron (29 against 21), and it never reaches diamond. The gap opens as tasks get deeper, because deeper tasks have more old skills to reuse.

Why can the claim “Voyager is the only method to unlock the diamond level” not be read as “Voyager reliably mines diamonds”?

Chapter 7

What Each Part Is Worth, and Where It Breaks

Remove one part at a time to see what it buys, then read the limits the authors admit

Suppose a cake is delicious and has six ingredients. Which one matters most? The only fair way to know is to bake six more cakes, each missing one ingredient, and taste them. An ablation study does this for a system. You remove or swap one part, keep everything else fixed, and measure the drop.

The Voyager authors ablate six design choices (Section 3.4, Appendix B.3). They measure the same thing as in Figure 1: how many unique items the agent finds in 160 prompting iterations.

The six variants

  1. Manual curriculum: a fixed list of 10 tasks that a person wrote for mining a diamond. It starts with mine 3 wood logs, craft a crafting table and craft a wooden pickaxe.
  2. Random curriculum: the authors take the 101 items Voyager found in its runs and pick one at random as the next task.
  3. No skill library: retrieval is removed, so the code prompt has no old skills.
  4. No environment feedback: the chat log is left out of the code prompt.
  5. No execution errors: the interpreter’s error trace is left out.
  6. No self-verification: no critic. The program is refined for a fixed three rounds (four code generations in all).
  7. GPT-3.5 for code: GPT-3.5 writes the code, while GPT-4 still runs the curriculum and the critic.

That is seven rows for six design choices, because the curriculum has two replacements. Every variant keeps the rest of Voyager unchanged.

What the text reports

The paper states four findings in words, and shows the rest as curves in Figure 9. We can only quote numbers that appear in the text, so here they are.

The text gives no number for removing environment feedback or execution errors alone. Figure 9 (right) shows those curves, and the caption says Voyager beats every alternative, which highlights the significance of each feedback type. We will not guess numbers the text does not give.

Turn the percentages into items

A percentage is easier to feel as a count. Voyager finds about 63 items. Work each case out by hand, treating the percentage as applying at the end of the 160 iterations.

random curriculum: 63 × (1 − 0.93) = 63 × 0.07 = 4.4  ·  no self-verification: 63 × (1 − 0.73) = 63 × 0.27 = 17.0  ·  GPT-3.5: 63 / 5.7 = 11.1

Compare these with the baselines of Chapter 6. A Voyager with a random curriculum finds about 4 items. That is on the level of ReAct, which found 2 to 4 (and below Reflexion’s 5). Most of the 63 comes from the three loops working together, not from GPT-4 alone.

Remove a part

Choose a part to take away. The top bar is full Voyager. The bar below it is Voyager without that part.

The 93%, 73% and 5.7 times are quoted in the text of Section 3.4. The item counts are our arithmetic on 63 items, not numbers the paper prints. For the library the paper gives no figure in words, only a plateau in Figure 9, so no bar is drawn.

The limits the authors state

Cost. The GPT-4 API is 15 times more expensive than GPT-3.5. Yet Voyager needs GPT-4: the ablation shows GPT-3.5 and open-source models do not give the same code quality. Each task also needs several GPT-4 calls (Chapter 1), so cost grows with every task.

Inaccuracy. The agent still gets stuck and fails to make the right skill. The curriculum can retry the task later. The critic can also err, as with the spider string of Chapter 4.

Hallucination. Symptom: GPT-4 sometimes uses cobblestone as furnace fuel, but cobblestone is not a valid fuel. It also calls functions that are not in the supplied API. Measurement: both show up as execution errors or as chat feedback, and the paper reports them without a rate. Fix: the debugging loop. The error enters the next prompt, and the next round usually corrects the call.

No vision. The GPT-4 API at the time of writing was text-only. Voyager cannot see a house it has built. The authors show that a human can fill the gap, in two ways (Section 3.5, Figure 10). As a critic, a person looks at the structure and gives visual critique. As a curriculum, a person splits a big build into small steps. With either, Voyager built a Nether portal and a house.

Small samples and one model family. Every figure rests on three trials. The authors also re-ran with gpt-4-0613 and found roughly the same performance (Figure A.4), so the result does not hang on one model snapshot.

With a random curriculum, Voyager’s item count falls by 93%. What is the paper’s explanation?

Chapter 8

Field Guide

Keep the numbers, the terms and the core code on one page, and see where Voyager sits in the field

Voyager is three small ideas joined by one loop. A curriculum asks GPT-4 for a task that fits the current state. A critic and two other feedback signals debug the code that GPT-4 writes for that task. A skill library keeps every verified program, indexed by meaning, so the next task starts on old ground. No weights change. The learning lives in text and in saved code.

The numbers to remember

WhatNumberWhere it comes from
Unique items in 160 iterations63 (3.3× the best baseline)Figure 1, Section 3.3
Wooden tool unlock6 vs 92 iterations: 15.3×Table 1, against AutoGPT
Stone tool unlock11 vs 94: 8.5×Table 1
Iron tool unlock21 vs 135: 6.4×Table 1
Diamond tool unlock102 iterations, 1 of 3 runs, only VoyagerTable 1
Distance travelled2.3× the baselinesFigure 7
Unseen tasks, new world, 50 iterations4 of 4 solved: 19, 18, 21, 18 iterationsTable 2
Rounds per task4 at mostSection 2.3, Appendix A.1
Skills fetched per round5 (top-5 retrieval accuracy 96.5%)Figure 4, Table A.4 (309 samples)
Warm-up thresholds0, 5, 7, 10, 15 completed tasksTable A.1
Random curriculum−93% itemsSection 3.4
No self-verification−73% itemsSection 3.4
GPT-4 vs GPT-3.5 for code5.7× more itemsSection 3.4
GPT-4 price vs GPT-3.515× moreSection 4

The terms

TermPlain meaning
Embodied agentA program that acts inside a world and sees the effect.
Automatic curriculumGPT-4 proposes the next task from the state and the lists of done and failed tasks.
In-context novelty searchSeeking new things, with memory of what is old kept in the prompt.
Control primitiveA safe wrapper such as mineBlock that GPT-4 calls instead of low-level commands.
SkillA verified JavaScript function, stored with an embedding of its description.
Environment feedbackSentences the game prints through bot.chat while the code runs.
Execution errorThe interpreter’s error trace, with a line number.
Self-verificationA second GPT-4, the critic, judges success from the state and gives a critique.
Prompting iterationOne round of prompting GPT-4 for code. The paper’s unit of cost.
Zero-shot generalisationSolving unseen tasks in a new world with no extra training.

The core as code

This is our condensed Python rendering of the paper’s pseudocode (Appendix A.1), plus the skill manager of Chapter 5. The names of the helpers are the paper’s. The bodies are left to the model calls described in this lesson.

pythonimport numpy as np

class SkillManager:
    def __init__(self, embed, describe):
        self.embed, self.describe = embed, describe      # ada-002, and a GPT-3.5 call
        self.keys, self.code = [], []                    # keys: N x 1536, code: N programs

    def add_skill(self, program):
        self.keys.append(self.embed(self.describe(program)))
        self.code.append(program)

    def retrieve_skills(self, task, feedback, k=5):
        hint = self.describe_task(task)                  # GPT-3.5: how to solve this task
        q = self.embed(hint + "\n" + (feedback or ""))
        K = np.array(self.keys)
        sim = K @ q / (np.linalg.norm(K, axis=1) * np.linalg.norm(q))   # cosine
        return [self.code[i] for i in np.argsort(-sim)[:k]]

def voyager(env, curriculum, actor, critic, skills):
    state = env.reset()
    while True:
        progress = curriculum.exploration_progress()     # done and failed task lists
        task = curriculum.propose_next_task(state, progress)
        code = feedback = errors = critique = None
        ok = False
        for _ in range(4):                              # at most four rounds
            top5 = skills.retrieve_skills(task, feedback)
            code = actor.generate_code(task, code, feedback, errors, critique, top5)
            state, feedback, errors = env.step(code)     # run it in Minecraft
            ok, critique = critic.check_task_success(task, state)
            if ok: break
        if ok:
            skills.add_skill(code); curriculum.add_completed_task(task)
        else:
            curriculum.add_failed_task(task)

Check your build plan

To re-implement Voyager you need eight pieces. Tap each piece once you could build it from this lesson. The bar fills as you go.

This checklist is ours, drawn from Sections 2 and 3 and Appendices A and B of the paper. Your ticks are not saved.

The checklist

  1. Environment: control primitives that call bot.chat for feedback, with try-catch and respawn.
  2. Curriculum prompt: directives, state, done and failed lists, self-ask context, warm-up, temperature 0.1.
  3. Action prompt: guidelines, API list, five skills, last code, feedback, errors, critique, state, reasoning first.
  4. Critic prompt: task and state in, success and critique out.
  5. Skill manager: describe, embed, store, then retrieve the top 5 by cosine.
  6. Loop: four rounds at most; success adds a skill, failure adds a failed task.
  7. Evaluation: three trials, unique items, tech tree iterations, a new world with an empty inventory.
  8. Ablations: random curriculum, no critic, no library, a weaker model.

Where it sits in the field

The paper places Voyager between two groups. Minecraft learners with low-level control use hierarchical RL and demonstration videos (VPT, MineDojo’s own agents) or learn a world model (DreamerV3). LLM planners split a task into subgoals along the recipes (DECKARD, DEPS, Plan4MC) and so lack free exploration. Voyager is the only one in the paper’s Table A.2 with an automatic curriculum, iterative planning and a skill library together, and it needs no gradient update.

Outside Minecraft, Code as Policies and ProgPrompt also let an LLM write executable robot policies. Inner Monologue feeds environment feedback back to an LLM. Voyager joins these two threads and adds the two long-term parts: the curriculum and the library.

Keep going

The takeaway. Voyager gets better at Minecraft without changing a single weight. The curriculum keeps each task reachable. The three feedback signals turn a first draft into working code. The library turns working code into ground for the next task. Remove any one and the others stall.

Now press Present or Teach and explain one full pass of the loop from memory: the task, the five skills, the code, the feedback, the verdict and the saved skill. Then go back to the race at the top, pick AutoGPT and Voyager in turn, and say aloud which of the three parts explains each gap.

Credit: Voyager is by Guanzhi Wang, Yuqi Xie, Yunfan Jiang, Ajay Mandlekar, Chaowei Xiao, Yuke Zhu, Linxi “Jim” Fan and Anima Anandkumar. All numbers in this lesson come from their paper unless marked illustrative.

Which statement about Voyager’s learning is correct?
Voyager: An Open-Ended Embodied Agent with Large Language Models
Read the paper · Project page · The lecture this paper belongs to