| --- |
| title: N64LLMDecompile |
| emoji: ๐ฎ |
| colorFrom: indigo |
| colorTo: purple |
| sdk: gradio |
| app_file: app.py |
| pinned: false |
| license: apache-2.0 |
| tags: |
| - build-small-hackathon |
| - backyard-ai |
| - thousand-token-wood |
| - best-demo |
| - best-use-of-modal |
| - best-use-of-codex |
| - track:backyard |
| - track:wood |
| - sponsor:openai |
| - sponsor:nvidia |
| - sponsor:modal |
| - achievement:offgrid |
| - achievement:welltuned |
| - achievement:fieldnotes |
| --- |
| |
| # N64LLMDecompile ๐ฎ |
|
|
| Decompile Nintendo 64 MIPS functions back into C with a fine-tuned LLM, with |
| compiler-verified scoring against the original target objects. |
|
|
| Built for the Hugging Face **Build Small** hackathon. |
|
|
| **Links:** |
| - ๐ป Source code: [github.com/MatthewLReingold/N64LLMDecompile](https://github.com/MatthewLReingold/N64LLMDecompile) |
| - ๐ฅ Demo video: **[ YouTube link ](https://youtu.be/GVNjPEQKtAY)** |
| - ๐ Writeup: **[ blog link ](https://huggingface.co/blog/MatthewReingold/n64-decomp-dev-blog)** |
| - ๐ฃ Social post: **[ LinkedIn Post](https://www.linkedin.com/posts/matthew-l-reingold_i-spent-the-huggingface-build-small-hackathon-share-7472408495703900160-h__B/?utm_source=share&utm_medium=member_desktop&rcm=ACoAAB3-BzsBKnd6prFEjrTrnAqYnSdX6ZF6egc)** |
|
|
| ## What it does |
|
|
| Given the Ghidra pseudo-C of an N64 MIPS function, the model rewrites it into C |
| source. Optionally, the Space compiles that C with the original compiler and flags |
| and diffs the result against the target object using [asm-differ] โ giving a |
| byte-level match score, where `0` means a byte-perfect match (the metric the decomp |
| community uses to confirm a function is "matched"). |
|
|
| **Two ways to use it:** |
| - **Paste Ghidra pseudo-C** โ get C back. |
| - **Also upload the target object** and pick the compiler + flags โ get a match score. |
|
|
| ## The model |
|
|
| [`MatthewReingold/llm4decompile-9b-v2-n64-finetune`][model] โ a fine-tune of |
| [LLM4Decompile-9B-v2][base] on verified N64 scratches from decomp.me. |
|
|
| ## Results & writeup |
|
|
| _Full results, methodology, and what I learned are covered in the blog post:_ |
|
|
| **[ writeup link coming soon ]** |
|
|
| ## Acknowledgments |
|
|
| Thank you to the work of these teams who all gave the resources used during development: |
|
|
| - **[decomp.me]** โ the scratch database and compiler-toolchain packaging the dataset is built from |
| - **[decompals]** โ IDO static recompilation, and the MIPS GCC / binutils builds |
| - **Paper Mario team ([pmret])** โ the GCC 2.8.1 compiler |
| - **[LLM4Decompile][base] (LLM4Binary)** โ the base model this fine-tune is built on |
| - **[asm-differ]** (simonlindholm) โ the assembly diffing used for scoring |
| - **[Ghidra]** (NSA) โ pseudo-C generation in the data pipeline |
| - **NVIDIA** โ the Nemotron models, used during experimentation |
| - **[Modal]** โ cloud GPU infrastructure and compute credits |
| - **OpenAI** โ Codex, used during development |
| - **Hugging Face** โ hosting the hackathon and ZeroGPU access |
|
|
| ## License |
|
|
| Apache-2.0. The base model and the decomp toolchains retain their own respective licenses. |
|
|
| [model]: https://huggingface.co/MatthewReingold/llm4decompile-9b-v2-n64-finetune |
| [base]: https://huggingface.co/LLM4Binary/llm4decompile-9b-v2 |
| [asm-differ]: https://github.com/simonlindholm/asm-differ |
| [decomp.me]: https://decomp.me |
| [decompals]: https://github.com/decompals |
| [pmret]: https://github.com/pmret |
| [Ghidra]: https://github.com/NationalSecurityAgency/ghidra |
| [Modal]: https://modal.com |
|
|