Vibecoding an inference chip
- ID: 3e30621e
- 原文链接: https://ankitg.me/blog/vibecoding-inference-chip
- 作者/来源: Ankit Gupta
- 日期: 2026-11-20
- 分类: infra
- 来源类型: article
- 标签: fpga, inference, vibe-coding, hardware
- 质量评分: 4/5
- 抓取时间: 2026-11-21T12:26:43Z
中文解读
作者用编码智能体(Codex)在 AWS F2 FPGA 实例上从零做出 LLM 推理:无乘法器,2-bit 权重驱动 3:1 mux(选 x、~x 或 0),激活用分组的 INT12/INT16、FP32 累加,MoE 专家按 channel 切分、router 走并行实现,权重从 HBM 直通计算 lanes。整个实验史累计约 3M 行代码、解析 30M 行输出文件,实测吞吐从基线 6.43 涨到 213 tokens/s(33 倍),一路穿过并行 MoE router、真 draft model 的精确投机解码、head-shadow 失败后再投机等十几步优化。作者的体感是编码智能体把他带进了以前够不着的新领域;DeepGrove 创始人回应:几个月前模型还做不到这件事。
为什么值得关注
这是「编码智能体把个人工程师推进硬件领域」的第一手记录:门槛下移的不是 Verilog 技巧,而是 token 预算和迭代速度——33 倍吞吐是一步步 agent 迭代跑出来的,不是一次生成。
以上判断锚定原文抓取内容,具体数字与说法可在下方 Source excerpt 中对照验证。
关键信息
- 标题:Vibecoding an inference chip
- 作者/来源:Ankit Gupta
- 原文链接:https://ankitg.me/blog/vibecoding-inference-chip
- 发布时间:2026-11-20
- 关联标签:fpga, inference, vibe-coding, hardware
English Summary
Ankit Gupta vibe-coded FPGA-based LLM inference on AWS F2 instances with coding agents (Codex): no multipliers — a 2-bit weight drives a 3:1 mux picking x, ~x, or 0; grouped INT12/INT16 activations accumulate in FP32; MoE experts are striped across channels with a parallel router; weights stream from HBM into compute lanes. The experiment history wrote roughly 3M lines (and parsed 30M lines of output) as measured throughput went from the 6.43 tokens/s baseline to 213 (33x), through steps like a parallel exact MoE router, exact speculative decoding with a real draft model, and re-speculation after head-shadow misses. The author notes coding agents opened up an entirely new hardware domain; DeepGrove's founders noted that only a few months earlier the models were not good enough for this.
原文抓取 / Source excerpt
抓取时间: 2026-11-21T12:26:43Z
原文链接: https://ankitg.me/blog/vibecoding-inference-chip
One of the more entertaining things about programming recently is that coding agents let me work in entirely new domains by giving me access to new programming languages and paradigms. Lately, that has meant hacking on hardware, now that writing low-level software is much easier. So, in this blog post, I’m going to try to recount the experience of vibe coding an FPGA, going through a series of “oh shit” moments several times, and giving myself a new appreciation for what’s possible if you have a large token budget (thanks YC) and interesting problems to point the models at. I overheard some founders recently talk about how FPGAs work. I’ll admit I was relatively naive about them. I’d never really experimented with them in my startup or in college, so I knew little about them before. The basic idea I was familiar with: you can program a circuit into a reprogrammable chip. So rather than having a general purpose computing architecture (like a CPU) you can have a reprogrammable one, i.e. the configuration loaded onto the chip determines how its logic and routing are connected, and that (in theory) enables performance advantages. I also know that it took a mountain of C++ to write and involved manually analyzing waveforms for simulation and verification. I had never done this before though and it seemed cumbersome. That’s about what I knew going into this. Naturally, my ML brain thought “could we use these for AI inference”. I’m not the first to think this — there are a few repos attempting to port ML models to FPGAs on Github. But I hadn’t actually seen a writeup on whether coding agents are good at writing the low level C++ and Verilog code to program them and verifying the outputs so that they actually run accurately. (Spoiler alert, they are incredible at programming them.) So I decided I needed to get my hands on one. AWS has F2 instances with FPGA hardware, and that seemed easier than going and buying physical hardware, so I asked Codex to spin up a reservation and got cooking. It had a relatively limited memory of 16 GB of FPGA HBM. Around the same time, I was working with the DeepGrove founders who were discussing their new ternary weight architecture that is well suited for memory limited cases. It’s SOTA on Mac hardware with actual agentic tool calling, so I figured why not, let’s see if I can get this working on an FPGA and fast enough to be useful. What followed was a cloud agent running in Conductor for several days with me mostly just encouraging it periodically while it both (1) got a model fully running and (2) increased its speed by 33× from the first full-model bit-exact baseline to get it to a real-time relevant speed. It was one of the most mind blowing autoresearch loops I’ve run, ultimately writing roughly 3M lines across the experiment history and parsing 30M lines of output files, burning only $10,000 in Claude and OpenAI tokens to run hundreds of experiments. Most of the code is C++ and some Verilog. It’s been probably a decade since the last time I wrote any serious amount of C++ and I’ve never written Verilog. I honestly don’t know the first thing about Verilog. Most of my prompts were not particularly clever: they consisted mostly of me saying things like “you’re a superintelligent model, time to be more creative” and “let’s go for 2x faster, you got this”. Sometimes I brought some ML knowhow like “hey it’s time to consider speculative decoding” or “why is that running on CPU, you should port it”. But for the most part, it was just vibes and I’m pretty sure that with enough time the model would have figured out those things. Also, it seemed that both Astra and Opus (new Fable wasn’t out yet) were pretty capable at this and I could use them interchangeably. I’m sure someone has a good benchmark for which is smarter but both passed my smart-enough threshold. Summary of my most impactful prompts. Most of that first third is just getting AWS set up and approving quota for f2 instances. From “it works” to 213 tokens per second Getting faster, one experiment at a time Measured benchmark tokens/s · select a step to see what changed Baseline 6.43 Host overhead 8.07 Burst attention 14.02 Parallel router 20.53 Glue engine 30.24 New pipeline 49.21 Prompt speculation 51.25 Router relay 58.43 Head shadow 94.44 Draft model 105.63 Memory ports 108.81 Attention overlap 134.99 Weight packing 171.3 Re-speculation 184.19 Parallel head loader 213.13 Step 14 · 33.13× baseline A head loader that reads both of its memory banks at once (+17.3%, measured on and off on one image), a runtime expert-prefetch policy, and the router-job timing fix; run one clock step lower (225/425 MHz) after a soak test found random faults at 231.25. The chart follows the measured optimization sequence: 6 → 213 tokens/s , or 33× the baseline. How much did the human advice help? At one point, around when it got to 10 TPS, I messaged the DeepGr
……(截取窗口,非全文)
Obsidian Notes
- 原文经 curl 直抓(opencli web read 导航被拒后的回退;301 → trailing slash),正文窗口截取自页面纯文本。
- 中文导读与价值判断锚定在抓取正文与条目既有摘要上;页面正文未出现 Qwen 字样,MoE 细节以正文原句为准。