⚡️Factorio Learning Environment: the ultimate Game Agent Eval — Jack Hopkins
Watch the full show on YouTube: https://www.youtube.com/watch?v=UySWl-3LfKg
27 Apr 2025 · 30:12 · transcript: transcribed · original
Claims
In the order they were said
“I played Factorio for years, and about 18 months ago I was looking into this idea of the paperclip maximizer, that kind of cautionary tale where if you set a model to maximize paperclips and maximize a factory,”
Claim: The speaker had played Factorio for years before working on the Factorio learning environment.
“I played Factorio for years, and about 18 months ago I was looking into this idea of the paperclip maximizer, that kind of cautionary tale where if you set a model to maximize paperclips and maximize a factory, what kind of bad stuff do they end up doing? in furtherance of that goal.”
“And it kind of got me thinking about the applicability of Factorio as an environment for benchmarking models.”
“One of the kind of motivations for it is that when you compare Factorio against Minecraft, for instance, the complexity scale is drastically different.”
Claim: The speaker says Factorio's complexity scale is drastically greater than Minecraft's.
“In order to complete Factorio, you know, complete and launch a rocket, you need to mine maybe about a million more resources to get to that point.”
“Whereas the same kind of point in Minecraft, you have to just get maybe 200 resources.”
Claim: The speaker estimates that reaching a comparable point in Minecraft requires about 200 resources.
“So, you know, we have orders of magnitude difference in Factorio compared to some of these other environments. And if you want to go.”
“go beyond just launching a factory and you know see some of the huge factories that real players have managed to make i think the biggest one at the moment is generating something like 19 million resources a second so we have factories that you know stem from you know making maybe one resource every couple of seconds all the way to 18 20 million a second”
“go beyond just launching a factory and you know see some of the huge factories that real players have managed to make i think the biggest one at the moment is generating something like 19 million resources a second so we have factories that you know stem from you know making maybe one resource every couple of seconds all the way to 18 20 million a second”
“And that range gives an enormous amount of signal for comparing models,”
“you know, from tiny models that aren't very good all the way to superhuman models and enable us to differentiate them kind of at any step along the way.”
“And, you know, I kind of set out on a Friday night about 18 months ago, you know, as a casual weekend project, you know, in and out operation, get it done.”
“And 18 months later, we kind of got it into a position. to actually release.”
Claim: The Factorio benchmarking project was ready for release about 18 months after the speaker began it.
“Mark kind of joined working on it about nine months ago or so and we really started focusing on this about three months ago and just trying to clean it up and get it get it into the public basically”
“Mark kind of joined working on it about nine months ago or so and we really started focusing on this about three months ago and just trying to clean it up and get it get it into the public basically”
Claim: Mark joined the Factorio benchmarking project about nine months before speaking.
“I was on the complete opposite side. I had never played Factorio before before joining but I was kind of sold by Jack because of all the reasons that he just brought out and then I remember I had to do the full tutorial before even starting actually building this.”
Claim: The speaker had never played Factorio before joining the Factorio learning-environment project.
“I was on the complete opposite side. I had never played Factorio before before joining but I was kind of sold by Jack because of all the reasons that he just brought out and then I remember I had to do the full tutorial before even starting actually building this. this thing and already during the tutorial I could kind of see the complexity and the opportunities for this and it was then really cool to kind of see as we build this thing where where these models get to and and where do they where they kind of fall short”
“A Factorio exposes a low-level Lua API to interact with the game.”
Claim: Factorio exposes a low-level Lua API that can be used to interact with the game.
“The way you mod Factorio traditionally is you write some Lua scripts, you hook that into the game, and then when events happen, your script runs.”
“But this doesn't really work for doing what we were interested in, which was kind of running this at scale and getting, you know, a cluster of servers running.”
“So we had to develop an entirely different way to mod the game by exploiting the admin console of multiplayer Factorio servers.”
“And what we realized is we could hook into this admin console over the network using a protocol called Archon carried by TCP.”
“And this basically enables us to execute actions in the game. remotely and kind of chart them across dozens or hundreds of Factorio servers,”
“which is necessary if you want to do training or any of the other workloads you might need at scale.”
Claim: Training and other workloads at scale require running actions across many Factorio servers.
“It was very easy to get a low level harness working, you know, tell the character move one step to the left, move one step to the right, that kind of thing.”
“But that type of approach is probably a lot much better suited to training models from scratch.”
“And I guess a Markov decision process architecture where, you know, you give it a bunch of these low level actions and you train a network just to maximize the order in which these low level actions are executed in order to get an outcome.”
“But such an approach would prevent you using any of the pre-training that large language models have got.”
“So that forced us to think a bit more carefully about what interface we could expose to these models, and we ultimately settled on a code synthesis. approach where these models would write python code and those python code in that python code would invoke certain high level actions such as move to this distant point or place an entity next to another entity and you'd leave it up to the model to think about how to abstract these tooling abstract these actions into a structure that would give it”
“approach where these models would write python code and those python code in that python code would invoke certain high level actions such as move to this distant point or place an entity next to another entity and you'd leave it up to the model to think about how to abstract these tooling abstract these actions into a structure that would give it an ability to manage factories of arbitrary size you want the model to be able to come up with classes with functions with data structures such that when it has a factory that might be producing millions of resources a second it might be sprawled over over a huge amount of the game space it needs to be able to reason over these different parts of the factory efficiently so we decided python because the models pre-trained models are pretty good at python and that was you know a reasonable choice”
“an ability to manage factories of arbitrary size you want the model to be able to come up with classes with functions with data structures such that when it has a factory that might be producing millions of resources a second it might be sprawled over over a huge amount of the game space it needs to be able to reason over these different parts of the factory efficiently so we decided python because the models pre-trained models are pretty good at python and that was you know a reasonable choice”
“we kind of set up this harness, the models write Python, they execute a Python in the game, which results in factory segments like you can see on screen kind of coming into being.”
“And then the models get given a score, which is basically the production statistics, you know, what it's producing a second.”
Claim: The evaluation scores models using production statistics, including output per second.
“And we also keep track of milestones, such as technologies the model was able to come up with. or new items that they were able to create for the first time.”
“So we have these kind of two reward signals that complement each other.”
“And the reason why this is necessary is to avoid certain... I guess behavioral collapses where a model might choose, for example, to mine coal and mine a billion or a trillion coal and that's all it does.”
“for example, to mine coal and mine a billion or a trillion coal and that's all it does. And that would give a good score like that would have a high production score, but it would properly indicate something has gone very wrong in the evaluation or training process. So we have we have a couple of different ways of measuring model performance.”
“And that would give a good score like that would have a high production score, but it would properly indicate something has gone very wrong in the evaluation or training process. So we have we have a couple of different ways of measuring model performance.”
Claim: The team evaluates model performance using multiple measures.
“LabLay is you give the model a task to create a factory of some entity and then the model just needs to create a factory. using our API.”
Claim: In Lab play, a model is assigned a target entity and must build a factory for it using the API.
“That gives you an easy way how to evaluate the upper bound on the performance because we have 24 target entities and each new entity is more difficult than the previous one.”
“So Laplace is simple in that sense, and it very specifically measures the spatial reasoning of the models, can they use the API, and how well can they work in constrained environments.”
Claim: Lab play evaluates models' spatial reasoning, API use, and performance in constrained environments.
“Now, open play is the unbounded create the biggest factory that you can think of type of environment.”
Claim: Open play is an unbounded Factorio task in which a model must create the largest factory it can.
“Lab play is in that sense a subset of open play where in open play now the models have to actually create their own objectives as well because if you just give it the goal of create the biggest factory.”
“It needs to make that large goal into sub goals, you know, first let's create drills, then let's create inserters, then let's put them down, then let's create a mine of this resource, that resource, all that.”
“And so you have these two, let's say, abilities at play there of one. Is the model actually good at using the API and working in Factorio? And two, what objectives does the model set for itself? So for instance, one of the interesting things we saw was that DeepSeek was quite decent at lab play.”
“what objectives does the model set for itself? So for instance, one of the interesting things we saw was that DeepSeek was quite decent at lab play. It was kind of on the level of GPT-4.”
Claim: DeepSeek performed reasonably well on Lab play, roughly matching GPT-4's level.
“But in open play, Deep Seek was terrible because what it often just decided to do was let's just create more chests.”
“Yes, let's create 250 chests and put them in a nice little line and that is my factory.”
Claim: In open play, DeepSeek chose to build a factory of 250 chests arranged in a line.
“Exactly. Exactly. So you can really see the myopic and short term objective setting at play in the open play because a lot of the times the weaker models, they didn't think four or five steps forward.”
Claim: In open play, weaker models often failed to plan four or five steps ahead.
“So I think that the thing that the task is long-term planning. basically be able to reason over things figure out an appropriate objective and maintain that objective for an extended context without kind of losing the plot and diverting into different areas whereas the lab play is much more about spatial reasoning and the kind of low level figuring out how to compose stuff that”
“basically be able to reason over things figure out an appropriate objective and maintain that objective for an extended context without kind of losing the plot and diverting into different areas whereas the lab play is much more about spatial reasoning and the kind of low level figuring out how to compose stuff that that has the appropriate space and precision around it such that it works.”
“As you might know from Factorio, much like writing a program, if you put one thing in the wrong place, the whole system grinds to a halt.”
“So that's a slightly different skill set that we're evaluating than the long-term planning stuff.”
“It's not obvious to us why Claude is so much better than the other models in both settings.”
“I mean, our suspicion is it is better trained for this kind of long-term. planning aspect.”
Claim: The team suspects Claude is better trained for long-term planning.
“One thing we have found in preliminary results is that the reasoning models don't seem to do as well as you'd expect in this setting.”
Claim: Preliminary results suggest reasoning models perform worse than expected in this evaluation setting.
“And I think that's probably because the way we set this up, it's a bit like we're already making it do reasoning traces over an extended period of time.”
“Asking the model to do reasoning over reasoning kind of eliminates a lot of the performance improvements you get from applying the reasoning models alone to problems like math frontier, where there's a lot of benefit from just writing stuff down and figuring out what works.”
“This is unpublished. This is our preliminary results, but our plan is to publish additional results with the reasoning models and we've also added in an adapter to support VLMs. Now a lot of the models we did evaluate do have vision.”
Claim: The team added an adapter that supports vision-language models.
“This is unpublished. This is our preliminary results, but our plan is to publish additional results with the reasoning models and we've also added in an adapter to support VLMs. Now a lot of the models we did evaluate do have vision.”
“In our published results, the models are interacting symbolically with the environment. It doesn't actually see the pixels on the screen.”
“So one thing we want to bring out in our next work is how much improvement can you get from allowing the models to take screenshots of part of the factories they want to debug.”
“say that the basic geometry of the picture they can't they can't intuit that two lines are have an intersection so to kind of get around this we've scrapped in the vision component we've scrapped using the tile maps and the graphics of factorio and have instead fallen back to a very simple geometric renderer”
“which the models can kind of choose to configure when they invoke it as a tool and the hope there is that we can stumble upon stumble upon the right vision mode that these models are reasonably good at but by i think your intuition is right i would be surprised if we get that much from it at this stage but it would be it would be cool if we do”
“which the models can kind of choose to configure when they invoke it as a tool and the hope there is that we can stumble upon stumble upon the right vision mode that these models are reasonably good at but by i think your intuition is right i would be surprised if we get that much from it at this stage but it would be it would be cool if we do”
Claim: Models can configure the geometric renderer when they invoke it as a tool.
“We did try out sending in the screenshots at some point. And the problem is because you have so much going on in larger factories that the monsters start to hallucinate things.”
“They don't correctly understand what is broken, why a factory doesn't work.”
Claim: In screenshot tests, models failed to identify what was broken or why a factory was not working.
“As you said, adding this niches didn't improve things, and it sometimes made it even worse because they started hallucinating entities that weren't there and started doing often, went on tangents that weren't actually real in the game state. Right now, at least, the vision actually wouldn't improve.”
“Now, of course, as we go on, the models get better and better. It might improve in the future, but that's at least the current state that we found.”
“there's a couple of things that compared to the Voyager paper were interesting. So in Voyager, there was this idea of like self-discovery of actions where the model could like then save skills in a skill library and then reuse them later.”
Claim: In Voyager, a model could discover actions, save skills in a library, and reuse those skills later.
“Sure. So apologies for not being clear in the in the publication, but the models can define classes, they can define functions and then execute them later.”
Claim: The evaluated models can define classes and functions and execute them later.
“Only Google models tend to do this, which is quite interesting.”
“Another finding we discovered was that each of the models we evaluated had fundamentally different coding styles.”
Claim: The models evaluated by the team used fundamentally different coding styles.
“CLAWD, for instance, the SONET 3.5 was very much fire and forget. It would write code in a kind of Pythonic way, just like let it fail, don't be careful about it.”
“Whereas GPT-4 would use defensive programming, use self-assertions, so basically asserting. facts about its internal state,”
Claim: GPT-4 used defensive programming, including assertions about its internal state.
“Yeah, yeah, I think GPT-4 had that. And it's the same with Mini as well, if I remember correctly. They had a much more defensive check before we do anything. But funnily enough, often those checks were also incorrectly set up. So it tripped itself up with its kind of overly defensive nature sometimes.”
“Agents can define skills, they can incorporate the skills.”
Claim: Agents in the Factorio environment can define and use skills.
“this gives agents a lot of reach as the factories get bigger you can imagine they could create you know quite sophisticated like for example they could create hypothetically an NSAT solver in the kind of name space and then use that for a correct item and entity positioning in the game if they were able to do this”
“As I say, models are fairly rudimentary at this at the moment,”
Claim: Models' capabilities in this Factorio environment are currently fairly rudimentary.
“but part of the motivation for this environment was to enable us to evaluate superhuman models and the evolving state of the art and not become irrelevant in six months, as happens to a lot of existing benchmarks when they kind of max out.”
“It's a lot more difficult to create generalizable skills that would be useful actually in multiple, multiple factory settings apart from the easy connect X to Y,”
“which we exposed as an API already. So we did all...”
Claim: The Factorio environment exposes the simple operation of connecting X to Y through an API.
“but we found that often the skills weren't that reusable that you would hope at least because of exactly the reason that as soon as your environments change,”
“if you make a skill over creating a factory, then that skill must be really general and like cover all the edge cases to actually correctly be usable later on.”
“The abstractions and the code structures that the model invented would align quite closely with the topology of the factory it had created.”
“Let's say it had one section which was just about mining and then one section which was just about manufacturing. I was kind of hoping to see that it was able to bring that out and abstract that away to enable it to generalize better in future.”
“But we haven't yet seen this.”
Claim: The team has not yet observed a model abstracting factory sections in the hoped-for way.
“I mean, this is something. hope to see when we start training but you know that's an open question no”
“we haven't i mean we kind of considered this i mean there's a couple of sources of data i think inspired by mind dojo maybe mind dojo where we we pulled in a lot of data about vectorio on one hand and then we pulled in a lot of you factory blueprints that people created on the other hand and tried to use uh rag basically”
“yes so something that we are i guess we haven't really we still want to try this but it became a bit of an adjunct to the core work um doing this extra stuff um one of the issues we found with blueprints is that”
“First of all, they're specified declaratively, much like you get a terraform, you know, or a cloud formation, infrastructure as code kind of blueprint, which said where everything had to be.”
“but it didn't provide the imperative steps necessary to get there so on one hand you know we have our python code that the agent writes which are the steps one after the other to get to the factory and on the other hand we have blueprints to just say the final state um so we we spent a fair amount of time trying to try to bridge this gap and we came up with some i guess procedural factory generation techniques which could take a declarative blueprint about what this factory needs to look like and then”
“but it didn't provide the imperative steps necessary to get there so on one hand you know we have our python code that the agent writes which are the steps one after the other to get to the factory and on the other hand we have blueprints to just say the final state um so we we spent a fair amount of time trying to try to bridge this gap and we came up with some i guess procedural factory generation techniques which could take a declarative blueprint about what this factory needs to look like and then deduce the steps necessary to get there the downside of this is that it's very low level you know you're not getting the abstractions that you'd like to see but on the plus side we have a lot of that data we have tens of thousands of these factories so I'm thinking that this is the kind of thing that would be really useful just to train the model to do from scratch and just give it you know 10 000 examples of factory units that people have made learn on it”
“deduce the steps necessary to get there the downside of this is that it's very low level you know you're not getting the abstractions that you'd like to see but on the plus side we have a lot of that data we have tens of thousands of these factories so I'm thinking that this is the kind of thing that would be really useful just to train the model to do from scratch and just give it you know 10 000 examples of factory units that people have made learn on it”
“deduce the steps necessary to get there the downside of this is that it's very low level you know you're not getting the abstractions that you'd like to see but on the plus side we have a lot of that data we have tens of thousands of these factories so I'm thinking that this is the kind of thing that would be really useful just to train the model to do from scratch and just give it you know 10 000 examples of factory units that people have made learn on it”
Claim: The team's procedural factory-generation techniques are low-level and lack the desired abstractions.
“But when you try and move that into a benchmark setting with already pre-trained models just using in-context learning, it's just not that helpful.”
“A thousand lines of Python telling you how to make this kind of factory unit which... it may not be directly applicable to the agent's immediate objective it didn't really give us any uptick in scores so i think we kind of put that in the bucket of what we're going to do when we when we start really throwing computer so for example we when we did all these experiments we kind of accumulated about a million programs that agents have written with scores attached so we kind of got this big bucket of programs and traces trajectories through the game and we want to take these and just kind of throw it at a model and just”
“it may not be directly applicable to the agent's immediate objective it didn't really give us any uptick in scores so i think we kind of put that in the bucket of what we're going to do when we when we start really throwing computer so for example we when we did all these experiments we kind of accumulated about a million programs that agents have written with scores attached so we kind of got this big bucket of programs and traces trajectories through the game and we want to take these and just kind of throw it at a model and just and just see what happens if we really try and get it to learn how to maximize score directly,”
“it may not be directly applicable to the agent's immediate objective it didn't really give us any uptick in scores so i think we kind of put that in the bucket of what we're going to do when we when we start really throwing computer so for example we when we did all these experiments we kind of accumulated about a million programs that agents have written with scores attached so we kind of got this big bucket of programs and traces trajectories through the game and we want to take these and just kind of throw it at a model and just”
“there is a big skill gap.”
Claim: Factorio agents and human players have a large skill gap.
“because they execute Python programs, come up with quite complicated policies which a human player would have to kind of develop on the fly so in that sense the agent has an advantage but when we kind of track the number of ticks it took to execute these policies against the number of ticks a human player would spend to get somewhere the gulf between models playing this and humans playing it is absolutely enormous um”
“come up with quite complicated policies which a human player would have to kind of develop on the fly so in that sense the agent has an advantage but when we kind of track the number of ticks it took to execute these policies against the number of ticks a human player would spend to get somewhere the gulf between models playing this and humans playing it is absolutely enormous um”
“the current record for speedrunning is about an hour and 20 minutes to get to a rocket launch,”
“It took models something like eight hours or so to get to the point where they have a kind of working factory that could make a few things, a few, let's say, iron gear wheels or electric circuits or maybe some science and maybe start progressing through the tree.”
“So, you know, there's probably 100 times difference in the competency of these models untrained than a human expert.”
“maybe a better experiment would be to take someone who'd never played the game before or”
“put them in the game and then compare it with the models because the models you know they have never been trained on this stuff they only know a little bit about factorio they they have the manual of how to interact with it and they just they just have to go and and try their best so maybe that's what we should do i should try and recruit my fiance and kind of make her sit down for for 10 hours in front of the game and see where we get”
“put them in the game and then compare it with the models because the models you know they have never been trained on this stuff they only know a little bit about factorio they they have the manual of how to interact with it and they just they just have to go and and try their best so maybe that's what we should do i should try and recruit my fiance and kind of make her sit down for for 10 hours in front of the game and see where we get”
“I don't think there is a mechanical advantage per se.”
Claim: The speaker does not think AI agents have an inherent mechanical advantage over humans in Factorio.
“is purely what type of structure are they able to come up with? And if you do start to train against that.”
“objective then probably we will we might see some wacky structures which maybe humans haven't thought of in the future but that's that's the the the gap towards there and the road towards there is long also guys well this was great and there's a lot of factorial fans as we wrap up a couple things are there any games that you wish people would build similar experiences on just to see how the models perform maybe can be you know”
“I would really like to see some agents made for playing Age of Empires 2 because it's such a well-designed game and the communities kind of come back over recent years.”
“But the AI of the models in the game is really terrible.”
Claim: The speaker considers the models' AI performance in Age of Empires 2 to be very poor.
“And I think it'd be really fun to see how good we can train these models to play that game.”
Claim: The speaker thinks it would be fun to test how well models can be trained to play Age of Empires 2.
“so we see that Claude right here has almost got twice the score of the nearest best model.”
“which was so bad upon occasion it actually begged to be turned off it gave up and said i can't do this anymore please reset me and then it would and then it would refuse to do anything else for like 100 steps”
“i think maybe the kind of ambition or determination is some kind of latent factor in the competency of these models as expressed in the game.”
“guys. Yeah, I think getting models to acknowledge that they cannot do something, actually I think it's an interesting form of refusal.”
“knowing the limits of their competence because i think often we're incentivizing these models to say anything”
“and so to me that's almost a positive result that is just saying we're not going anywhere like give a positive reward for that yeah”
“this work was phase one of a phase two plan.”
Claim: The speaker describes the current work as phase one of a planned second phase.
“Our goal now is to start training these models directly on unbounded objectives.”
Claim: The speaker's current goal is to begin training the models directly on unbounded objectives.
“We think that there is a pretty strong application to this in terms to the field of model alignment,”
Claim: The speaker believes this work has a strong potential application in model alignment.
“In this instrumental convergence hypothesis, the paperclip maximizer hypothesis, where we think that certain behaviors are always going to emerge regardless of whether it's a human doing it or whether it's a machine,”
“one really stands out, which is goal content integrity, specifically the reluctance for people or maybe models to change their goal once that goal has been set.”
“basically build a paperclip maximizer and see whether this behavior emerges, because if it does, that I think might force us to change our attitude towards alignment, which is heavily based on this kind of incremental approach.”
“But if we get to a point where the models are very clever and they don't want to have their objectives changed, it kind of means we only have one really good shot to set their objectives ahead of time because otherwise it's going to become quite hard to do it down the road.”
“So this is kind of an open project.”
Claim: The speaker describes the project as open.