Developers participating in Hugging Face's Build Small Hackathon created Thousand Token Wood, an economy simulation running entirely on a 3-billion-parameter language model. The system achieved 100% valid JSON actions across 75 test calls while orchestrating five AI agents trading goods, managing inventory, and navigating financial panics. The project demonstrates how structured prompting and engineered environment design allow compact models to power real-time multi-agent systems efficiently.
Engineering Scarcity to Force AI Trade
The simulation places five woodland creature agents on a Qwen2.5-3B model served via vLLM on Modal, using a Gradio frontend interface. Initial tests revealed that without environmental limits, agents remained entirely self-sufficient and ignored trading opportunities.
To drive active markets, author Lester Leong engineered explicit scarcity mechanics into the simulation framework:
- Diet rules requiring agents to consume diverse food types to survive
- Perishable goods spoilage that forced surplus inventory onto the market
- A recurring winter fuel crisis dependent on a single firewood supplier
These constraints generated immediate market friction, causing agents to negotiate prices and complete between 3 and 9 trades per turn.
Overcoming Small Model Reasoning Flaws
While the 3B model produced valid JSON formatting on 100% of calls, its baseline economic reasoning proved unreliable without guidance. For instance, acorn-producing agents frequently posted buy orders for acorns despite holding a surplus.
Rather than switching to an expensive frontier model, the creator resolved these reasoning errors through structural guardrails:
- 100% valid JSON actions recorded across all 75 calls in a 15-turn benchmark run
- Wealth inequality (Gini index) widened from 0.14 to 0.38 as market forces unfolded
- Honey prices crashed from 10 to 3 pebbles during simulated bank run events
- Firewood prices surged from 4 to 7 pebbles during forced winter shortages
The system architecture wraps all agent responses in a tolerant JSON parse-and-repair layer, ensuring malformed outputs degrade to simple no-ops rather than breaking the loop.
Trade-Offs and System Limitations
Despite structured prompting improvements, small models remain inherently weak economic reasoners compared to frontier scale models. Without hardcoded negative constraints—such as explicitly prohibiting agents from purchasing goods they produce—the agents quickly revert to illogical market moves. Furthermore, price movements rely on environmental code to calculate residual demand rather than pure internal model deduction.