This project was intended to make it easy for anyone to create custom simulations and my attempt to recreate Generative Agents: Interactive Simulacra of Human Behavior. I’ve been working on Smallville for the past few weeks and hope other people also find it useful. Would love to hear any thoughts about the project and where I should take it from here.
Finding a way to make the machine learning piece a completely self-contained library that can be shipped at scale to run on individual computers is the big hurdle to making AI like this practical for games. If I have to rely on your service staying up for my game to work, that's an unacceptable supply chain risk.
Original message: From a quick peek at the source, this depends on the ChatGPT API for the underlying LLM. It could probably be modified to use a local copy of an LLM, but most models I've seen are 300GB+ and require significant computational resources to operate (think several $15k NVIDIA A100 compute nodes). There's a lot of effort being put in by the open source community to minimize these models and run them on commodity hardware, but as of yet the quality of the responses from the model are correlated with how large (and therefore how much compute) the model has. Give it a year or two and it'll probably be more reasonable to integrate a local LLM for gaming purposes.
What? Where have you been the last 3 months?
> the quality of the responses from the model are correlated with how large (and therefore how much compute) the model has
There's a lot more to this including the model structure, training methods, number of training tokens, quality of training data, etc.
I'm not at all saying that Vicuna/Alpaca/SuperCOT/Other llama based models are as good as GPT3.5 - but they should be capable of this, they still create coherent answers.
You need preferably 24GB of vram, but you can get away with less, or you can use system memory (although that'll be slow).
There is a openai api proxy that might let this work without too much work actually
EDIT: It actually says in the readme they plan to support StableLM which is interesting because at least at the moment that's not a well performing model
EDIT 2: You should try the replit2.8B model - This is surprisingly good at programming - https://huggingface.co/spaces/replit/replit-code-v1-3b-demo
Even a finetuned 3B model would be excellent for generative agents and only use about 2GB of RAM to at high speeds on even a single core CPU.
Do I think that's good? Absolutely not, I think it's terrible. But the commentor I'm replying to is right, "most players" won't care at all, else we wouldn't be in this position.
Is there any way to protect against prompt injection here? Looking at the architecture I am thinking it would be possible for users to tell an agent what to do directly by tricking them.
This isn't really a criticism, I think it's actually a cool feature. It might be a fun premise of a game where you know you are in a simulation and can manipulate the NPCs around you.
Not a solved problem in humans either. I remember watching a documentary on North Korea recently where they covered how his brother got murdered at an airport in Singapore by a woman who had been conned for months into believing she was starring in a reality TV show playing pranks on people.
As generality increases to Infinity I'm not sure there's actually a way to solve this particular problem. It might just be a failure of imagination on my part.
can you imagine trying to QA this?
in any case... getting this to go anywhere /for anyone else/ imo would require a tight native code library without network dependency, as others have said.
building on what you have looks like and awesome project though, and i wish you the best with it.
I would like to know if the part of the LLM that stores the experience of interacting with the player is separate from the base model, and if so how heavy that specific part is?
Are we talking Mb or Gb?
1. It's interesting, but realistically I'm unlikely to get into the Java code where all the interesting logic is
2. My impression of the code is that all the interesting stuff is in World.java [1] and the many models [2]
3. I don't see obvious prompts in here. I'm guessing they are somewhere, though also built dynamically (maybe mostly through string concatenation). In my experience it's essential to be able to see and understand the prompts, both abstract/template prompts and the instantiated prompts and responses. Also, having done it both ways, I find that keeping prompts separate from code is helpful. They feel different and you iterate on them differently.
4. You should be wanting to get to a place where most of your changes are prompt-driven. That is, you may be changing code, but only because you are refactoring your prompts in some qualitative way. With some good DSL you can even support qualitative changes, like changing the chain, or making a prompt multi-stage.
5. My intuition is that an important feature of GPT to these applications is the ability to apply multiple frames to the environment. Which is a fancy way of saying many different prompts that include different system prompts and different purposes. But I can't really find the prompts here so I don't know what's happening.
6. The paper this was based on was really inefficient with calls to GPT, costing according to the paper thousands of dollars to run an in-game three-day trial. I think you're going to want to deal with that right away. You want to move more execution out of the LLM (for instance by having the LLM come up with higher-level instructions that are carried out by simpler algorithms). Also you probably need more chattiness to allow the LLM to indicate what information it wants, instead of providing the LLM with all the subjective information a character has.
Anyway, a few thoughts, good luck!
[1] https://github.com/nickm980/smallville/blob/main/smallville/... [2] https://github.com/nickm980/smallville/tree/main/smallville/...