Discover and explore top open-source AI tools and projects—updated daily.
fguzman82Transformer inference accelerated on custom hardware
New!
Top 53.2% on SourcePulse
Summary
This project implements Andrej Karpathy's microGPT, a character-level Transformer, entirely in Verilog RTL and deploys it on a Xilinx Virtex-5 FPGA. It targets engineers and researchers exploring hardware acceleration for AI models, offering a high-throughput, low-resource implementation of a neural network inference engine on custom silicon. The primary benefit is achieving approximately 50,000–69,000 tokens/second inference speed on an FPGA.
How It Works
The architecture employs a microcode-ROM sequencer driving modular datapath actuators, operating in Q5.11 fixed-point precision. A key optimization is incremental decoding with a persistent KV cache, which significantly reduces computation by processing only new tokens and attending over cached context. This design choice is crucial for achieving high inference throughput on hardware.
Quick Start & Requirements
tools/train.py, tools/export.py, tools/ucode_asm.py). FPGA bitstream generation requires ISE tools with board/xupv5_microgpt_top.prj and board/xupv5_microgpt.ucf.Highlighted Details
Maintenance & Community
No specific community links, active maintenance indicators, or notable contributors are mentioned.
Licensing & Compatibility
The README does not specify a software license, potentially posing compatibility concerns for commercial use.
Limitations & Caveats
Requires specific, older hardware (Virtex-5 FPGA) and a legacy toolchain (Xilinx ISE 14.7). Several Xilinx XST synthesis tool bugs were encountered and require specific workarounds. The implementation is limited to a single transformer block and uses fixed-point arithmetic, which may impact accuracy compared to floating-point, though bit-exact replication to a Python reference is claimed.
2 weeks ago
Inactive