Upload README.md
Browse files
README.md
ADDED
|
@@ -0,0 +1,77 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: apache-2.0
|
| 3 |
+
language: code
|
| 4 |
+
tags:
|
| 5 |
+
- gemma
|
| 6 |
+
- qlora
|
| 7 |
+
- circuit-synthesis
|
| 8 |
+
- verilog
|
| 9 |
+
- llm
|
| 10 |
+
- electronic-design-automation
|
| 11 |
+
- peft
|
| 12 |
+
- google-colab
|
| 13 |
+
model-index:
|
| 14 |
+
- name: veriforge-gemma-2b-it
|
| 15 |
+
results: []
|
| 16 |
+
---
|
| 17 |
+
|
| 18 |
+
# Veriforge-Gemma-2B-IT 🔧
|
| 19 |
+
|
| 20 |
+
**`veriforge-gemma-2b-it`** is a QLoRA-fine-tuned version of [`google/gemma-2b-it`](https://huggingface.co/google/gemma-2b-it) that specializes in prompt-based circuit synthesis for digital logic design, specifically in Verilog HDL.
|
| 21 |
+
|
| 22 |
+
## 🚀 Model Description
|
| 23 |
+
|
| 24 |
+
- **Base Model**: [`google/gemma-2b-it`](https://huggingface.co/google/gemma-2b-it)
|
| 25 |
+
- **Fine-tuned By**: [louijiec](https://huggingface.co/louijiec)
|
| 26 |
+
- **Method**: QLoRA using PEFT and bitsandbytes
|
| 27 |
+
- **Data**: 500 simulated Verilog gate examples (AND, OR, NAND, etc.)
|
| 28 |
+
- **Platform**: Google Colab
|
| 29 |
+
|
| 30 |
+
## 🧠 Example Usage
|
| 31 |
+
|
| 32 |
+
```python
|
| 33 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
| 34 |
+
|
| 35 |
+
model_id = "louijiec/veriforge-gemma-2b-it"
|
| 36 |
+
tokenizer = AutoTokenizer.from_pretrained(model_id)
|
| 37 |
+
model = AutoModelForCausalLM.from_pretrained(model_id)
|
| 38 |
+
|
| 39 |
+
prompt = "### Prompt:\nWrite Verilog code for a 3-input XOR gate.\n\n### Response:\n"
|
| 40 |
+
inputs = tokenizer(prompt, return_tensors="pt")
|
| 41 |
+
outputs = model.generate(**inputs, max_new_tokens=100)
|
| 42 |
+
print(tokenizer.decode(outputs[0], skip_special_tokens=True))
|
| 43 |
+
```
|
| 44 |
+
|
| 45 |
+
## 🧪 Sample Output
|
| 46 |
+
|
| 47 |
+
```verilog
|
| 48 |
+
module nand_3_input (output y, input a0, a1, a2);
|
| 49 |
+
assign y = ~(a0 & a1 & a2);
|
| 50 |
+
endmodule
|
| 51 |
+
```
|
| 52 |
+
|
| 53 |
+
## 📚 Training Details
|
| 54 |
+
|
| 55 |
+
- LoRA rank: 8
|
| 56 |
+
- Bits: 4-bit (QLoRA)
|
| 57 |
+
- Max tokens: 512
|
| 58 |
+
- Optimizer: AdamW, FP16
|
| 59 |
+
- Trained using Hugging Face `Trainer` on synthetic Verilog tasks
|
| 60 |
+
|
| 61 |
+
## 📎 Citations
|
| 62 |
+
|
| 63 |
+
- Gemma by Google: https://huggingface.co/google/gemma-2b-it
|
| 64 |
+
- QLoRA: https://arxiv.org/abs/2305.14314
|
| 65 |
+
- PEFT: https://github.com/huggingface/peft
|
| 66 |
+
|
| 67 |
+
## ⚠️ Limitations
|
| 68 |
+
|
| 69 |
+
- Trained only on simple gates
|
| 70 |
+
- No memory/state logic (flip-flops, FSMs, etc.)
|
| 71 |
+
- No formal verification or testbench evaluation
|
| 72 |
+
|
| 73 |
+
## 🛠️ Future Work
|
| 74 |
+
|
| 75 |
+
- Add support for more circuit components (MUX, ALU)
|
| 76 |
+
- Formal testbench generation
|
| 77 |
+
- Build EDA pipeline integrations
|