Downloads · 30 days
12
13% of all-time downloads
Meghansh11/Qwen2.5-3B-Solidity-V2
Qwen2.5-3B-Solidity-V2 is a machine learning model from Meghansh11. Use it for the machine learning task on the model card, and read the license before you ship it in a product. The card lists the license as apache-2.0.
A specialized, fine-tuned large language model pipeline designed to securely translate structured legal contract clauses into modern, secure smart contracts conforming strictly to the Solidity 0.8.20 standard.
Downloads · 30 days
12
13% of all-time downloads
All-time downloads
94
Public
Repo size
1.9 GB
Likes
1
Public
Click a slice to open those files.
.gguf1.9 GB · 100%
From the Hugging Face model README
A specialized, fine-tuned large language model pipeline designed to securely translate structured legal contract clauses into modern, secure smart contracts conforming strictly to the Solidity 0.8.20 standard.
We structured our development team like a real-world production machine learning pipeline, dividing core engineering responsibilities across 4 roles:
Qwen/Qwen2.5-3B-Instruct (Chosen for its lightweight footprint and strong base capability in structural formatting and reasoning).Unsloth (Utilized to accelerate training speed and heavily reduce VRAM consumption during computation via optimized gradient checkpointing).q_proj, v_proj, k_proj, etc.) to isolate the translation layers.The dataset uses a specialized 2-key structural schema to map conversational constraints cleanly into localized Qwen token blocks.
{"instruction": "...", "output": "..."}<|im_start|>system
[Custom System Alignment Rules]<|im_end|>
<|im_start|>user
[Legal Clause Input]<|im_end|>
<|im_start|>assistant
[Architectural Plan + Secure Solidity Code]<|im_end|>
Q4_K_M GGUF (Compiles the 3B layers into a highly optimized ~2GB package, allowing smooth execution on standard consumer hardware).solidity_dataset.json) into the Google Colab workspace.fine_tune_qwen.py script to initiate the TRL SFTTrainer.TrainingArguments can cause serialization crashes (PicklingError) at step checkpointing on newer versions of trl. This is bypassed by utilizing the native SFTConfig block and setting save_strategy = "no".model.save_pretrained_gguf to natively compile the layers into a quantized GGUF format..gguf weights from your drive.C:\Users\<User>\.cache\lm-studio\models\local\qwen-solidity\).Because a 3B parameter model is highly compact, it can occasionally slip back into older, pre-2020 compiler quirks (like declaring constructor() public or forgetting state mutations). To solve this, you must apply explicit behavioral boundaries in the UI:
You are an expert Solidity compiler assistant specializing in modern, secure smart contracts conforming strictly to version 0.8.20.
OUTPUT FORMAT RULES:
1. Always start your response with a clean "ARCHITECTURE PLAN" broken down into "State Variables:" and "Functions:".
2. Follow the plan with a clean markdown code block starting with exact keyword "solidity".
3. NEVER add visibility modifiers (like 'public') to the 'constructor'. Write it as: constructor() { ... }
4. If a function is restricted to the owner, apply the `onlyOwner` modifier to its definition.
Verification & Testing
Once the UI is configured, test the alignment with a prompt containing a real-world legal constraint:
Plaintext
Convert the following legal clause into a secure Solidity 0.8.20 smart contract.
[CLAUSE]
1. The contract must track a public timestamp marking a release deadline.
2. The deployment address is designated as the contract Owner.
3. The Owner can extend this release deadline to a new timestamp in the future.
[/CLAUSE]
Expected Quality Control Metrics:
Structural Parsing: The model outputs an unstructured text ARCHITECTURE PLAN detailing functions and states prior to any code generation.
Syntax Integrity: The generated smart contract omits constructor visibility, applies the custom onlyOwner access modifier, and cleanly validates structural states.