How bemor187/garlic-llm works
Garlic LLM is an offline PS4 chat application that runs Qwen3.5 on the console GPU, with voice, dictation, Python execution, and an optional network API. The principal workflow is controller or API input → tokenization → model inference → displayed or spoken output. README statements establish several feature links; sampled source confirms key GPU dispatch, UI ownership, and embedded MicroPython behavior. Unsampled speech and API implementation details are represented only at the documented subsystem level.
Main entry points: main.c Chat coordinator · engine.c Qwen engine · api.c HTTP API · embed_util.c MicroPython embed
Components 19
Chat interaction
- Controller UI
chat/ui.c - Chat coordinator
chat/main.c - HTTP API
chat/api.c - API protocol
chat/api_proto.c
Model inference
- Tokenizer
chat/tokenizer.c - Qwen engine
chat/engine.c - GPU kernels
shaders - Q4 weights
pc/q4.py
Speech features
- Speech recognition
chat/speech_text.c - Speech normalization
chat/speech_norm.c - Voice synthesis
chat/engine.c - Audio output
chat/audio_out.c
Embedded 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 - String extensions
chat/py/garlic_str.c
Other components
- PS4 user
- API client
Connections 24
- PS4 user → Controller UI: enters prompt
README.md - Controller UI → Chat coordinator: routes input
chat/main.c - Chat coordinator → Tokenizer: encodes text
README.md - Chat coordinator → Qwen engine: requests generation
README.md - Qwen engine → GPU kernels: dispatches kernels
README.md - Q4 weights → Qwen engine: stores model weights
- Qwen engine → Chat coordinator: returns tokens
README.md - Chat coordinator → Controller UI: shows reply
chat/main.c - PS4 user → Speech recognition: speaks prompt
README.md - Chat coordinator → Speech recognition: uses dictation
- Speech recognition → Speech normalization: normalizes text
chat/speech_norm.c - Chat coordinator → Voice synthesis: requests speech
README.md - Voice synthesis → Audio output: produces audio
README.md - Audio output → PS4 user: plays response
README.md - PS4 user → API client: submits request
- API client → HTTP API: sends HTTP
README.md - HTTP API → API protocol: uses protocol
- HTTP API → Chat coordinator: queues generation
chat/main.c - Chat coordinator → Python runner: runs generated code
README.md - Python runner → MicroPython embed: executes script
- 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 compiler → Python runtime: emits executable code
- String extensions → Python runtime: extends strings