Technical Implementation of Gemma 4 E4B for Localized Simulation

A new technical implementation of the Gemma 4 E4B model has been demonstrated, showcasing the ability to drive a real-time, 3D simulation of up to 100 autonomous agents on a single consumer-grade GPU. The project, titled “Rumor Village,” utilizes a fine-tuned version of the model to manage neighbor interactions, such as spreading and distorting information, entirely offline via llama.cpp.

According to reports from a developer on Reddit, the system operates without the need for external APIs or cloud accounts, running locally on a user’s PC. The simulation uses a C++ engine to validate model-proposed actions against a structured memory system, ensuring that the model’s output is constrained by a specific GBNF grammar. This grammar limits the model’s responses to specific JSON actions: say, go, or none.

Performance Benchmarks and Fine-Tuning Results

The developer utilized LoRA (Low-Rank Adaptation) in bf16 to fine-tune the model using a dataset of 12,146 card-to-answer pairs, which included both decision-making and information extraction tasks. The training was conducted using a single rented RTX 5090.

Comparative testing between the base model and the fine-tuned version (both in Q4_K_M quantization) yielded several measurable performance improvements, according to the developer’s data:

  • Error Reduction: The fine-tuned model showed a significant decrease in “made-up memories,” dropping from 2.0% to 0% in Spanish and 2.3% to 0% in English. Incoherence and contradictions were reported to be 16.5 times fewer in Spanish and 5.0 times fewer in English compared to the base model.
  • Inference Speed: In a test environment featuring an RTX 5070 Ti with a batch size of up to 16, generation time per simulated minute decreased by approximately 50%. In Spanish, time dropped from 0.73s to 0.36s; in English, it dropped from 0.77s to 0.37s.
  • Efficiency: The fine-tuned model required significantly fewer decisions to complete a simulated day—2,717 decisions in Spanish compared to 7,927 for the base model—due to its ability to conclude conversations rather than entering endless loops.
  • VRAM Usage: The simulation reportedly requires between 4.4 and 4.6 GB of VRAM.

The developer noted a minor regression in “rejected actions,” which increased to approximately 1% in the fine-tuned version, though these are caught and corrected by the C++ engine.

Technical Specifications and Availability

The project is released under the MIT license, with the code hosted on GitHub and the model available via Hugging Face under the Apache-2.0 license. The developer noted that while the training pipeline and dataset have not yet been published, the model card contains the full results of the testing.

While the implementation demonstrates a functional use case for small-scale, high-density agent simulations on consumer hardware, these results are based on self-reported data from the developer and have not been independently verified by third-party benchmarks.