Instructions to use Elinnos/elinnos-sv-v7-ahb with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- PEFT
How to use Elinnos/elinnos-sv-v7-ahb with PEFT:
from peft import PeftModel from transformers import AutoModelForCausalLM base_model = AutoModelForCausalLM.from_pretrained("/workspace/elinnos/models/qwen25-7b-v3v4v5v6-merged") model = PeftModel.from_pretrained(base_model, "Elinnos/elinnos-sv-v7-ahb") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- Unsloth Studio
How to use Elinnos/elinnos-sv-v7-ahb with Unsloth Studio:
Install Unsloth Studio (macOS, Linux, WSL)
curl -fsSL https://unsloth.ai/install.sh | sh # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for Elinnos/elinnos-sv-v7-ahb to start chatting
Install Unsloth Studio (Windows)
irm https://unsloth.ai/install.ps1 | iex # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for Elinnos/elinnos-sv-v7-ahb to start chatting
Using HuggingFace Spaces for Unsloth
# No setup required # Open https://huggingface.co/spaces/unsloth/studio in your browser # Search for Elinnos/elinnos-sv-v7-ahb to start chatting
Load model with FastModel
pip install unsloth from unsloth import FastModel model, tokenizer = FastModel.from_pretrained( model_name="Elinnos/elinnos-sv-v7-ahb", max_seq_length=2048, )
ELINNOS SV-v7-AHB
ELINNOS (Electronic Language Intelligence for Neural Network-Optimized Systems) is a series of incrementally fine-tuned language models specialized for VLSI/RTL hardware design, SystemVerilog, AMBA AHB protocol, and Pulse HDL workflows.
Version 7 (AHB) is the seventh adapter in the chain, trained on top of the Qwen2.5-7B-Instruct base with all prior adapter weights merged, adding AMBA AHB protocol expertise with mandatory chain-of-thought reasoning (<think>...</think>) for AHB tasks.
This repository contains the LoRA adapter only. The base model is
Qwen/Qwen2.5-7B-Instruct.
A merged (standalone) model is available atElinnos/elinnos-sv-v7-ahb-merged.
GGUF quantized versions are available atElinnos/elinnos-sv-v7-ahb-GGUF.
Model Details
| Field | Value |
|---|---|
| Architecture | Qwen2-7B (decoder-only transformer) |
| Base Model | Qwen/Qwen2.5-7B-Instruct |
| Adapter Chain | v3 β v4 β v5 β v6 β v7 (this) |
| LoRA Rank | r=96, alpha=192, dropout=0.05 |
| Target Modules | q_proj, k_proj, v_proj, o_proj, gate_proj, up_proj, down_proj |
| Adapter Size | ~925 MB (safetensors) |
| Training Precision | bf16 + tf32 (NVIDIA Ampere) |
| Max Sequence Length | 8192 tokens |
| Training Date | June 2026 |
Capabilities
The model performs 8 core tasks governed by two output modes:
Direct Mode (Tasks 1β7) β no reasoning tags, structured output only
- Bidirectional translation β Verilog/SystemVerilog/Pulse HDL β Pulse HDL console logs
- Pulse HDL tool debugging β structured JSON debug reports (
issue_type,root_cause,fix_steps,commands,verification,reasoning,confidence) - SystemVerilog simulation prediction β predict exact
xrunoutput including pass/fail and$displaymessages - SystemVerilog code generation β IEEE 1800-2017/1364, self-contained, self-checking assertions
- Pulse HDL bug repair β fix buggy HDL given simulator error log
- xrun bug repair β fix buggy SV/Verilog given xrun error log
- Native tool-calling β structured function calls for multi-step design workflows
Thinking Mode (Task 8) β mandatory <think>...</think> before answer
- AMBA AHB protocol expertise β bus matrix generation, RTL design, verification, arbitration, address map layout, pipeline stage design, testbench generation, SVA assertions, UVM skeletons (AMBA 2.0 / AHB-Lite)
Quick Start
With the LoRA Adapter (4-bit, memory-efficient)
import torch
from transformers import AutoTokenizer, AutoModelForCausalLM, BitsAndBytesConfig
from peft import PeftModel
bnb_cfg = BitsAndBytesConfig(
load_in_4bit=True,
bnb_4bit_compute_dtype=torch.bfloat16,
bnb_4bit_use_double_quant=True,
bnb_4bit_quant_type="nf4",
)
base = AutoModelForCausalLM.from_pretrained(
"Qwen/Qwen2.5-7B-Instruct",
quantization_config=bnb_cfg,
device_map="auto",
)
model = PeftModel.from_pretrained(base, "Elinnos/elinnos-sv-v7-ahb")
tokenizer = AutoTokenizer.from_pretrained("Elinnos/elinnos-sv-v7-ahb")
model.eval()
SYSTEM = """You are Elinnos, a hardware design, verification, and reasoning assistant \
specialising in SystemVerilog, Pulse HDL, AMBA AHB protocol, and xrun-based simulation \
workflows. ...""" # see inference_v7.py for full system prompt
messages = [
{"role": "system", "content": SYSTEM},
{"role": "user", "content": "Design an AHB-Lite slave with 4 read/write registers."},
]
text = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
inputs = tokenizer(text, return_tensors="pt").to(model.device)
with torch.inference_mode():
out = model.generate(**inputs, max_new_tokens=2048, do_sample=False)
print(tokenizer.decode(out[0][inputs["input_ids"].shape[1]:], skip_special_tokens=True))
With the Merged Model (no adapter load needed)
from transformers import AutoTokenizer, AutoModelForCausalLM, BitsAndBytesConfig
import torch
bnb_cfg = BitsAndBytesConfig(load_in_4bit=True, bnb_4bit_compute_dtype=torch.bfloat16,
bnb_4bit_use_double_quant=True, bnb_4bit_quant_type="nf4")
model = AutoModelForCausalLM.from_pretrained(
"Elinnos/elinnos-sv-v7-ahb-merged",
quantization_config=bnb_cfg, device_map="auto"
)
tokenizer = AutoTokenizer.from_pretrained("Elinnos/elinnos-sv-v7-ahb-merged")
Training Details
Dataset
- File:
elinnos_v8_training_combined.jsonl - Total records: 744 (474 AHB + 270 replay from prior versions)
- Split: train 80% (596) / val 10% (74) / test 10% (74) β stratified by layer
- Dataset repo:
Elinnos/elinnos-sv-v7-training-data
Hyperparameters
| Parameter | Value |
|---|---|
| Epochs | 4 |
| Batch size | 1 (effective: 16 via grad. accum.) |
| Learning rate | 4e-5 (cosine schedule) |
| Warmup ratio | 0.03 |
| LoRA r / alpha | 96 / 192 |
| LoRA dropout | 0.05 |
| Max seq length | 8192 |
| Seed | 42 |
Training Metrics
| Epoch | train_loss | eval_loss |
|---|---|---|
| 1 | 0.5899 | 0.5761 |
| 2 | 0.4880 | 0.5544 |
| 3 | 0.4322 | 0.5408 β best |
| 4 | 0.4155 | 0.5464 |
Best checkpoint loaded at end of training (load_best_model_at_end=True).
Infrastructure
- GPU: NVIDIA RTX A6000 (48 GB VRAM, Ampere SM 8.6, CUDA 13.0)
- Framework: TRL SFTTrainer + PEFT LoRA + Unsloth + HuggingFace Transformers
- Gradient checkpointing: Unsloth
use_gradient_checkpointing="unsloth"+gradient_checkpointing=Truein SFTConfig
Evaluation Results
Evaluated on 74 held-out test samples (greedy decoding, max_new_tokens=2048):
| Metric | Value |
|---|---|
| ROUGE-L (overall) | ~0.38 |
| think_ok (AHB gate compliance) | β₯93% (69/70 confirmed at step 70) |
| AHB samples in test set | 47 (63%) |
| Non-AHB samples | 27 (37%) |
By layer (AHB difficulty):
| Layer | Description | Samples |
|---|---|---|
| 0 | AHB fundamentals | 8 |
| 1 | AHB slave design | 8 |
| 2 | AHB bus matrix | 10 |
| 3 | AHB verification | 8 |
| 4 | AHB UVM | 7 |
| 5 | AHB advanced | 6 |
| ? | Replay (non-AHB tasks) | 27 |
Key Observations
- ROUGE-L β 0.38 is expected and appropriate for RTL/code generation: exact character-level matching is inherently strict for code where multiple valid implementations exist. Human evaluation would show higher functional correctness.
- think_ok β₯ 93% confirms the model reliably gates
<think>...</think>to AHB tasks only. - Known issue β spurious
<think>in 1β2 non-AHB replay samples (layer=?): these samples lack explicittask_idmetadata, making task-type discrimination harder. Mitigation: v8 dataset will add explicittask_typefield to all samples. - Isolated AHB failures (β€5/47): some hard AHB samples with >1500-token think traces produced unclosed
</think>due tomax_new_tokens=2048truncation. Increasing to 4096 resolves this at inference time.
Full Pipeline
The ELINNOS fine-tuning pipeline consists of the following phases:
| Phase | Description | Status |
|---|---|---|
| 0 | Environment setup (pip, .env, dirs) | β |
| 1 | Dataset preparation & copy to datasets/ |
β |
| 2 | Training script train_elinnos_v7.py |
β |
| 3 | Dry run (--max_steps 5, OOM-free gate) |
β |
| 4 | Full training (4 epochs, --merge_after) |
β |
| 5 | Evaluation eval_v7.py on test set |
β |
| 6 | Inference script inference_v7.py |
β |
| 7 | GGUF conversion + quantization (Q4_K_M, Q8_0) | β |
| 8 | HF push (adapter, merged, GGUF, dataset) + Ollama | β |
Pipeline scripts are included in this repository under scripts/.
Adapter Chain History
| Version | Focus | Base adapter applied on |
|---|---|---|
| v3 | Foundation SV/Verilog | Qwen2.5-7B-Instruct (personal) |
| v4 | Pulse HDL & xrun | v3 merged |
| v5 | Simulation prediction | v4 merged |
| v6 | Multi-task consolidation | v5 merged |
| v7 | AMBA AHB expertise + thinking | v6 merged |
Each adapter is trained on the CPU-merged snapshot of all prior adapters, enabling true incremental specialization without catastrophic forgetting.
Limitations
- RTL generation quality should be verified via simulation (
xrun/verilator) before use in production. - The model was trained on a curated internal dataset; it may not generalize perfectly to proprietary/undocumented EDA tool variants.
- Think-mode traces can be truncated on very complex multi-module AHB designs if
max_new_tokensis too low. Use β₯4096 for best results. - Not evaluated on UVM sequences beyond basic skeleton generation.
Repository Contents
βββ adapter_model.safetensors # LoRA adapter weights (~925 MB)
βββ adapter_config.json # PEFT config (r=96, Ξ±=192, target_modules)
βββ tokenizer.json # Tokenizer (Qwen2 BPE)
βββ tokenizer_config.json # Chat template
βββ README.md # This model card
βββ scripts/
β βββ train_elinnos_v7.py # Full training script
β βββ eval_v7.py # Evaluation script
β βββ inference_v7.py # Interactive inference REPL
βββ logs/
βββ train_v7_full.log # Full training run log
βββ eval_v7.log # Evaluation run log
Citation
@misc{elinnos_sv_v7_ahb_2026,
title = {ELINNOS SV-v7-AHB: Incremental LoRA Fine-tuning of Qwen2.5-7B for AMBA AHB Hardware Design},
author = {Elinnos Organization},
year = {2026},
publisher = {HuggingFace},
howpublished = {\url{https://huggingface.co/Elinnos/elinnos-sv-v7-ahb}},
}
Framework Versions
- PEFT 0.19.1
- TRL 0.24.0
- Transformers 5.5.0
- Unsloth (latest)
- PyTorch 2.10.0
- Datasets 4.3.0
- Downloads last month
- 17