Running Gemma 4 Directly Inside Godot

toxicdog · reddit · 2026-07-13

The author successfully ran `gemma-4-E2B-it-Q4_K_M.gguf` directly within a Godot 4.7 project, aiming to prove that local LLM execution is possible inside the engine **without relying on llama.cpp, Python, external servers, or GDExtension**. The implementation breaks down as follows: - **Vulkan compute shaders** handle the model computation. - **GDScript** manages GGUF loading, tokenization, sampling, the KV cache, and the chat UI. Currently, the experiment is restricted to this specific model. It runs about **10 times slower** than llama.cpp with CUDA, and the author explicitly labels it as a proof-of-concept. Nevertheless, it proves that a fully local LLM inference pipeline can be constructed using Godot alone.

Original post →

More from coding & agent

coding & agent channel →