[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-114720":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":9,"htmlUrl":9,"language":10,"languages":9,"totalLinesOfCode":9,"stars":11,"forks":12,"watchers":13,"openIssues":14,"contributorsCount":15,"subscribersCount":15,"size":15,"stars1d":16,"stars7d":17,"stars30d":18,"stars90d":15,"forks30d":15,"starsTrendScore":19,"compositeScore":20,"rankGlobal":9,"rankLanguage":9,"license":21,"archived":22,"fork":22,"defaultBranch":23,"hasWiki":22,"hasPages":22,"topics":24,"createdAt":9,"pushedAt":25,"updatedAt":26,"readmeContent":27,"aiSummary":28,"trendingCount":15,"starSnapshotCount":15,"syncStatus":29,"lastSyncTime":30,"discoverSource":31},114720,"garlic-llm","leonardo-alegria\u002Fgarlic-llm","leonardo-alegria","A 9-billion-parameter language model running on a PS4 GPU. Offline.",null,"C",258,32,5,12,0,13,163,196,58,94.56,"GNU General Public License v3.0",false,"main",[],"2026-11-23 11:16:06","2026-11-23 20:42:01","\u003Cp align=\"center\">\u003Cimg src=\"docs\u002Flogo.svg\" width=\"112\" alt=\"Garlic LLM logo: a garlic bulb on a blue square\">\u003C\u002Fp>\n\n# Garlic LLM\n\n**A 9-billion-parameter language model running on a PS4. Offline.**\n\nGarlic LLM is a homebrew app for the PlayStation 4. It runs [Qwen3.5-9B](https:\u002F\u002Fhuggingface.co\u002FQwen) on the console's own GPU, with no PC and no internet while it runs. It also listens, talks, and runs the Python it writes.\n\n[Website](https:\u002F\u002Fgarlicllm.dev) · [Download](#install) · [Demo video](https:\u002F\u002Fgarlicllm.dev\u002F#demo) · [Support the project](#support)\n\n![Garlic LLM answering a question on a PS4](docs\u002Fchat.png)\n\n## What it does\n\n| Feature | Details |\n|---|---|\n| **Text chat** | Qwen3.5-9B at 31–39 tokens\u002Fs, and up to 43 tokens\u002Fs on code. 16K-token context. |\n| **Voice conversation** | Speak and it answers aloud (Chatterbox) in Spanish, English, Portuguese, Russian, Italian, French and German. |\n| **Dictation** | Hold a button and talk instead of typing (Parakeet TDT 0.6B v3), in 25 European languages. |\n| **Python mode** | Ask for a program. It writes MicroPython and the console runs it. |\n| **Think mode** | The model reasons before it answers. Off by default; a thought takes about half a minute. |\n\nEverything runs on the console. Nothing is sent anywhere.\n\nSpeeds were measured on a base\u002FSlim PS4. In voice mode the chat model runs at about 22 tokens\u002Fs, because the voice model takes the memory that speculative decoding uses.\n\n## Requirements\n\n- A PS4 running [GoldHEN](https:\u002F\u002Fgithub.com\u002FGoldHEN\u002FGoldHEN). Tested on a base\u002FSlim console with firmware 11.52. Users also report it working on a PS4 Slim with firmware 14.00 and on a PS4 Pro with firmware 12.02 (25–45 tokens\u002Fs).\n- About 6 GB of free space, or 12 GB if you copy the package to the console's own disk before installing it.\n- To use your voice: any ordinary microphone the console recognises.\n\nOther firmware versions are not tested yet. If you try one, please [open an issue](https:\u002F\u002Fgithub.com\u002Fleonardo-alegria\u002Fgarlic-llm\u002Fissues) with the result.\n\n## Install\n\n1. Download the all-in-one package (about 5.7 GB, models inside) from [Hugging Face](https:\u002F\u002Fhuggingface.co\u002Fgarlic-llm\u002Fgarlic-llm-ps4).\n2. Copy the PKG to the console and install it like any other homebrew package (*Settings → Debug Settings → Game → Package Installer*).\n3. Open **Garlic LLM** from the home screen. The first screen loads the model; after that it needs no PC and no connection.\n\n**Updating.** Download the new package and install it over the old one. The models are inside, so there is nothing else to copy.\n\n## Controls\n\n**Chat**\n\n| Button | Action |\n|---|---|\n| ✕ | Type a message |\n| □ (hold) | Dictate a message; release to finish |\n| ○ | Stop the answer |\n| △ | New chat |\n| ↑ ↓ or left stick | Scroll |\n| L1 | Voice mode |\n| R1 | Run the Python program in the last answer |\n| R3 or touchpad | Think mode on \u002F off |\n| L3 | [API](#api) on \u002F off |\n| L2 \u002F R2 | Temperature down \u002F up |\n\nAfter dictating, choose what to do with the text: ✕ send, △ edit, □ record again, ○ discard.\n\n**Keyboard**\n\n| Button | Action |\n|---|---|\n| ✕ | Type the selected key |\n| □ | Delete (hold to repeat) |\n| △ | Space |\n| L1 | Shift |\n| R1 | Emoji |\n| L2 (hold) | Dictate and add the text |\n| R2 | Send |\n| ○ | Close |\n\n**Voice mode:** hold □ to talk (this also interrupts the answer), △ starts a new chat, ○ leaves voice mode.\n\nThe interface follows the console's language: English, Spanish, Portuguese or Russian.\n\n## How it works\n\nA PS4 gives homebrew no compute API and no machine-learning library, so Garlic LLM talks to the GPU directly.\n\n- **Compute kernels.** The model's operations (matrix products over 4-bit weights, attention, normalisation) are OpenCL C kernels compiled by LLVM for the console's GCN architecture. They are in [`shaders\u002F`](shaders\u002F).\n- **Hand-written command buffers.** The app dispatches those kernels by writing PM4 packets itself, the low-level commands a graphics driver would normally generate.\n- **Speculative decoding.** Qwen3.5's own MTP head drafts up to two tokens ahead, and the full model verifies them in one pass.\n- **Custom Q4 and Q3 weights.** The 9B is stored in two formats made for these kernels. Q4 holds 4-bit weights and is used for most matrices and the output head. Q3 holds 3-bit weights (about 3.5 bits each with their scales) and is used for the two largest matrices of each layer, the MLP's gate and up projections. Storing everything in Q4 would take about 384 MiB more, which the console does not have free.\n- **4-bit attention cache.** The attention cache is quantized to 4 bits too, which is how a 16K context fits.\n- **GPU-visible memory.** The weights live in \"Garlic\" memory, the PS4's name for the memory the GPU reads directly. That is where the project's name comes from.\n- **The rest is plain C.** The tokenizer, the user interface, the text renderer and the audio path run on the CPU. Python programs run on an embedded [MicroPython](https:\u002F\u002Fmicropython.org).\n\nThe app is built with the open-source [OpenOrbis](https:\u002F\u002Fgithub.com\u002FOpenOrbis\u002FOpenOrbis-PS4-Toolchain) toolchain. The techniques, the measurements and the dead ends are written up in a 147-page guide, [*Nine Billion Parameters on a PS4*](https:\u002F\u002Fko-fi.com\u002Fs\u002F5d8050b149).\n\n## API\n\nGarlic LLM can serve an OpenAI-compatible API on your network, so that your own programs and apps use the model on the console. It is off until you turn it on.\n\n> The API is new. It is in the source code and comes with the next package; version 1.19 does not have it yet.\n\n**Turn it on.** On the chat screen, press **L3** (click the left stick). The top of the screen then shows where the API listens, for example `API · 192.168.1.5:8080`. L3 again turns it off, and the app remembers the choice for the next time.\n\n**Use it.** Point any OpenAI client at that address, with `http:\u002F\u002F192.168.1.5:8080\u002Fv1` as its base URL:\n\n```bash\ncurl http:\u002F\u002F192.168.1.5:8080\u002Fv1\u002Fchat\u002Fcompletions \\\n  -H \"Content-Type: application\u002Fjson\" \\\n  -d '{\"messages\":[{\"role\":\"user\",\"content\":\"Hello\"}],\"max_tokens\":128}'\n```\n\n- `GET \u002Fv1\u002Fmodels`, `POST \u002Fv1\u002Fchat\u002Fcompletions` (`stream: true` for server-sent events), `GET \u002Fhealth`.\n- The OpenAPI 3.1 description is at `GET \u002Fopenapi.json` (also in [`chat\u002Fassets\u002Fopenapi.json`](chat\u002Fassets\u002Fopenapi.json)).\n- Replies are generated the way the chat generates its own, speculative decoding included.\n- One request runs at a time, and the chat screen is busy while it does: it says that a request is being answered, and ○ stops the reply (the client gets what was written so far, with `finish_reason: \"length\"`). Requests wait while the keyboard, voice mode or a Python program is open.\n- A request is a conversation of its own, so the one on the console's screen is cleared.\n- Reasoning is off. Only `n = 1` is supported; `tools`, `logprobs` and similar parameters are ignored.\n- For an API key, put it in `\u002Fdata\u002Fgarlic_api_key.txt` on the console. Requests then need `Authorization: Bearer \u003Ckey>`. Without that file, anyone on your network can use the API while it is on, and clients that insist on a key accept any text.\n- If the screen shows `API · :8080`, the app could not read the console's address: it is in *Settings → Network → View Connection Status*.\n\n## Build from source\n\nYou only need this to change the app. The build scripts are written for Windows.\n\n**Tools**\n\n- Python 3 with `numpy` and `Pillow`.\n- The [OpenOrbis PS4 Toolchain](https:\u002F\u002Fgithub.com\u002FOpenOrbis\u002FOpenOrbis-PS4-Toolchain) in `toolchain\u002FOpenOrbis\u002FPS4Toolchain\u002F`.\n- [Zig](https:\u002F\u002Fziglang.org) in `toolchain\u002Fzig\u002F`. Its bundled clang compiles both the C code and the GCN kernels.\n- The .NET runtime in `toolchain\u002Fdotnet\u002F`, for OpenOrbis' package tool.\n\nTo keep the tools somewhere else, set the `GARLIC_TOOLCHAIN` environment variable to that folder.\n\n**Build the app**\n\n```bash\npython build_chat.py\n```\n\nThis writes the PKG to `build\u002Fchat\u002F`. Add `--upload` to also copy the package to the console over FTP. For `--upload`, set the `PS4_IP` environment variable to your console's address and start GoldHEN's FTP server.\n\nThe app's data files (fonts, tokenizer tables, compiled kernels) are already in `chat\u002Fassets*`, so a build does not need the scripts in `pc\u002F`.\n\n**Model files**\n\nA plain build keeps the weights outside the package. The app looks for each of these files first inside its package (`\u002Fapp0\u002Fmodels`) and then in `\u002Fdata` on the console:\n\n| File | Size | Contents |\n|---|---|---|\n| `qwen3.5-9b-q4s.bin` | 4.32 GiB | Qwen3.5-9B |\n| `qwen3.5-9b-mtp.bin` | 0.20 GiB | The MTP head for speculative decoding |\n| `parakeet-v3-q4i.bin` | 0.33 GiB | Speech to text |\n| `chatterbox-t3.bin` | 0.29 GiB | Text to speech, first stage |\n| `chatterbox-s3gen-mf.bin` | 0.09 GiB | Text to speech, second stage |\n\nThe code can also build a smaller app with Qwen3.5-4B (`--4b`, weights in `qwen3.5-4b-q4i.bin`). It has no speculative decoding and is not released as a package.\n\nDownload them from [Hugging Face](https:\u002F\u002Fhuggingface.co\u002Fgarlic-llm\u002Fgarlic-llm-ps4). `python pc\u002Fupload_model.py \u003Cfile>` copies a file to `\u002Fdata` on the console. To build the all-in-one package instead, put the files in `models\u002F` and add `--full` to the build command.\n\nThe scripts that made them from the original checkpoints are in `pc\u002F`, and each one's header describes its inputs and the file format it writes. The first conversion of the Qwen models (`pc\u002Fmodal_qwen35*.py`) runs on [Modal](https:\u002F\u002Fmodal.com), on machines with 32 to 64 GB of memory.\n\n**Repository layout**\n\n| Path | Contents |\n|---|---|\n| `chat\u002F` | The app: engine, user interface, tokenizer, voice, Python runner |\n| `chat\u002Fpy\u002F` | MicroPython and its port to the console |\n| `shaders\u002F` | The GPU kernels |\n| `pc\u002F` | Converters for the models, reference implementations in NumPy, and the scripts that build the app's data files |\n| `build_chat.py` | Builds the PKG |\n\n## Troubleshooting\n\n- **\"Couldn't start\".** A model file is missing or incomplete. Install the package again. With a build from source, check the files in `\u002Fdata` against the table above.\n- **Dictation hears nothing.** Check that the console sees your microphone, and keep □ held while you speak.\n- **Anything else.** The app writes a log to `\u002Fdata\u002Fps4ai_log.txt`. Attach it when you [open an issue](https:\u002F\u002Fgithub.com\u002Fleonardo-alegria\u002Fgarlic-llm\u002Fissues).\n\n## Questions\n\n**Does it need internet?** No. The model, the voices and the speech recognition run on the console.\n\n**Does it run on a PS4 Pro?** A user reports that version 1.19 works on a PS4 Pro with firmware 12.02, at 25 to 45 tokens\u002Fs. I have not tested it on a Pro myself.\n\n**And on a PS5?** No. Garlic LLM is written for the PS4's GPU and system software.\n\n**Can it harm my console?** It is an ordinary homebrew app and contains no exploit. It needs GoldHEN, which you install at your own risk.\n\n**Is this the first AI on a PS4's GPU?** As far as I know, yes. I found no earlier public project that runs a language model on the PS4's GPU. If you know of one, please [open an issue](https:\u002F\u002Fgithub.com\u002Fleonardo-alegria\u002Fgarlic-llm\u002Fissues).\n\n## Support\n\nGarlic LLM is free and open source. If you want to see more of it (more consoles tested, faster kernels), you can help fund the work:\n\n- [PayPal](https:\u002F\u002Fwww.paypal.com\u002Fdonate\u002F?business=leonardoalegria2002%40gmail.com&currency_code=USD)\n- [Ko-fi](https:\u002F\u002Fko-fi.com\u002Fleonardoalegria)\n- Buy the guide, [*Nine Billion Parameters on a PS4*](https:\u002F\u002Fko-fi.com\u002Fs\u002F5d8050b149) (PDF, pay what you want from 19 USD)\n\nBug reports and test results from other consoles help just as much.\n\n## Licence and credits\n\nThe app's code is licensed under the [GNU General Public License v3.0](LICENSE). The models and third-party components keep their own licences:\n\n| Component | Author | Licence |\n|---|---|---|\n| Qwen3.5-9B and Qwen3.5-4B | Alibaba Qwen | Apache-2.0 |\n| Chatterbox (text to speech) | Resemble AI | MIT |\n| Parakeet TDT 0.6B v3 (speech to text) | NVIDIA | CC-BY-4.0 |\n| MicroPython | The MicroPython project | MIT |\n| Twemoji | Twitter, Inc. and other contributors | CC-BY-4.0 |\n| Fonts: Selawik, Noto, Arimo, Inconsolata, Cascadia Mono | Their authors | SIL OFL 1.1 |\n| DejaVu Sans | Its authors | Bitstream Vera licence and public domain |\n\nThe complete notices are in [`CREDITS.md`](CREDITS.md) and ship inside the app.\n\nGarlic LLM is built with the [OpenOrbis PS4 Toolchain](https:\u002F\u002Fgithub.com\u002FOpenOrbis\u002FOpenOrbis-PS4-Toolchain) and runs on consoles with [GoldHEN](https:\u002F\u002Fgithub.com\u002FGoldHEN\u002FGoldHEN). Both are third-party projects by their own authors, and Garlic LLM would not exist without them.\n\n## Contact\n\nGarlic LLM is built by [Leonardo Alegría](https:\u002F\u002Fwww.linkedin.com\u002Fin\u002Fleonardoalegria\u002F). Questions, collaborations and press: [leo@garlicllm.dev](mailto:leo@garlicllm.dev). Bugs and test results go to [GitHub issues](https:\u002F\u002Fgithub.com\u002Fleonardo-alegria\u002Fgarlic-llm\u002Fissues).\n\n---\n\nNot affiliated with or endorsed by Sony Interactive Entertainment. PlayStation and PS4 are trademarks of their owners.\n","Garlic LLM 是一款专为 PlayStation 4 定制的离线大语言模型运行框架，可在无网络、不依赖 PC 的条件下本地加载并推理 Qwen3.5-9B 模型。核心功能包括：文本对话（16K上下文、最高43 token\u002Fs）、多语种语音输入（25种欧洲语言）与语音输出（7种语言）、MicroPython 代码生成与即时执行、以及可选的思维链推理模式。全部计算均在 PS4 GPU 上完成，模型权重与推理引擎以 C 语言实现，强调隐私性与设备自主性。适用于嵌入式AI探索、复古游戏主机改造、离线教育演示及边缘端轻量LLM实验等场景。",2,"2026-11-24 04:49:29","CREATED_QUERY"]