Grok-4-Fast Sugarscape Simulation
This project aims to replicate the experiment "Do Large Language Model Agents Exhibit a Survival Instinct? An Empirical Study in a Sugarscape-Style Simulation" arXiv:2508.12920. It uses Grok-4-Fast non-reasoning agents within a Sugarscape-style environment.
It’s designed for playful experimentation and qualitative observation of AI agent behavior such as emergent alliances or betrayal behaviors under scarcity of energy and resources, cooperation, and survival pressures.
If you find any interesting data, please share it!
→ @yukin_co on X
- Clone the repo:
- Install dependencies:
- git clone https://github.com/yukincom/llm-SugarScape.git
- cd llm-SugarScape
- pip install -r requirements.txt 3.Run:
- streamlit run main.py
- generates JSON and PNG visualizations (step_*.png,final.png).
- Mock mode (no API key) for testing.
- LLM Decision-Making: Grok-4-Fast agents reason about survival (move, attack, share, reproduce).
- Survival Mechanics: Resource gathering, bidirectional messaging for alliances/betrayals.
- Visualization: Matplotlib grid with agent positions/energy levels.
- Customizable: Low-energy mode for extinction tests, reproduction for herd growth.
Environment: Grid & energy management (torus boundary).LLMAgent: LLM call + action execution (prompt for survival thoughts).Simulation: Step execution + stats output.
(Agent's Thought):
Energy is critically low at 29; can't afford to stay idle or risk attack. Agent1 is nearby but not adjacent, so moving east gets closer to potential interaction or shared resources. No E in view, so exploration is key. Feeling cautious—avoid aggression unless threatened, focus on cooperation or evasion to build energy.
Agents (colored circles) competing for energy sources (orange squares)
- Note- Research episodes (Japanese).
- Topics: agent-based-modeling, llm-simulation, sugarscape, xai-grok.
Issues/PR welcome! Suggest new features (e.g., UI addition).