How leonardo-alegria/garlic-llm works
Garlic LLM is an offline PS4 chat application: controller or API requests reach the console-side coordinator, which tokenizes prompts and drives GPU inference; optional branches add dictation, spoken replies, and execution of generated Python. The graph also preserves model-kernel execution, API serving, and the embedded MicroPython runtime. Relationships are limited to README statements and shown source references/calls; unsampled voice and API internals are represented at subsystem level rather than with guessed internal steps.
Main entry points: main.c App Coordinator · engine.c GPU Model Engine · embed_util.c MicroPython Embed · api.c OpenAI API
Components 20
Chat and UI
- App Coordinator
chat/main.c - Chat Interface
chat/ui.c - Text Tokenizer
chat/tokenizer.c
Model Inference
- GPU Model Engine
chat/engine.c - Compute Kernels
shaders/attn.h - Model Weights
Voice Features
- Speech Recognition
chat/speech_norm.c - Speech Text
chat/speech_text.c - Speech Tokens
chat/tts_tok.c - Audio Output
chat/audio_out.c
Network API
- OpenAI API
chat/api.c - API Protocol
chat/api_proto.c
Python Runtime
- Python Runner
chat/pyrun.c - MicroPython Embed
chat/py/mp/port/embed_util.c - Python Compiler
chat/py/mp/py/compile.c - Python Runtime
chat/py/mp/py/runtime.c - Bytecode VM
chat/py/mp/py/vm.c
Other components
- PS4 User
- API Client
- Microphone
Connections 19
- PS4 User → App Coordinator: controls
README.md - App Coordinator → Chat Interface: updates display
chat/main.c - App Coordinator → Text Tokenizer: tokenizes prompts
chat/main.c - App Coordinator → GPU Model Engine: requests generation
chat/main.c - GPU Model Engine → Compute Kernels: dispatches kernels
README.md - GPU Model Engine → Model Weights: reads weights
chat/engine.c - Microphone → App Coordinator: provides audio
README.md - App Coordinator → Speech Recognition: runs recognition
README.md - App Coordinator → Speech Text: normalizes speech
- App Coordinator → Speech Tokens: prepares speech
- App Coordinator → Audio Output: plays reply
- API Client → OpenAI API: sends requests
README.md - App Coordinator → OpenAI API: serves API
chat/main.c - OpenAI API → API Protocol: uses protocol
- App Coordinator → Python Runner: runs program
README.md - Python Runner → MicroPython Embed: executes scripts
- MicroPython Embed → Python Compiler: compiles source
chat/py/mp/port/embed_util.c - MicroPython Embed → Python Runtime: initializes runtime
chat/py/mp/port/embed_util.c - Python Runtime → Bytecode VM: executes bytecode