CRAP:基于Gemma微调直接生成Linux ELF二进制文件
Coding is solved* (exclusions apply)
这是一次极具工程趣味的一手实践,展示了LLM直接生成机器码的可行性与边界。对于关注Agent底层执行或模型极限能力的开发者,其评估数据、量化部署方案及失败案例复盘都值得深入参考。
Good news, everyone! Having been inspired to revolutionize the field of computer science, I can now report that coding is solved! Sure, only if you care about x86 Linux binaries that print and exit, but "big journeys" and "small steps" and what not.
好消息,各位!受启发去彻底革新计算机科学领域,我现在可以宣布:编码问题已解决!当然,前提是你只关心那些打印内容并退出的 x86 Linux 二进制文件,毕竟“千里之行”始于足下嘛。
CRAP (Compiler Replacement for Assembling Programs) is a Gemma 4 E2B fine tune that takes prompts like generate a Linux x86_64 binary that prints 'boop' and emits a working ELF binary (as hex, most of the time, every time). See, since programs end up as a binary anyway, why not just skip the middleman and write the binary itself? No compiler, no assembler, no tool calls. v1.1 is out with improved multi turn and out of distribution performance. Trust me, I know, this is super important work.
CRAP(Compiler Replacement for Assembling Programs,汇编程序编译器替代品)是一个基于 Gemma 4 E2B 的微调模型,它能接收诸如“生成一个打印 'boop' 的 Linux x86_64 二进制文件”这样的提示词,并输出一个可用的 ELF 二进制文件(通常以十六进制形式输出,且几乎每次都能成功)。你看,反正程序最终都会变成二进制文件,为什么不跳过中间环节直接编写二进制文件本身呢?无需编译器,无需汇编器,无需工具调用。v1.1 版本已发布,在多轮对话和分布外性能方面有所提升。相信我,我知道,这是超级重要的工作。
v1.1 eval numbers for the nerds (eval is scored on behavior: the binary has to run, print the right string and exit with the right code):
给极客们的 v1.1 评估数据(评估标准基于行为表现:二进制文件必须能运行、打印正确的字符串并以正确的代码退出):
- Held out legacy set: 20/23, same as v1
- Novel strings: 26/40 (v1: 8/40)
- Multi turn (~3 turns): 10/12 (v1: 0/12)
- Doubled character strings (boom, etc.): 18/24 (v1: 2/24)
- Random jank exit codes it never trained on: 23/25
- 保留的旧版数据集:20/23,与 v1 相同
- 新字符串:26/40(v1:8/40)
- 多轮对话(约 3 轮):10/12(v1:0/12)
- 翻倍字符字符串(如 boom 等):18/24(v1:2/24)
- 它从未训练过的随机错误退出代码:23/25
An interesting tidbit: one training run hit 0.038 loss while still failing 11 of its 12 trained exit codes, so gradient descent != task completion ascent.
一个有趣的细节:在一次训练中,损失值降至 0.038,但仍有 12 个训练过的退出代码中的 11 个失败,因此梯度下降不等于任务完成度的提升。
Aaannndddnd it runs in your browser.
而且,它能在你的浏览器中运行。
The demo loads the Q6_K GGUF (~3.6 GiB) through wllama on WebGPU, streams the hex, parses it and hands you the ELF to run yourself (naturally, you need to download and run the actual binary, the browser won't do that). Q6_K scores 109/144 against the full f16's 114/144 (the five additional failed for Q6 are wrong values, not totally broken binaries). Q4_K_M scored 3/144, so the demo doesn't use it (that quant is crap, not CRAP) ... concerning. Also, tested in Chrome on an M4 Pro Mac; Firefox loads it but generates slowly and nothing else has been tested.
演示通过 WebGPU 上的 wllama 加载 Q6_K GGUF(约 3.6 GiB),流式传输十六进制数据,解析后交给你自行运行的 ELF 文件(当然,你需要下载并运行实际的二进制文件,浏览器不会替你这么做)。Q6_K 在满分 144 分中得了 109 分,而完整的 f16 模型得分为 114/144(Q6 多失败的 5 项是数值错误,而非完全损坏的二进制文件)。Q4_K_M 仅得 3/144,因此演示未使用它(那个量化版本真是垃圾,配不上 CRAP 这个名字)……令人担忧。此外,已在 M4 Pro Mac 的 Chrome 上测试;Firefox 能加载但生成缓慢,其他浏览器尚未测试。
- Demo: https://huggingface.co/spaces/matthewhaynesonline/crap-demo
- Weights (v1.1): https://huggingface.co/matthewhaynesonline/gemma-4-E2B-it-crap-1.1
- "Paper": https://github.com/matthewhaynesonline/crap-public/blob/main/paper/paper.pdf
- Code: https://github.com/matthewhaynesonline/crap-public
- Blog post: https://blog.studiohaynes.com/2026/07/19/compilers-overrated.html
- Video: https://youtu.be/55IBMzFQNYU
- 演示:https://huggingface.co/spaces/matthewhaynesonline/crap-demo
- 权重(v1.1):https://huggingface.co/matthewhaynesonline/gemma-4-E2B-it-crap-1.1
- "论文":https://github.com/matthewhaynesonline/crap-public/blob/main/paper/paper.pdf
- 代码:https://github.com/matthewhaynesonline/crap-public
- 博客文章:https://blog.studiohaynes.com/2026/07/19/compilers-overrated.html
- 视频:https://youtu.be/55IBMzFQNYU
Fine print for the buzzkills: only programs that print a string and exit can be generated. Obviously, a compiler does that deterministically, correctly and in milliseconds; CRAP does it with several gigabytes of weights, slower and occasionally incorrectly.
给扫兴者的细读条款:只能生成打印字符串并退出的程序。显然,编译器能以确定性、正确且毫秒级的速度做到这一点;而 CRAP 则需要数 GB 的权重,速度更慢且偶尔出错。
更进一步:量化金融体系
看懂新闻只是起点——沿量化金融路径,把它变成能交付的工程能力