Aiken-Coder-7B-v1
a specialized model for the Aiken smart contract language
2 min readupdated
A new language model designed to help developers writing smart contracts in Aiken, a programming language for the Cardano blockchain. The model is built on Qwen/Qwen2.5-Coder-7B-Instruct and fine-tuned using Qlora (QLoRA (efficient fine-tuning method for large models using quantization)) on more than 10 thousand questions and answers. The project is a student research work with fully published metrics and test results. It will be useful for Cardano blockchain developers who need a local assistant for writing validators.
Key features
- Base: Qwen2.5-Coder-7B-Instruct (7B parameters).
- Dataset: 10,319 code examples and questions according to the Aiken v1.1 and stdlib v2.2.1 standard.
- Training: QLoRA (NF4), which took 55 minutes on a single NVIDIA L4 GPU in Google Colab.
- Distribution: versions are available in GGUF format (including Q4_K_M quantization) and PEFT adapter weights.
What you can do
- Run the model locally via Ollama to generate smart contract code.
- Integrate the adapter into Python scripts using Transformers and PEFT.
- Use in LM Studio for interactive assistance when developing for Cardano.
Example
Example of generating a Python function using Transformers and PEFT:
from transformers import AutoModelForCausalLM, AutoTokenizer
from peft import PeftModel
base = "Qwen/Qwen2.5-Coder-7B-Instruct"
tok = AutoTokenizer.from_pretrained(base)
model = AutoModelForCausalLM.from_pretrained(base, dtype="auto", device_map="auto")
model = PeftModel.from_pretrained(model, "StickmanCharles/Aiken-Coder-7B-v1", subfolder="adapter")
prompt = ("Write an Aiken function `reverse(xs: List) -> List` without using list.reverse. "
"Use Aiken v1.1 and the Aiken standard library v2.2.1.")
inputs = tok.apply_chat_template([{"role": "user", "content": prompt}], add_generation_prompt=True,
return_tensors="pt", return_dict=True).to(model.device)
out = model.generate(**inputs, max_new_tokens=640, do_sample=False)
print(tok.decode(out[0][inputs["input_ids"].shape[1]:], skip_special_tokens=True))
Read more
DetailsBenchmarks: 9 out of 30 correct answers on a specialized internal exam.
Hardware: trained on a single NVIDIA L4.
Limitations: research release, requires mandatory code verification by the aiken check compiler and audit before deployment to a real network.










Comments